Module Name:    src
Committed By:   ozaki-r
Date:           Mon Aug 19 03:21:13 UTC 2019

Modified Files:
        src/tests/net: net_common.sh

Log Message:
tests: enable to create interfaces other than shmif with rump_server_add_iface

For this change interfaces are destroyed in the reverse order of their
creations in case there are dependencies between interfaces.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/tests/net/net_common.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/net_common.sh
diff -u src/tests/net/net_common.sh:1.32 src/tests/net/net_common.sh:1.33
--- src/tests/net/net_common.sh:1.32	Thu Jul 18 04:22:22 2019
+++ src/tests/net/net_common.sh	Mon Aug 19 03:21:13 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: net_common.sh,v 1.32 2019/07/18 04:22:22 ozaki-r Exp $
+#	$NetBSD: net_common.sh,v 1.33 2019/08/19 03:21:13 ozaki-r Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -321,7 +321,9 @@ rump_server_add_iface()
 
 	export RUMP_SERVER=$sock
 	atf_check -s exit:0 rump.ifconfig $ifname create
-	atf_check -s exit:0 rump.ifconfig $ifname linkstr $bus
+	if [ -n "$bus" ]; then
+		atf_check -s exit:0 rump.ifconfig $ifname linkstr $bus
+	fi
 	export RUMP_SERVER=$backup
 
 	echo $sock $ifname >> $_rump_server_ifaces
@@ -359,13 +361,17 @@ rump_server_destroy_ifaces()
 
 	# XXX using pipe doesn't work. See PR bin/51667
 	#cat $_rump_server_ifaces | while read sock ifname; do
+	# Destroy interfaces in the reverse order
+	tac $_rump_server_ifaces > __ifaces
 	while read sock ifname; do
 		export RUMP_SERVER=$sock
 		if rump.ifconfig -l |grep -q $ifname; then
 			atf_check -s exit:0 rump.ifconfig $ifname destroy
 		fi
 		atf_check -s exit:0 -o ignore rump.ifconfig
-	done < $_rump_server_ifaces
+	done < __ifaces
+	rm -f __ifaces
+
 	export RUMP_SERVER=$backup
 
 	return 0

Reply via email to