Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add tests for RA
details: https://anonhg.NetBSD.org/src/rev/1cd92239af1b
branches: trunk
changeset: 341547:1cd92239af1b
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Wed Nov 11 07:52:57 2015 +0000
description:
Add tests for RA
>From s-yamaguchi@IIJ (with some tweaks by me)
diffstat:
distrib/sets/lists/tests/mi | 3 +-
tests/net/ndp/Makefile | 3 +-
tests/net/ndp/t_ra.sh | 140 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 144 insertions(+), 2 deletions(-)
diffs (177 lines):
diff -r 700df59c25b6 -r 1cd92239af1b distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Wed Nov 11 07:48:41 2015 +0000
+++ b/distrib/sets/lists/tests/mi Wed Nov 11 07:52:57 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.651 2015/11/05 00:02:59 knakahara Exp $
+# $NetBSD: mi,v 1.652 2015/11/11 07:52:57 ozaki-r Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -3186,6 +3186,7 @@
./usr/tests/net/ndp/Kyuafile tests-net-tests atf,rump,kyua
./usr/tests/net/ndp/t_dad tests-net-tests atf,rump
./usr/tests/net/ndp/t_ndp tests-net-tests atf,rump
+./usr/tests/net/ndp/t_ra tests-net-tests atf,rump
./usr/tests/net/net tests-net-tests compattestfile,atf
./usr/tests/net/net/Atffile tests-net-tests compattestfile,atf
./usr/tests/net/net/Kyuafile tests-net-tests compattestfile,atf,kyua
diff -r 700df59c25b6 -r 1cd92239af1b tests/net/ndp/Makefile
--- a/tests/net/ndp/Makefile Wed Nov 11 07:48:41 2015 +0000
+++ b/tests/net/ndp/Makefile Wed Nov 11 07:52:57 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2015/08/03 09:54:20 ozaki-r Exp $
+# $NetBSD: Makefile,v 1.2 2015/11/11 07:52:57 ozaki-r Exp $
#
.include <bsd.own.mk>
@@ -7,5 +7,6 @@
TESTS_SH= t_dad
TESTS_SH+= t_ndp
+TESTS_SH+= t_ra
.include <bsd.test.mk>
diff -r 700df59c25b6 -r 1cd92239af1b tests/net/ndp/t_ra.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/net/ndp/t_ra.sh Wed Nov 11 07:52:57 2015 +0000
@@ -0,0 +1,140 @@
+#! /usr/bin/env atf-sh
+RUMPFLAGS="-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6"
+RUMPFLAGS="${RUMPFLAGS} -lrumpnet_shmif"
+RUMPFLAGS="${RUMPFLAGS} -lrumpvfs -lrumpfs_ffs"
+
+RUMPSRV=unix://r1
+RUMPCLI=unix://r2
+IP6SRV=fc00:1::1
+IP6CLI=fc00:2::2
+PIDFILE=/var/run/rump.rtadvd.pid
+CONFIG=./rtadvd.conf
+DEBUG=true
+
+setup_shmif0()
+{
+ local IP6ADDR=${1}
+ shift
+
+ atf_check -s exit:0 rump.ifconfig shmif0 create
+ atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1
+ atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6ADDR}
+ atf_check -s exit:0 rump.ifconfig shmif0 up
+
+ $DEBUG && rump.ifconfig
+}
+
+wait_term()
+{
+ local PIDFILE=${1}
+ shift
+
+ while [ -f ${PIDFILE} ]
+ do
+ sleep 0.2
+ done
+
+ return 0
+}
+
+create_rtadvdconfig()
+{
+
+ cat << _EOF > ${CONFIG}
+shmif0:\
+ :mtu#1300:maxinterval#4:mininterval#3:
+_EOF
+}
+
+atf_test_case basic cleanup
+basic_head()
+{
+
+ atf_set "descr" "Tests for basic functions of router advaertisement(RA)"
+ atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig"
+}
+
+basic_body()
+{
+
+ atf_check -s exit:0 rump_server ${RUMPFLAGS} ${RUMPSRV}
+ atf_check -s exit:0 rump_server ${RUMPFLAGS} ${RUMPCLI}
+
+ export RUMP_SERVER=${RUMPSRV}
+ setup_shmif0 ${IP6SRV}
+ atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.forwarding=1
+ export LD_PRELOAD=/usr/lib/librumphijack.so
+ atf_check -s exit:0 mkdir -p /rump/var/chroot/rtadvd
+ unset LD_PRELOAD
+ unset RUMP_SERVER
+
+ export RUMP_SERVER=${RUMPCLI}
+ setup_shmif0 ${IP6CLI}
+ $DEBUG && rump.ndp -n -a
+ atf_check -s exit:0 -o match:'= 0' rump.sysctl net.inet6.ip6.accept_rtadv
+ unset RUMP_SERVER
+
+ create_rtadvdconfig
+
+ export RUMP_SERVER=${RUMPSRV}
+ atf_check -s exit:0 rump.rtadvd -c ${CONFIG} shmif0
+ atf_check -s exit:0 sleep 3
+ atf_check -s exit:0 -o ignore -e empty cat ${PIDFILE}
+ unset RUMP_SERVER
+
+ export RUMP_SERVER=${RUMPCLI}
+ atf_check -s exit:0 -o empty rump.ndp -r
+ atf_check -s exit:0 -o not-match:'advertised' rump.ndp -p
+ atf_check -s exit:0 -o match:'linkmtu=0' rump.ndp -n -i shmif0
+ atf_check -s exit:0 -o not-match:'S R' rump.ndp -n -a
+ atf_check -s exit:0 -o not-match:'fc00:1:' rump.ndp -n -a
+ atf_check -s exit:0 -o not-match:'fc00:1:' rump.ifconfig shmif0 inet6
+ unset RUMP_SERVER
+
+ atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
+ wait_term ${PIDFILE}
+
+ export RUMP_SERVER=${RUMPCLI}
+ atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1
+ unset RUMP_SERVER
+
+ export RUMP_SERVER=${RUMPSRV}
+ atf_check -s exit:0 rump.rtadvd -c ${CONFIG} shmif0
+ atf_check -s exit:0 sleep 3
+ atf_check -s exit:0 -o ignore -e empty cat ${PIDFILE}
+ unset RUMP_SERVER
+
+ export RUMP_SERVER=${RUMPCLI}
+ $DEBUG && rump.ndp -n -a
+ $DEBUG && rump.ndp -r
+ atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r
+ atf_check -s exit:0 -o match:'advertised' rump.ndp -p
+ atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0
+ atf_check -s exit:0 -o match:'23h59m..s S R' rump.ndp -n -a
+ atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a
+ atf_check -s exit:0 -o match:'fc00:1:' rump.ifconfig shmif0 inet6
+ unset RUMP_SERVER
+
+ atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
+ wait_term ${PIDFILE}
+
+ return 0
+}
+
+basic_cleanup()
+{
+
+ if [ -f ${PIDFILE} ]; then
+ kill -TERM `cat ${PIDFILE}`
+ wait_term ${PIDFILE}
+ fi
+
+ env RUMP_SERVER=${RUMPSRV} rump.halt
+ env RUMP_SERVER=${RUMPCLI} rump.halt
+}
+
+atf_init_test_cases()
+{
+
+ atf_add_test_case basic
+}
Home |
Main Index |
Thread Index |
Old Index