summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2026-04-08 15:19:52 -0700
committerJakub Kicinski <kuba@kernel.org>2026-04-09 20:38:33 -0700
commit3d2c3d2eea9acdbee5b5742d15d021069b49d3f9 (patch)
treef194e9ffab7449853c39ba4c40571880c94e9e51
parent3c6132ccc58e8adf044166728e783f55dc323ef9 (diff)
selftests: net: py: explicitly forbid multiple ksft_run() calls
People (do people still write code or is it all AI?) seem to not get that ksft_run() can only be called once. If we call it multiple times KTAP parsers will likely cut off after the first batch has finished. Link: https://patch.msgid.link/20260408221952.819822-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--tools/testing/selftests/net/lib/py/ksft.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/testing/selftests/net/lib/py/ksft.py b/tools/testing/selftests/net/lib/py/ksft.py
index 7b8af463e35d..7083c99c9444 100644
--- a/tools/testing/selftests/net/lib/py/ksft.py
+++ b/tools/testing/selftests/net/lib/py/ksft.py
@@ -341,10 +341,13 @@ def ksft_run(cases=None, globs=None, case_pfx=None, args=()):
totals = {"pass": 0, "fail": 0, "skip": 0, "xfail": 0}
+ global KSFT_RESULT
+ if KSFT_RESULT is not None:
+ raise RuntimeError("ksft_run() can't be called multiple times.")
+
print("TAP version 13", flush=True)
print("1.." + str(len(test_cases)), flush=True)
- global KSFT_RESULT
cnt = 0
stop = False
for func, args, name in test_cases: