Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/net/if Add tests for ifconfig parameters



details:   https://anonhg.NetBSD.org/src/rev/7e08466a1a3d
branches:  trunk
changeset: 811551:7e08466a1a3d
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Thu Nov 05 02:57:36 2015 +0000

description:
Add tests for ifconfig parameters

>From s-yamaguchi@IIJ

diffstat:

 tests/net/if/t_ifconfig.sh |  121 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 120 insertions(+), 1 deletions(-)

diffs (145 lines):

diff -r 55c4ac0138b1 -r 7e08466a1a3d tests/net/if/t_ifconfig.sh
--- a/tests/net/if/t_ifconfig.sh        Thu Nov 05 00:12:28 2015 +0000
+++ b/tests/net/if/t_ifconfig.sh        Thu Nov 05 02:57:36 2015 +0000
@@ -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 @@
        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
 }



Home | Main Index | Thread Index | Old Index