Module Name: src Committed By: kre Date: Thu Nov 23 06:22:12 UTC 2017
Modified Files: src/tests/net/arp: t_arp.sh Log Message: Clean up the arp_rtm subtest... 1. Be assertive when claiming the pid of the background route monitor command, not polite... (ie: $! will give you the pid, $? is just 0 there). 2. Since "wait 0" simply (always) exits with status 127, immediately (we know without thinking that we have no child with pid 0) the waits were ineffective - now (after fix #1) they work .. which requires the route monitor that watches the arp -d to exit after 1 message, not 2, as 1 is all it gets. (If there really should be 2, someone needs to find out why the kernel is sending only 1 - I am not that someone). 3. The file contents need to be read only once, no matter how many patterns we need to look for, save some work, and do it that way (this is not really a bug,m but saving time for the ATF tests is always a good thing.) Not sure if this will stop it randomly failing on bablyon5, but it might. (The likely cause is that the "route.monitor" has not flushed its stdout buffers at the time the "grep -A 3" [aside: why that way to read the file??] is performed, so fails to find its expected output ... the route monitor would get an extra message once interfaces start being destroyed, I assume, and would exit then, flushing its buffer, but by then it is too late. If that is/was the cause, then it should be fixed now.) To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/tests/net/arp/t_arp.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_arp.sh diff -u src/tests/net/arp/t_arp.sh:1.33 src/tests/net/arp/t_arp.sh:1.34 --- src/tests/net/arp/t_arp.sh:1.33 Wed Jun 28 08:17:50 2017 +++ src/tests/net/arp/t_arp.sh Thu Nov 23 06:22:12 2017 @@ -1,4 +1,4 @@ -# $NetBSD: t_arp.sh,v 1.33 2017/06/28 08:17:50 ozaki-r Exp $ +# $NetBSD: t_arp.sh,v 1.34 2017/11/23 06:22:12 kre Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -626,7 +626,7 @@ arp_rtm_body() { local macaddr_src= macaddr_dst= local file=./tmp - local pid= str= + local pid= hdr= what= addr= rump_server_start $SOCKSRC rump_server_start $SOCKDST @@ -641,33 +641,31 @@ arp_rtm_body() # Test ping and a resulting routing message (RTM_ADD) rump.route -n monitor -c 1 > $file & - pid=$? + pid=$! sleep 1 atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP4DST wait $pid $DEBUG && cat $file - str="RTM_ADD.+<UP,HOST,DONE,LLINFO,CLONED>" - atf_check -s exit:0 -o match:"$str" cat $file - str="<DST,GATEWAY>" - atf_check -s exit:0 -o match:"$str" cat $file - str="$IP4DST link#2" - atf_check -s exit:0 -o match:"$str" cat $file + hdr="RTM_ADD.+<UP,HOST,DONE,LLINFO,CLONED>" + what="<DST,GATEWAY>" + addr="$IP4DST link#2" + atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \ + cat $file # Test arp -d and resulting routing messages (RTM_DELETE) - rump.route -n monitor -c 2 > $file & - pid=$? + rump.route -n monitor -c 1 > $file & + pid=$! sleep 1 atf_check -s exit:0 -o ignore rump.arp -d $IP4DST wait $pid $DEBUG && cat $file - str="RTM_DELETE.+<HOST,DONE,LLINFO,CLONED>" - atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file - str="<DST,GATEWAY>" - atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file - str="$IP4DST $macaddr_dst" - atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file + hdr="RTM_DELETE.+<HOST,DONE,LLINFO,CLONED>" + what="<DST,GATEWAY>" + addr="$IP4DST $macaddr_dst" + atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \ + grep -A 3 RTM_DELETE $file rump_server_destroy_ifaces }