Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] selftests: drv-net: netpoll_basic: xfail if no hits
@ 2026-11-19 10:52 Matthieu Baerts (NGI0)
  0 siblings, 0 replies; only message in thread
From: Matthieu Baerts (NGI0) @ 2026-11-19 10:52 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Shuah Khan, Breno Leitao, Willem de Bruijn
  Cc: netdev, linux-kselftest, linux-kernel, Matthieu Baerts (NGI0)

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@kernel.org>
---
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@kernel.org>


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-19 10:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 10:52 [PATCH net-next] selftests: drv-net: netpoll_basic: xfail if no hits Matthieu Baerts (NGI0)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox