Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/net/arp Improve packet checks and error reporting
details: https://anonhg.NetBSD.org/src/rev/1e9ed0bc20e1
branches: trunk
changeset: 360901:1e9ed0bc20e1
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Fri Apr 06 09:21:57 2018 +0000
description:
Improve packet checks and error reporting
diffstat:
tests/net/arp/t_arp.sh | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
diffs (69 lines):
diff -r 85260e10d9c3 -r 1e9ed0bc20e1 tests/net/arp/t_arp.sh
--- a/tests/net/arp/t_arp.sh Fri Apr 06 09:20:29 2018 +0000
+++ b/tests/net/arp/t_arp.sh Fri Apr 06 09:21:57 2018 +0000
@@ -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 @@
{
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 @@
$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 @@
$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 @@
$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
}
Home |
Main Index |
Thread Index |
Old Index