[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250625-netpoll_test-v2-2-47d27775222c@debian.org>
Date: Wed, 25 Jun 2025 04:39:47 -0700
From: Breno Leitao <leitao@...ian.org>
To: Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Shuah Khan <shuah@...nel.org>, Simon Horman <horms@...nel.org>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
linux-kselftest@...r.kernel.org,
Willem de Bruijn <willemdebruijn.kernel@...il.com>, bpf@...r.kernel.org,
gustavold@...il.com, Breno Leitao <leitao@...ian.org>
Subject: [PATCH net-next v2 2/4] selftests: drv-net: Improve bpftrace
utility error handling
Enhance the bpftrace function to raise an exception if the underlying
bpftrace command returns a non-zero exit code. This helps detect and
surface errors from bpftrace execution in test scripts, improving
robustness and debugging capabilities.
Signed-off-by: Breno Leitao <leitao@...ian.org>
---
tools/testing/selftests/net/lib/py/utils.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/testing/selftests/net/lib/py/utils.py b/tools/testing/selftests/net/lib/py/utils.py
index 760ccf6fccccc..c4e26567ee6fb 100644
--- a/tools/testing/selftests/net/lib/py/utils.py
+++ b/tools/testing/selftests/net/lib/py/utils.py
@@ -203,6 +203,9 @@ def bpftrace(expr, json=None, ns=None, host=None, timeout=None):
expr += ' interval:s:' + str(timeout) + ' { exit(); }'
cmd_arr += ['-e', expr]
cmd_obj = cmd(cmd_arr, ns=ns, host=host, shell=False)
+ if cmd_obj.ret != 0:
+ raise Exception("Warning: bpftrace command returned a non-zero exit code.")
+
if json:
# bpftrace prints objects as lines
ret = {}
--
2.47.1
Powered by blists - more mailing lists