diff mbox series

[net-next,05/11] selftests: forwarding: mirror_lib: Wait for tardy mirrored packets

Message ID 69fcd31bafd1d09cfd8031b9639e1881194a6bd9.1548973731.git.petrm@mellanox.com
State Accepted
Delegated to: David Miller
Headers show
Series selftests: Various fixes | expand

Commit Message

Petr Machata Jan. 31, 2019, 10:35 p.m. UTC
When running in an environment with poor performance (such as a
simulator), processing mirrored packets can take a while. Evaluating the
condition too soon leads to spurious "seen 9, expected 10" failures as
the last packet doesn't have enough time to get mirrored and the mirror
to arrive and bump the observed counters.

Wait for one ping interval before evaluating the test.

Signed-off-by: Petr Machata <petrm@mellanox.com>
---
 tools/testing/selftests/net/forwarding/mirror_lib.sh | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/forwarding/mirror_lib.sh b/tools/testing/selftests/net/forwarding/mirror_lib.sh
index 878f8d53327a..00797597fcf5 100644
--- a/tools/testing/selftests/net/forwarding/mirror_lib.sh
+++ b/tools/testing/selftests/net/forwarding/mirror_lib.sh
@@ -34,6 +34,7 @@  mirror_test()
 	ip vrf exec $vrf_name \
 	   ${PING} ${sip:+-I $sip} $dip -c 10 -i 0.5 -w $ping_timeout \
 		   &> /dev/null
+	sleep 0.5
 	local t1=$(tc_rule_stats_get $dev $pref)
 	local delta=$((t1 - t0))
 	# Tolerate a couple stray extra packets.