[PATCH net-next] selftests: drv-net: netpoll_basic: xfail if no hits
From: Matthieu Baerts (NGI0)
Date: Thu Nov 19 2026 - 05:52:13 EST
When netpoll_poll_dev() is not called during the test, bpftrace doesn't
print the '@hits' map, because it is empty. The test then fails instead
of reporting the expected XFAIL:
net.lib.py.ksft.KsftFailEx: bpftrace failed to run!?: {}
This has been observed regularly in the netdev CI with netdevsim, since
a recent switch to Fedora 45: hitting this function depends on timings.
Fixes: b3019343e4bd ("selftests: net: add netpoll basic functionality test")
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>
---
I added the Fixes tag to help people validating this on stable kernel,
but feel free to remove it if you prefer not to.
Note that the test is currently ignored on NIPA.
---
tools/testing/selftests/drivers/net/netpoll_basic.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/drivers/net/netpoll_basic.py b/tools/testing/selftests/drivers/net/netpoll_basic.py
index 408bd54d6779..a4dc68c828cf 100755
--- a/tools/testing/selftests/drivers/net/netpoll_basic.py
+++ b/tools/testing/selftests/drivers/net/netpoll_basic.py
@@ -236,7 +236,8 @@ def bpftrace_call() -> None:
global MAPS # pylint: disable=W0603
# This will be passed to bpftrace as in bpftrace -e "expr"
- expr = "kprobe:netpoll_poll_dev { @hits = count(); }"
+ # Init @hits: bpftrace doesn't print empty maps
+ expr = "BEGIN { @hits = 0; } kprobe:netpoll_poll_dev { @hits++; }"
MAPS = bpftrace(expr, timeout=BPFTRACE_TIMEOUT, json=True)
logging.debug("BPFtrace output: %s", MAPS)
---
base-commit: ac9dfaeb9cd9ab731c14d202a2f00098f0417766
change-id: 20261119-net-next-netpoll-basic-xfail-7da4cdeca5b9
Best regards,
--
Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>