diff options
author | ngie <ngie@FreeBSD.org> | 2017-02-12 09:24:18 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2017-02-12 09:24:18 +0000 |
commit | 78e3a559e196fc51e69e57f5434cd3ca9bd767c7 (patch) | |
tree | fb4cbb88c546d7782a163e272dfc13fb5f0f726c /contrib/netbsd-tests/net/arp | |
parent | 3f18b64fed139907ee6e58712c75b95adb2173ee (diff) | |
download | FreeBSD-src-78e3a559e196fc51e69e57f5434cd3ca9bd767c7.zip FreeBSD-src-78e3a559e196fc51e69e57f5434cd3ca9bd767c7.tar.gz |
MFC 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
Diffstat (limited to 'contrib/netbsd-tests/net/arp')
-rwxr-xr-x | contrib/netbsd-tests/net/arp/t_arp.sh | 127 | ||||
-rwxr-xr-x | contrib/netbsd-tests/net/arp/t_dad.sh | 100 |
2 files changed, 69 insertions, 158 deletions
diff --git a/contrib/netbsd-tests/net/arp/t_arp.sh b/contrib/netbsd-tests/net/arp/t_arp.sh index ab55eb3..04e2f70 100755 --- a/contrib/netbsd-tests/net/arp/t_arp.sh +++ b/contrib/netbsd-tests/net/arp/t_arp.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_arp.sh,v 1.16 2016/06/21 05:04:16 ozaki-r Exp $ +# $NetBSD: t_arp.sh,v 1.22 2016/11/25 08:51:16 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,10 +25,6 @@ # POSSIBILITY OF SUCH DAMAGE. # -inetserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif" -inetserver="$inetserver -lrumpdev -lrumpnet_tap" -HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes" - SOCKSRC=unix://commsock1 SOCKDST=unix://commsock2 IP4SRC=10.0.1.1 @@ -36,7 +32,7 @@ IP4DST=10.0.1.2 IP4DST_PROXYARP1=10.0.1.3 IP4DST_PROXYARP2=10.0.1.4 -DEBUG=false +DEBUG=${DEBUG:-false} TIMEOUT=1 atf_test_case arp_cache_expiration_5s cleanup @@ -106,9 +102,9 @@ arp_static_head() setup_dst_server() { + + 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 atf_check -s exit:0 rump.ifconfig shmif0 inet $IP4DST/24 atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig -w 10 @@ -127,8 +123,7 @@ setup_src_server() atf_check -s exit:0 -o ignore rump.sysctl -w net.inet.arp.keep=$keep # 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 inet $IP4SRC/24 atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig -w 10 @@ -145,8 +140,8 @@ test_cache_expiration() local arp_keep=$1 local bonus=2 - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKDST setup_dst_server setup_src_server $arp_keep @@ -172,12 +167,16 @@ test_cache_expiration() arp_cache_expiration_5s_body() { + test_cache_expiration 5 + rump_server_destroy_ifaces } arp_cache_expiration_10s_body() { + test_cache_expiration 10 + rump_server_destroy_ifaces } arp_command_body() @@ -185,8 +184,8 @@ arp_command_body() local arp_keep=5 local bonus=2 - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKDST setup_dst_server setup_src_server $arp_keep @@ -257,7 +256,7 @@ arp_command_body() $DEBUG && rump.arp -n -a #atf_check -s not-exit:0 -e ignore rump.arp -n 10.0.1.10 - return 0 + rump_server_destroy_ifaces } make_pkt_str_arpreq() @@ -273,12 +272,12 @@ arp_garp_body() { local pkt= - atf_check -s exit:0 ${inetserver} $SOCKSRC + rump_server_start $SOCKSRC + 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 inet 10.0.0.1/24 atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.2/24 alias atf_check -s exit:0 rump.ifconfig shmif0 up @@ -304,6 +303,8 @@ arp_garp_body() atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'" pkt=$(make_pkt_str_arpreq 10.0.0.4 10.0.0.4) atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'" + + rump_server_destroy_ifaces } arp_cache_overwriting_body() @@ -311,8 +312,8 @@ arp_cache_overwriting_body() local arp_keep=5 local bonus=2 - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKDST setup_dst_server setup_src_server $arp_keep @@ -341,7 +342,7 @@ arp_cache_overwriting_body() atf_check -s exit:0 -o match:'b2:a0:20:00:00:ff' rump.arp -n 10.0.1.10 $DEBUG && rump.arp -n -a - return 0 + rump_server_destroy_ifaces } make_pkt_str_arprep() @@ -363,36 +364,21 @@ make_pkt_str_garp() 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 -} - test_proxy_arp() { local arp_keep=5 local opts= title= flags= local type=$1 - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKDST tap setup_dst_server setup_src_server $arp_keep export RUMP_SERVER=$SOCKDST atf_check -s exit:0 -o ignore rump.sysctl -w net.inet.ip.forwarding=1 - macaddr_dst=$(rump.ifconfig shmif0 |awk '/address/ {print $2;}') + macaddr_dst=$(get_macaddr $SOCKDST shmif0) if [ "$type" = "pub" ]; then opts="pub" @@ -416,7 +402,7 @@ test_proxy_arp() rump.ping -n -w 1 -c 1 $IP4DST_PROXYARP1 # Flushing - extract_new_packets > ./out + extract_new_packets bus1 > ./out # Set up proxy ARP entry export RUMP_SERVER=$SOCKDST @@ -435,7 +421,7 @@ test_proxy_arp() rump.ping -n -w 1 -c 1 $IP4DST_PROXYARP1 fi - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out pkt1=$(make_pkt_str_arprep $IP4DST_PROXYARP1 $macaddr_dst) @@ -461,7 +447,7 @@ test_proxy_arp() atf_check -s not-exit:0 -o ignore -e ignore \ rump.ping -n -w 1 -c 1 $IP4DST_PROXYARP2 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out # ARP reply should be sent @@ -482,12 +468,14 @@ arp_proxy_arp_pub_body() { test_proxy_arp pub + rump_server_destroy_ifaces } arp_proxy_arp_pubproxy_body() { test_proxy_arp pubproxy + rump_server_destroy_ifaces } arp_link_activation_body() @@ -495,14 +483,14 @@ arp_link_activation_body() local arp_keep=5 local bonus=2 - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKDST setup_dst_server setup_src_server $arp_keep # flush old packets - extract_new_packets > ./out + extract_new_packets bus1 > ./out export RUMP_SERVER=$SOCKSRC @@ -510,7 +498,7 @@ arp_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 pkt=$(make_pkt_str_arpreq $IP4SRC $IP4SRC) @@ -520,12 +508,14 @@ arp_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 pkt=$(make_pkt_str_arpreq $IP4SRC $IP4SRC) atf_check -s exit:0 -x \ "cat ./out |grep '$pkt' |grep -q 'b2:a1:00:00:00:02'" + + rump_server_destroy_ifaces } arp_static_body() @@ -533,14 +523,13 @@ arp_static_body() local arp_keep=5 local macaddr_src= - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKDST setup_dst_server setup_src_server $arp_keep - export RUMP_SERVER=$SOCKSRC - macaddr_src=$(rump.ifconfig shmif0 |awk '/address/ {print $2;}') + macaddr_src=$(get_macaddr $SOCKSRC shmif0) # Set a (valid) static ARP entry for the src server export RUMP_SERVER=$SOCKDST @@ -551,37 +540,8 @@ arp_static_body() # Test receiving an ARP request with the static ARP entry (as spa/sha) export RUMP_SERVER=$SOCKSRC atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP4DST -} -cleanup() -{ - env RUMP_SERVER=$SOCKSRC rump.halt - env RUMP_SERVER=$SOCKDST rump.halt -} - -dump_src() -{ - export RUMP_SERVER=$SOCKSRC - rump.netstat -nr - rump.arp -n -a - rump.ifconfig - $HIJACKING dmesg -} - -dump_dst() -{ - export RUMP_SERVER=$SOCKDST - rump.netstat -nr - rump.arp -n -a - rump.ifconfig - $HIJACKING dmesg -} - -dump() -{ - dump_src - dump_dst - shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - + rump_server_destroy_ifaces } arp_cache_expiration_5s_cleanup() @@ -604,9 +564,8 @@ arp_command_cleanup() arp_garp_cleanup() { - $DEBUG && dump_src - $DEBUG && shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - - env RUMP_SERVER=$SOCKSRC rump.halt + $DEBUG && dump + cleanup } arp_cache_overwriting_cleanup() diff --git a/contrib/netbsd-tests/net/arp/t_dad.sh b/contrib/netbsd-tests/net/arp/t_dad.sh index aefcb0b..57a7d4b0 100755 --- a/contrib/netbsd-tests/net/arp/t_dad.sh +++ b/contrib/netbsd-tests/net/arp/t_dad.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_dad.sh,v 1.7 2016/08/10 22:05:07 kre Exp $ +# $NetBSD: t_dad.sh,v 1.13 2016/11/25 08:51:16 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,14 +25,10 @@ # POSSIBILITY OF SUCH DAMAGE. # -inetserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif" -inetserver="${inetserver} -lrumpdev" -HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes" - SOCKLOCAL=unix://commsock1 SOCKPEER=unix://commsock2 -DEBUG=false +DEBUG=${DEBUG:-false} atf_test_case dad_basic cleanup atf_test_case dad_duplicated cleanup @@ -54,10 +50,9 @@ setup_server() local sock=$1 local ip=$2 - export RUMP_SERVER=$sock + rump_server_add_iface $sock shmif0 bus1 - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + export RUMP_SERVER=$sock atf_check -s exit:0 rump.ifconfig shmif0 inet $ip/24 atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig -w 10 @@ -74,30 +69,15 @@ make_pkt_str() 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 -} - dad_basic_body() { local pkt= - atf_check -s exit:0 ${inetserver} $SOCKLOCAL + rump_server_start $SOCKLOCAL + rump_server_add_iface $SOCKLOCAL shmif0 bus1 + export RUMP_SERVER=$SOCKLOCAL - 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 inet 10.0.0.1/24 atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.2/24 alias $DEBUG && rump.ifconfig shmif0 @@ -107,13 +87,13 @@ dad_basic_body() $DEBUG && cat ./out # The primary address doesn't start with tentative state - atf_check -s not-exit:0 -x "cat ./out |grep 10.0.0.1 |grep -q tentative" + atf_check -s not-exit:0 -x "cat ./out |grep 10.0.0.1 |grep -iq tentative" # The alias address starts with tentative state # XXX we have no stable way to check this, so skip for now - #atf_check -s exit:0 -x "cat ./out |grep 10.0.0.2 |grep -q tentative" + #atf_check -s exit:0 -x "cat ./out |grep 10.0.0.2 |grep -iq tentative" atf_check -s exit:0 sleep 2 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out # Check DAD probe packets @@ -127,14 +107,14 @@ dad_basic_body() atf_check -s exit:0 rump.ifconfig -w 10 # Give a chance to send a DAD announce packet atf_check -s exit:0 sleep 1 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out # Check the DAD announce packet pkt=$(make_pkt_str 10.0.0.2 10.0.0.2) atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'" # The alias address left tentative - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.2 |grep -q tentative" + atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.2 |grep -iq tentative" # # Add a new address on the fly @@ -143,11 +123,11 @@ dad_basic_body() # The new address starts with tentative state # XXX we have no stable way to check this, so skip for now - #atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.3 |grep -q tentative" + #atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.3 |grep -iq tentative" # Check DAD probe packets atf_check -s exit:0 sleep 2 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out pkt=$(make_pkt_str 10.0.0.3 0.0.0.0) atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'" @@ -156,14 +136,16 @@ dad_basic_body() atf_check -s exit:0 rump.ifconfig -w 10 # Give a chance to send a DAD announce packet atf_check -s exit:0 sleep 1 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out # Check the DAD announce packet pkt=$(make_pkt_str 10.0.0.3 10.0.0.3) atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'" # The new address left tentative - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.3 |grep -q tentative" + atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.3 |grep -iq tentative" + + rump_server_destroy_ifaces } dad_duplicated_body() @@ -172,8 +154,8 @@ dad_duplicated_body() local localip2=10.0.1.11 local peerip=10.0.1.2 - atf_check -s exit:0 ${inetserver} $SOCKLOCAL - atf_check -s exit:0 ${inetserver} $SOCKPEER + rump_server_start $SOCKLOCAL + rump_server_start $SOCKPEER setup_server $SOCKLOCAL $localip1 setup_server $SOCKPEER $peerip @@ -181,7 +163,7 @@ dad_duplicated_body() export RUMP_SERVER=$SOCKLOCAL # The primary address isn't marked as duplicated - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip1 |grep -q duplicated" + atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip1 |grep -iq duplicated" # # Add a new address duplicated with the peer server @@ -190,50 +172,20 @@ dad_duplicated_body() atf_check -s exit:0 sleep 1 # The new address is marked as duplicated - atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep $peerip |grep -q duplicated" + atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep $peerip |grep -iq duplicated" # A unique address isn't marked as duplicated atf_check -s exit:0 rump.ifconfig shmif0 inet $localip2 alias atf_check -s exit:0 sleep 1 - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip2 |grep -q duplicated" -} - -cleanup() -{ - env RUMP_SERVER=$SOCKLOCAL rump.halt - env RUMP_SERVER=$SOCKPEER rump.halt -} - -dump_local() -{ - export RUMP_SERVER=$SOCKLOCAL - rump.netstat -nr - rump.arp -n -a - rump.ifconfig - $HIJACKING dmesg -} + atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip2 |grep -iq duplicated" -dump_peer() -{ - export RUMP_SERVER=$SOCKPEER - rump.netstat -nr - rump.arp -n -a - rump.ifconfig - $HIJACKING dmesg -} - -dump() -{ - dump_local - dump_peer - shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - + rump_server_destroy_ifaces } dad_basic_cleanup() { - $DEBUG && dump_local - $DEBUG && shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - - env RUMP_SERVER=$SOCKLOCAL rump.halt + $DEBUG && dump + cleanup } dad_duplicated_cleanup() |