All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] selftests: forwarding: Two small changes
@ 2020-05-29 11:16 Petr Machata
  2020-05-29 11:16 ` [PATCH net-next 1/2] selftests: forwarding: mirror_lib: Use mausezahn Petr Machata
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Petr Machata @ 2020-05-29 11:16 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Jakub Kicinski, Petr Machata

Two unrelated changes in this patchset:

- In patch #1, convert mirror tests from using ping directly to generating
  ICMP packets by mausezahn. Using ping in tests is error-prone, because
  ping is too smart. On a flaky system (notably in a simulator), when
  packets don't come quickly enough, more pings are sent, and that throws
  off counters. This was worked around in the past by just pinging more
  slowly, but using mausezahn avoids the issue as well without making the
  tests unnecessary slow.

- A missing stats_update callback was recently added to act_pedit. Now that
  iproute2 supports JSON dumping for pedit, extend in patch #2 the
  pedit_dsfield selftest with a check that would have caught the fact that
  the callback was missing.

Petr Machata (2):
  selftests: forwarding: mirror_lib: Use mausezahn
  selftests: forwarding: pedit_dsfield: Check counter value

 tools/testing/selftests/net/forwarding/mirror_lib.sh    | 6 ++----
 tools/testing/selftests/net/forwarding/pedit_dsfield.sh | 7 ++++++-
 2 files changed, 8 insertions(+), 5 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/2] selftests: forwarding: mirror_lib: Use mausezahn
  2020-05-29 11:16 [PATCH net-next 0/2] selftests: forwarding: Two small changes Petr Machata
@ 2020-05-29 11:16 ` Petr Machata
  2020-05-29 11:16 ` [PATCH net-next 2/2] selftests: forwarding: pedit_dsfield: Check counter value Petr Machata
  2020-05-31  4:49 ` [PATCH net-next 0/2] selftests: forwarding: Two small changes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Petr Machata @ 2020-05-29 11:16 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Jakub Kicinski, Petr Machata, Ido Schimmel

Using ping in tests is error-prone, because ping is too smart. On a
flaky system (notably in a simulator), when packets don't come quickly
enough, more pings are sent, and that throws off counters. Instead use
mausezahn to generate ICMP echo request packets. That allows us to
send them in quicker succession as well, because the reason the ping
was made slow in the first place was to make the tests work on
simulated systems.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
---
 tools/testing/selftests/net/forwarding/mirror_lib.sh | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/net/forwarding/mirror_lib.sh b/tools/testing/selftests/net/forwarding/mirror_lib.sh
index 00797597fcf5..c33bfd7ba214 100644
--- a/tools/testing/selftests/net/forwarding/mirror_lib.sh
+++ b/tools/testing/selftests/net/forwarding/mirror_lib.sh
@@ -29,11 +29,9 @@ mirror_test()
 	local pref=$1; shift
 	local expect=$1; shift
 
-	local ping_timeout=$((PING_TIMEOUT * 5))
 	local t0=$(tc_rule_stats_get $dev $pref)
-	ip vrf exec $vrf_name \
-	   ${PING} ${sip:+-I $sip} $dip -c 10 -i 0.5 -w $ping_timeout \
-		   &> /dev/null
+	$MZ $vrf_name ${sip:+-A $sip} -B $dip -a own -b bc -q \
+	    -c 10 -d 100ms -t icmp type=8
 	sleep 0.5
 	local t1=$(tc_rule_stats_get $dev $pref)
 	local delta=$((t1 - t0))
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/2] selftests: forwarding: pedit_dsfield: Check counter value
  2020-05-29 11:16 [PATCH net-next 0/2] selftests: forwarding: Two small changes Petr Machata
  2020-05-29 11:16 ` [PATCH net-next 1/2] selftests: forwarding: mirror_lib: Use mausezahn Petr Machata
@ 2020-05-29 11:16 ` Petr Machata
  2020-05-31  4:49 ` [PATCH net-next 0/2] selftests: forwarding: Two small changes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Petr Machata @ 2020-05-29 11:16 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Jakub Kicinski, Petr Machata

A missing stats_update callback was recently added to act_pedit. Now that
iproute2 supports JSON dumping for pedit, extend the pedit_dsfield selftest
with a check that would have caught the fact that the callback was missing.

Signed-off-by: Petr Machata <petrm@mellanox.com>
---
 tools/testing/selftests/net/forwarding/pedit_dsfield.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/forwarding/pedit_dsfield.sh b/tools/testing/selftests/net/forwarding/pedit_dsfield.sh
index 1181d647f6a7..55eeacf59241 100755
--- a/tools/testing/selftests/net/forwarding/pedit_dsfield.sh
+++ b/tools/testing/selftests/net/forwarding/pedit_dsfield.sh
@@ -132,7 +132,12 @@ do_test_pedit_dsfield_common()
 	local pkts
 	pkts=$(busywait "$TC_HIT_TIMEOUT" until_counter_is ">= 10" \
 			tc_rule_handle_stats_get "dev $h2 ingress" 101)
-	check_err $? "Expected to get 10 packets, but got $pkts."
+	check_err $? "Expected to get 10 packets on test probe, but got $pkts."
+
+	pkts=$(tc_rule_handle_stats_get "$pedit_locus" 101)
+	((pkts >= 10))
+	check_err $? "Expected to get 10 packets on pedit rule, but got $pkts."
+
 	log_test "$pedit_locus pedit $pedit_action"
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 0/2] selftests: forwarding: Two small changes
  2020-05-29 11:16 [PATCH net-next 0/2] selftests: forwarding: Two small changes Petr Machata
  2020-05-29 11:16 ` [PATCH net-next 1/2] selftests: forwarding: mirror_lib: Use mausezahn Petr Machata
  2020-05-29 11:16 ` [PATCH net-next 2/2] selftests: forwarding: pedit_dsfield: Check counter value Petr Machata
@ 2020-05-31  4:49 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-05-31  4:49 UTC (permalink / raw)
  To: petrm; +Cc: netdev, kuba

From: Petr Machata <petrm@mellanox.com>
Date: Fri, 29 May 2020 14:16:52 +0300

> Two unrelated changes in this patchset:
> 
> - In patch #1, convert mirror tests from using ping directly to generating
>   ICMP packets by mausezahn. Using ping in tests is error-prone, because
>   ping is too smart. On a flaky system (notably in a simulator), when
>   packets don't come quickly enough, more pings are sent, and that throws
>   off counters. This was worked around in the past by just pinging more
>   slowly, but using mausezahn avoids the issue as well without making the
>   tests unnecessary slow.
> 
> - A missing stats_update callback was recently added to act_pedit. Now that
>   iproute2 supports JSON dumping for pedit, extend in patch #2 the
>   pedit_dsfield selftest with a check that would have caught the fact that
>   the callback was missing.

Series applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-31  4:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29 11:16 [PATCH net-next 0/2] selftests: forwarding: Two small changes Petr Machata
2020-05-29 11:16 ` [PATCH net-next 1/2] selftests: forwarding: mirror_lib: Use mausezahn Petr Machata
2020-05-29 11:16 ` [PATCH net-next 2/2] selftests: forwarding: pedit_dsfield: Check counter value Petr Machata
2020-05-31  4:49 ` [PATCH net-next 0/2] selftests: forwarding: Two small changes David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.