Skip to content

Commit e8c867c

Browse files
committed
Merge branch 'selftests-forwarding-Two-small-changes'
Petr Machata says: ==================== selftests: forwarding: Two small changes 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. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 193025e + 3ed9703 commit e8c867c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

tools/testing/selftests/net/forwarding/mirror_lib.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@ mirror_test()
2929
local pref=$1; shift
3030
local expect=$1; shift
3131

32-
local ping_timeout=$((PING_TIMEOUT * 5))
3332
local t0=$(tc_rule_stats_get $dev $pref)
34-
ip vrf exec $vrf_name \
35-
${PING} ${sip:+-I $sip} $dip -c 10 -i 0.5 -w $ping_timeout \
36-
&> /dev/null
33+
$MZ $vrf_name ${sip:+-A $sip} -B $dip -a own -b bc -q \
34+
-c 10 -d 100ms -t icmp type=8
3735
sleep 0.5
3836
local t1=$(tc_rule_stats_get $dev $pref)
3937
local delta=$((t1 - t0))

tools/testing/selftests/net/forwarding/pedit_dsfield.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,12 @@ do_test_pedit_dsfield_common()
132132
local pkts
133133
pkts=$(busywait "$TC_HIT_TIMEOUT" until_counter_is ">= 10" \
134134
tc_rule_handle_stats_get "dev $h2 ingress" 101)
135-
check_err $? "Expected to get 10 packets, but got $pkts."
135+
check_err $? "Expected to get 10 packets on test probe, but got $pkts."
136+
137+
pkts=$(tc_rule_handle_stats_get "$pedit_locus" 101)
138+
((pkts >= 10))
139+
check_err $? "Expected to get 10 packets on pedit rule, but got $pkts."
140+
136141
log_test "$pedit_locus pedit $pedit_action"
137142
}
138143

0 commit comments

Comments
 (0)