Module Name: src Committed By: ozaki-r Date: Wed Mar 8 05:30:56 UTC 2017
Modified Files: src/tests/net/arp: t_dad.sh Log Message: Improve test stability and output messages on failure To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/net/arp/t_dad.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/arp/t_dad.sh diff -u src/tests/net/arp/t_dad.sh:1.13 src/tests/net/arp/t_dad.sh:1.14 --- src/tests/net/arp/t_dad.sh:1.13 Fri Nov 25 08:51:16 2016 +++ src/tests/net/arp/t_dad.sh Wed Mar 8 05:30:56 2017 @@ -1,4 +1,4 @@ -# $NetBSD: t_dad.sh,v 1.13 2016/11/25 08:51:16 ozaki-r Exp $ +# $NetBSD: t_dad.sh,v 1.14 2017/03/08 05:30:56 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -64,7 +64,7 @@ make_pkt_str() { local target=$1 local sender=$2 - pkt="> ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42:" + pkt="> ff:ff:ff:ff:ff:ff, ethertype ARP \(0x0806\), length 42:" pkt="$pkt Request who-has $target tell $sender, length 28" echo $pkt } @@ -78,6 +78,10 @@ dad_basic_body() export RUMP_SERVER=$SOCKLOCAL + # Increase the number of trials, which makes the tests stable + atf_check -s exit:0 -o match:'3 -> 5' \ + rump.sysctl -w net.inet.ip.dad_count=5 + 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 @@ -87,10 +91,9 @@ 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 -iq tentative" + atf_check -s exit:0 -o not-match:'10\.0\.0\.1.+TENTATIVE' cat ./out # 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 -iq tentative" + atf_check -s exit:0 -o match:'10\.0\.0\.2.+TENTATIVE' cat ./out atf_check -s exit:0 sleep 2 extract_new_packets bus1 > ./out @@ -98,23 +101,24 @@ dad_basic_body() # Check DAD probe packets pkt=$(make_pkt_str 10.0.0.2 0.0.0.0) - atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'" + atf_check -s exit:0 -o match:"$pkt" cat ./out # No DAD for the primary address pkt=$(make_pkt_str 10.0.0.1 0.0.0.0) - atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'" + atf_check -s exit:0 -o not-match:"$pkt" cat ./out # Waiting for DAD complete 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 + atf_check -s exit:0 sleep 2 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'" + atf_check -s exit:0 -o match:"$pkt" cat ./out # The alias address left tentative - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.2 |grep -iq tentative" + atf_check -s exit:0 -o not-match:'10\.0\.0\.2.+TENTATIVE' \ + rump.ifconfig shmif0 # # Add a new address on the fly @@ -122,28 +126,29 @@ dad_basic_body() atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.3/24 alias # 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 -iq tentative" + atf_check -s exit:0 -o match:'10\.0\.0\.3.+TENTATIVE' \ + rump.ifconfig shmif0 # Check DAD probe packets atf_check -s exit:0 sleep 2 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'" + atf_check -s exit:0 -o match:"$pkt" cat ./out # Waiting for DAD complete 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 + atf_check -s exit:0 sleep 2 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'" + atf_check -s exit:0 -o match:"$pkt" cat ./out # The new address left tentative - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.3 |grep -iq tentative" + atf_check -s exit:0 -o not-match:'10\.0\.0\.3.+TENTATIVE' \ + rump.ifconfig shmif0 rump_server_destroy_ifaces }