selftests: drv-net: add helper/wrapper for bpftrace
authorJakub Kicinski <kuba@kernel.org>
Mon, 14 Jul 2025 09:56:48 +0000 (02:56 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 17 Jul 2025 00:25:49 +0000 (17:25 -0700)
commit3c561c547c396038c7690645cff4f98181c62d49
tree5b3ef2705c6e5137d2965f24855b29ab7601d363
parent6c628ed95e1b41f98766268593196adb7a0cb9a7
selftests: drv-net: add helper/wrapper for bpftrace

bpftrace is very useful for low level driver testing. perf or trace-cmd
would also do for collecting data from tracepoints, but they require
much more post-processing.

Add a wrapper for running bpftrace and sanitizing its output.
bpftrace has JSON output, which is great, but it prints loose objects
and in a slightly inconvenient format. We have to read the objects
line by line, and while at it return them indexed by the map name.

Reviewed-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Breno Leitao <leitao@debian.org>
Link: https://patch.msgid.link/20250714-netpoll_test-v7-1-c0220cfaa63e@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/drivers/net/lib/py/__init__.py
tools/testing/selftests/net/lib/py/utils.py