Skip to content

Commit 3f8a0b8

Browse files
author
Hangbin Liu
committed
selftests/net: packetdrill: report benign debug flakes as xfail
JIRA: https://issues.redhat.com/browse/RHEL-88651 Upstream Status: net.git commit 912d6f6 commit 912d6f6 Author: Willem de Bruijn <willemb@google.com> Date: Fri Jan 3 06:31:14 2025 -0500 selftests/net: packetdrill: report benign debug flakes as xfail A few recently added packetdrill tests that are known time sensitive (e.g., because testing timestamping) occasionally fail in debug mode: https://netdev.bots.linux.dev/contest.html?executor=vmksft-packetdrill-dbg These failures are well understood. Correctness of the tests is verified in non-debug mode. Continue running in debug mode also, to keep coverage with debug instrumentation. But, only in debug mode, mark these tests with well understood timing issues as XFAIL (known failing) rather than FAIL when failing. Introduce an allow list xfail_list with known cases. Expand the ktap infrastructure with XFAIL support. Fixes: eab3598 ("selftests/net: packetdrill: import tcp/fast_recovery, tcp/nagle, tcp/timestamping") Reported-by: Jakub Kicinski <kuba@kernel.org> Closes: https://lore.kernel.org/netdev/20241218100013.0c698629@kernel.org/ Signed-off-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20250103113142.129251-1-willemdebruijn.kernel@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Hangbin Liu <haliu@redhat.com>
1 parent 20fc2e3 commit 3f8a0b8

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

tools/testing/selftests/kselftest/ktap_helpers.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
KTAP_TESTNO=1
88
KTAP_CNT_PASS=0
99
KTAP_CNT_FAIL=0
10+
KTAP_CNT_XFAIL=0
1011
KTAP_CNT_SKIP=0
1112

1213
KSFT_PASS=0
@@ -69,6 +70,16 @@ ktap_test_skip() {
6970
KTAP_CNT_SKIP=$((KTAP_CNT_SKIP+1))
7071
}
7172

73+
ktap_test_xfail() {
74+
description="$1"
75+
76+
result="ok"
77+
directive="XFAIL"
78+
__ktap_test "$result" "$description" "$directive"
79+
80+
KTAP_CNT_XFAIL=$((KTAP_CNT_XFAIL+1))
81+
}
82+
7283
ktap_test_fail() {
7384
description="$1"
7485

@@ -99,13 +110,13 @@ ktap_exit_fail_msg() {
99110
ktap_finished() {
100111
ktap_print_totals
101112

102-
if [ $((KTAP_CNT_PASS + KTAP_CNT_SKIP)) -eq "$KSFT_NUM_TESTS" ]; then
113+
if [ $((KTAP_CNT_PASS + KTAP_CNT_SKIP + KTAP_CNT_XFAIL)) -eq "$KSFT_NUM_TESTS" ]; then
103114
exit "$KSFT_PASS"
104115
else
105116
exit "$KSFT_FAIL"
106117
fi
107118
}
108119

109120
ktap_print_totals() {
110-
echo "# Totals: pass:$KTAP_CNT_PASS fail:$KTAP_CNT_FAIL xfail:0 xpass:0 skip:$KTAP_CNT_SKIP error:0"
121+
echo "# Totals: pass:$KTAP_CNT_PASS fail:$KTAP_CNT_FAIL xfail:$KTAP_CNT_XFAIL xpass:0 skip:$KTAP_CNT_SKIP error:0"
111122
}

tools/testing/selftests/net/packetdrill/ksft_runner.sh

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,37 @@ if [ $# -ne 1 ]; then
2323
ktap_exit_fail_msg "usage: $0 <script>"
2424
exit "$KSFT_FAIL"
2525
fi
26-
script="$1"
26+
script="$(basename $1)"
2727

2828
if [ -z "$(which packetdrill)" ]; then
2929
ktap_skip_all "packetdrill not found in PATH"
3030
exit "$KSFT_SKIP"
3131
fi
3232

3333
declare -a optargs
34+
failfunc=ktap_test_fail
35+
3436
if [[ -n "${KSFT_MACHINE_SLOW}" ]]; then
3537
optargs+=('--tolerance_usecs=14000')
38+
39+
# xfail tests that are known flaky with dbg config, not fixable.
40+
# still run them for coverage (and expect 100% pass without dbg).
41+
declare -ar xfail_list=(
42+
"tcp_fast_recovery_prr-ss.*.pkt"
43+
"tcp_timestamping.*.pkt"
44+
"tcp_user_timeout_user-timeout-probe.pkt"
45+
"tcp_zerocopy_epoll_.*.pkt"
46+
)
47+
readonly xfail_regex="^($(printf '%s|' "${xfail_list[@]}"))$"
48+
[[ "$script" =~ ${xfail_regex} ]] && failfunc=ktap_test_xfail
3649
fi
3750

3851
ktap_print_header
3952
ktap_set_plan 2
4053

41-
unshare -n packetdrill ${ipv4_args[@]} ${optargs[@]} $(basename $script) > /dev/null \
42-
&& ktap_test_pass "ipv4" || ktap_test_fail "ipv4"
43-
unshare -n packetdrill ${ipv6_args[@]} ${optargs[@]} $(basename $script) > /dev/null \
44-
&& ktap_test_pass "ipv6" || ktap_test_fail "ipv6"
54+
unshare -n packetdrill ${ipv4_args[@]} ${optargs[@]} $script > /dev/null \
55+
&& ktap_test_pass "ipv4" || $failfunc "ipv4"
56+
unshare -n packetdrill ${ipv6_args[@]} ${optargs[@]} $script > /dev/null \
57+
&& ktap_test_pass "ipv6" || $failfunc "ipv6"
4558

4659
ktap_finished

0 commit comments

Comments
 (0)