From b39322d52d2dd66d37af0ffcbfb48d13896804ea Mon Sep 17 00:00:00 2001 From: ngie Date: Fri, 10 Feb 2017 07:13:16 +0000 Subject: MFC r311925,r311968,r311969,r312008: r311925: Import testcase updates with code contributed back to NetBSD This also (inadvertently) contains an update to contrib/netbsd-tests/lib/libc/sys/t_wait.c (new testcases). In collaboration with: christos@NetBSD.org r311968: Fix lib/libc/sys/access_test after r311925 sys/param.h needs to be #included in order for __FreeBSD_version to be checked r311969: Remove __HAVE_LONG_DOUBLE #define from t_strtod.c and place it in Makefile This is to enable support in other testcases Inspired by lib/msun/tests/Makefile . r312008: Upgrade NetBSD tests to 01.11.2017_23.20 snapshot This contains some new testcases in /usr/tests/...: - .../lib/libc - .../lib/libthr - .../lib/msun - .../sys/kern Tested on: amd64, i386 --- contrib/netbsd-tests/net/ndp/t_ndp.sh | 100 +++++++++------------------------- 1 file changed, 26 insertions(+), 74 deletions(-) (limited to 'contrib/netbsd-tests/net/ndp/t_ndp.sh') diff --git a/contrib/netbsd-tests/net/ndp/t_ndp.sh b/contrib/netbsd-tests/net/ndp/t_ndp.sh index 4491981..aa96390 100755 --- a/contrib/netbsd-tests/net/ndp/t_ndp.sh +++ b/contrib/netbsd-tests/net/ndp/t_ndp.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_ndp.sh,v 1.13 2016/08/10 23:07:57 kre Exp $ +# $NetBSD: t_ndp.sh,v 1.17 2016/11/25 08:51:17 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,17 +25,12 @@ # POSSIBILITY OF SUCH DAMAGE. # -inetserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet" -inetserver="$inetserver -lrumpnet_netinet6 -lrumpnet_shmif" -inetserver="$inetserver -lrumpdev" -HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes" - SOCKSRC=unix://commsock1 SOCKDST=unix://commsock2 IP6SRC=fc00::1 IP6DST=fc00::2 -DEBUG=true +DEBUG=${DEBUG:-true} TIMEOUT=1 atf_test_case ndp_cache_expiration cleanup @@ -78,9 +73,8 @@ setup_dst_server() { local assign_ip=$1 + rump_server_add_iface $SOCKDST shmif0 bus1 export RUMP_SERVER=$SOCKDST - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 if [ "$assign_ip" != no ]; then atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6DST fi @@ -97,8 +91,7 @@ setup_src_server() export RUMP_SERVER=$SOCKSRC # Setup an interface - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + rump_server_add_iface $SOCKSRC shmif0 bus1 atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6SRC atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig -w 10 @@ -119,8 +112,9 @@ get_timeout() ndp_cache_expiration_body() { - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKDST netinet6 setup_dst_server setup_src_server @@ -144,6 +138,8 @@ ndp_cache_expiration_body() atf_check -s exit:0 -o match:'permanent' rump.ndp -n $IP6SRC # Expired but remains until GC sweaps it (1 day) atf_check -s exit:0 -o match:'(1d0h0m|23h59m)' rump.ndp -n $IP6DST + + rump_server_destroy_ifaces } ifdown_dst_server() @@ -155,8 +151,9 @@ ifdown_dst_server() ndp_commands_body() { - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKDST netinet6 setup_dst_server setup_src_server @@ -217,13 +214,14 @@ ndp_commands_body() $DEBUG && rump.ndp -n -a atf_check -s exit:0 -o not-match:'permanent' rump.ndp -n fc00::10 - return 0 + rump_server_destroy_ifaces } ndp_cache_overwriting_body() { - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKDST netinet6 setup_dst_server setup_src_server @@ -249,7 +247,7 @@ ndp_cache_overwriting_body() #atf_check -s not-exit:0 -e ignore rump.ndp -s fc00::10 b2:a0:20:00:00:ff #$DEBUG && rump.ndp -n -a - return 0 + rump_server_destroy_ifaces } get_n_caches() @@ -261,8 +259,8 @@ get_n_caches() ndp_neighborgcthresh_body() { - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKDST netinet6 setup_dst_server no setup_src_server @@ -311,7 +309,7 @@ ndp_neighborgcthresh_body() atf_fail "Neighbor caches are not GC-ed" fi - return 0 + rump_server_destroy_ifaces } make_pkt_str_na() @@ -324,33 +322,18 @@ make_pkt_str_na() echo $pkt } -extract_new_packets() -{ - local old=./old - - if [ ! -f $old ]; then - old=/dev/null - fi - - shmif_dumpbus -p - bus1 2>/dev/null| \ - tcpdump -n -e -r - 2>/dev/null > ./new - diff -u $old ./new |grep '^+' |cut -d '+' -f 2 > ./diff - mv -f ./new ./old - cat ./diff -} - ndp_link_activation_body() { local linklocal= - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKDST netinet6 setup_dst_server setup_src_server # flush old packets - extract_new_packets > ./out + extract_new_packets bus1 > ./out export RUMP_SERVER=$SOCKSRC @@ -358,7 +341,7 @@ ndp_link_activation_body() b2:a1:00:00:00:01 atf_check -s exit:0 sleep 1 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out linklocal=$(rump.ifconfig shmif0 |awk '/fe80/ {print $2;}' |awk -F % '{print $1;}') @@ -371,7 +354,7 @@ ndp_link_activation_body() b2:a1:00:00:00:02 active atf_check -s exit:0 sleep 1 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out linklocal=$(rump.ifconfig shmif0 |awk '/fe80/ {print $2;}' |awk -F % '{print $1;}') @@ -379,39 +362,8 @@ ndp_link_activation_body() pkt=$(make_pkt_str_na $linklocal b2:a1:00:00:00:02) atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'" -} -cleanup() -{ - env RUMP_SERVER=$SOCKSRC rump.halt - env RUMP_SERVER=$SOCKDST rump.halt -} - -dump_src() -{ - export RUMP_SERVER=$SOCKSRC - rump.netstat -nr - rump.ndp -n -a - rump.ifconfig - $HIJACKING dmesg -} - -dump_dst() -{ - export RUMP_SERVER=$SOCKDST - rump.netstat -nr - rump.ndp -n -a - rump.ifconfig - $HIJACKING dmesg -} - -dump() -{ - dump_src - dump_dst - shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - - $DEBUG && gdb -ex bt /usr/bin/rump_server rump_server.core - $DEBUG && gdb -ex bt /usr/sbin/rump.ndp rump.ndp.core + rump_server_destroy_ifaces } ndp_cache_expiration_cleanup() -- cgit v1.1