[3/3] netns_ext: make test work on CentOS

Submitted by Adrian Reber on July 23, 2018, 7:13 p.m.

Details

Message ID 20180723191333.17862-4-adrian@lisas.de
State New
Series "Series without cover letter"
Headers show

Commit Message

Adrian Reber July 23, 2018, 7:13 p.m.
From: Adrian Reber <areber@redhat.com>

It seems CentOS versions of ip does not understand some commands from
newer iproute packages. This makes the netns_ext test work on CentOS
and also cleans up a few files at the end of the test.

Signed-off-by: Adrian Reber <areber@redhat.com>
---
 test/others/netns_ext/Makefile | 2 ++
 test/others/netns_ext/run.sh   | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/test/others/netns_ext/Makefile b/test/others/netns_ext/Makefile
index 7779a9903..a2e394ac6 100644
--- a/test/others/netns_ext/Makefile
+++ b/test/others/netns_ext/Makefile
@@ -1,2 +1,4 @@ 
 run:
 	./run.sh
+clean:
+	rm -f pidfile pidfile2 pidfile3 test_netns test_netns2 output
diff --git a/test/others/netns_ext/run.sh b/test/others/netns_ext/run.sh
index 04e447f7c..3e6a9adc2 100755
--- a/test/others/netns_ext/run.sh
+++ b/test/others/netns_ext/run.sh
@@ -3,7 +3,7 @@ 
 set -e
 
 CRIU=../../../criu/criu
-setsid unshare -n bash -c 'unshare -n sh _run.sh pidfile2 & unshare -n sh _run.sh pidfile3 & ip link add xxx type veth && ip link add mymacvlan1 link xxx type macvlan mode bridge && . _run.sh pidfile' < /dev/zero &> output &
+setsid unshare -n bash -c 'unshare -n sh _run.sh pidfile2 & unshare -n sh _run.sh pidfile3 & ip link add xxx type veth peer name yyy && ip link add mymacvlan1 link xxx type macvlan mode bridge && . _run.sh pidfile' < /dev/zero &> output &
 sleep 1
 while :; do
 	test -f pidfile && test -f pidfile2 && break;
@@ -13,6 +13,8 @@  done
 pid=$(cat pidfile)
 pid2=$(cat pidfile2)
 
+trap "umount -l test_netns; umount -l test_netns2" EXIT
+
 touch test_netns
 mount --bind /proc/$pid/ns/net test_netns
 touch test_netns2