Module Name: src
Committed By: ozaki-r
Date: Fri Apr 6 09:21:57 UTC 2018
Modified Files:
src/tests/net/arp: t_arp.sh
Log Message:
Improve packet checks and error reporting
To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 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.34 src/tests/net/arp/t_arp.sh:1.35
--- src/tests/net/arp/t_arp.sh:1.34 Thu Nov 23 06:22:12 2017
+++ src/tests/net/arp/t_arp.sh Fri Apr 6 09:21:57 2018
@@ -1,4 +1,4 @@
-# $NetBSD: t_arp.sh,v 1.34 2017/11/23 06:22:12 kre Exp $
+# $NetBSD: t_arp.sh,v 1.35 2018/04/06 09:21:57 ozaki-r Exp $
#
# Copyright (c) 2015 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -292,7 +292,7 @@ make_pkt_str_arpreq()
{
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
}
@@ -313,25 +313,25 @@ arp_garp_body()
$DEBUG && rump.ifconfig shmif0
atf_check -s exit:0 sleep 1
- shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - > ./out
+ extract_new_packets bus1 > ./out
# A GARP packet is sent for the primary address
pkt=$(make_pkt_str_arpreq 10.0.0.1 10.0.0.1)
- atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'"
+ atf_check -s exit:0 -o match:"$pkt" cat ./out
# No GARP packet is sent for the alias address
pkt=$(make_pkt_str_arpreq 10.0.0.2 10.0.0.2)
- atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'"
+ atf_check -s exit:0 -o not-match:"$pkt" cat ./out
atf_check -s exit:0 rump.ifconfig -w 10
atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.3/24
atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.4/24 alias
# No GARP packets are sent during IFF_UP
- shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - > ./out
+ extract_new_packets bus1 > ./out
pkt=$(make_pkt_str_arpreq 10.0.0.3 10.0.0.3)
- atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'"
+ atf_check -s exit:0 -o not-match:"$pkt" cat ./out
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'"
+ atf_check -s exit:0 -o not-match:"$pkt" cat ./out
rump_server_destroy_ifaces
}
@@ -519,7 +519,7 @@ arp_link_activation_body()
$DEBUG && cat ./out
pkt=$(make_pkt_str_arpreq $IP4SRC $IP4SRC)
- atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'"
+ atf_check -s exit:0 -o not-match:"$pkt" cat ./out
atf_check -s exit:0 -o ignore rump.ifconfig shmif0 link \
b2:a1:00:00:00:02 active
@@ -529,8 +529,7 @@ arp_link_activation_body()
$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'"
+ atf_check -s exit:0 -o match:"b2:a1:00:00:00:02 $pkt" cat ./out
rump_server_destroy_ifaces
}