Module Name:    src
Committed By:   ozaki-r
Date:           Thu Nov  5 02:57:36 UTC 2015

Modified Files:
        src/tests/net/if: t_ifconfig.sh

Log Message:
Add tests for ifconfig parameters

>From s-yamaguchi@IIJ


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/net/if/t_ifconfig.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/if/t_ifconfig.sh
diff -u src/tests/net/if/t_ifconfig.sh:1.3 src/tests/net/if/t_ifconfig.sh:1.4
--- src/tests/net/if/t_ifconfig.sh:1.3	Tue Sep 15 09:51:01 2015
+++ src/tests/net/if/t_ifconfig.sh	Thu Nov  5 02:57:36 2015
@@ -1,4 +1,4 @@
-# $NetBSD: t_ifconfig.sh,v 1.3 2015/09/15 09:51:01 ozaki-r Exp $
+# $NetBSD: t_ifconfig.sh,v 1.4 2015/11/05 02:57:36 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -26,6 +26,7 @@
 #
 
 RUMP_SERVER1=unix://./r1
+RUMP_SERVER2=unix://./r2
 
 RUMP_FLAGS=\
 "-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6 -lrumpnet_shmif"
@@ -181,9 +182,127 @@ options_cleanup()
 	env RUMP_SERVER=${RUMP_SERVER1} rump.halt
 }
 
+
+atf_test_case parameters cleanup
+parameters_head()
+{
+	atf_set "descr" "tests of interface parametors"
+	atf_set "require.progs" "rump_server"
+}
+
+parameters_body()
+{
+	atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${RUMP_SERVER1}
+	atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${RUMP_SERVER2}
+
+	export RUMP_SERVER=${RUMP_SERVER1}
+	atf_check -s exit:0 rump.ifconfig shmif0 create
+	atf_check -s exit:0 rump.ifconfig shmif0 linkstr shmbus
+	atf_check -s exit:0 rump.ifconfig shmif0 192.168.0.1/24
+	atf_check -s exit:0 rump.ifconfig shmif0 up
+	unset RUMP_SERVER
+
+	export RUMP_SERVER=${RUMP_SERVER2}
+	atf_check -s exit:0 rump.ifconfig shmif0 create
+	atf_check -s exit:0 rump.ifconfig shmif0 linkstr shmbus
+	atf_check -s exit:0 rump.ifconfig shmif0 192.168.0.2/24
+	atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.0.3/24 alias
+	atf_check -s exit:0 rump.ifconfig shmif0 up
+	unset RUMP_SERVER
+
+	export RUMP_SERVER=${RUMP_SERVER1}
+
+	# active
+	atf_check -s exit:0 rump.ifconfig shmif0 link b2:a0:75:00:00:01 active
+	atf_check -s exit:0 -o match:'address:.b2:a0:75:00:00:01' \
+	    rump.ifconfig shmif0
+	# down, up
+	atf_check -s exit:0 rump.ifconfig shmif0 down
+	atf_check -s ignore -o ignore -e match:'down' rump.ping -c 1 -n 192.168.0.2
+	atf_check -s exit:0 rump.ifconfig shmif0 up
+	atf_check -s exit:0 -o ignore rump.ping -c 1 -n 192.168.0.2
+
+	# alias
+	atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1/24 alias
+	atf_check -s exit:0 -o match:'alias 192.168.1.1' rump.ifconfig shmif0
+	atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1/24 -alias
+	atf_check -s exit:0 -o not-match:'192.168.1.1' rump.ifconfig shmif0
+	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1
+	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2
+	atf_check -s exit:0 -o match:'fc00::1' rump.ifconfig shmif0 inet6
+	atf_check -s exit:0 -o match:'fc00::2' rump.ifconfig shmif0 inet6
+
+	# delete
+	atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1 alias
+	atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1 delete
+	atf_check -s exit:0 -o not-match:'192.168.1.1' rump.ifconfig shmif0 inet
+	atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.0.1 delete
+	atf_check -s exit:0 -o not-match:'192.168.0.1' rump.ifconfig shmif0 inet
+	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1 delete
+	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2 delete
+	atf_check -s exit:0 -o not-match:'fc00::1' rump.ifconfig shmif0 inet6
+	atf_check -s exit:0 -o not-match:'fc00::2' rump.ifconfig shmif0 inet6
+
+	atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.0.1/24
+
+	# arp
+	atf_check -s exit:0 rump.ifconfig shmif0 -arp
+	atf_check -s not-exit:0 -o ignore -e ignore \
+	    rump.ping -c 1 -n 192.168.0.3
+	atf_check -s exit:0 -o not-match:'192.168.0.3' rump.arp -an
+
+	# netmask
+	atf_check -s exit:0 rump.ifconfig shmif0 inet 172.16.0.1 netmask 255.255.255.0 alias
+	atf_check -s exit:0 -o match:'172.16.0/24' rump.netstat -rn -f inet
+	atf_check -s exit:0 rump.ifconfig shmif0 inet 172.16.0.1 delete
+
+	# broadcast (does it not work?)
+	atf_check -s exit:0 rump.ifconfig shmif0 inet 172.16.0.1 \
+	    broadcast 255.255.255.255 alias
+	atf_check -s exit:0 -o match:'broadcast 255.255.255.255' \
+	    rump.ifconfig shmif0 inet
+
+	# metric (external only)
+	atf_check -s exit:0 rump.ifconfig shmif0 metric 10
+	atf_check -s exit:0 rump.ifconfig shmif0 metric 0
+
+	# prefixlen
+	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1 prefixlen 70
+	atf_check -s exit:0 -o match:'fc00::/70' rump.netstat -rn -f inet6
+
+	# anycast
+	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2 anycast
+	atf_check -s exit:0 -o match:'fc00::2.+anycast' rump.ifconfig shmif0 inet6
+
+	# deprecated
+	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::3 deprecated
+	atf_check -s exit:0 -o match:'fc00::3.+deprecated' rump.ifconfig shmif0 inet6
+	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::3 -deprecated
+	atf_check -s exit:0 -o not-match:'fc00::3.+deprecated' rump.ifconfig shmif0 inet6
+
+	# pltime
+	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::3 pltime 3
+	atf_check -s exit:0 -o not-match:'fc00::3.+deprecated' rump.ifconfig shmif0 inet6
+	atf_check -s exit:0 sleep 5
+	atf_check -s exit:0 -o match:'fc00::3.+deprecated' rump.ifconfig shmif0 inet6
+
+	# eui64
+	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00:1::0 eui64
+	atf_check -s exit:0 -o match:'fc00:1::' rump.ifconfig shmif0 inet6
+
+	unset RUMP_SERVER
+}
+
+parameters_cleanup()
+{
+	env RUMP_SERVER=${RUMP_SERVER1} rump.halt
+	env RUMP_SERVER=${RUMP_SERVER2} rump.halt
+}
+
 atf_init_test_cases()
 {
 
 	atf_add_test_case create_destroy
 	atf_add_test_case options
+	atf_add_test_case parameters
 }

Reply via email to