aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2024-04-17 16:11:39 -0700
committerJakub Kicinski <kuba@kernel.org>2024-04-18 16:15:31 -0700
commit655614ea2bd3b5774cdb95c7630d8327bf221934 (patch)
tree6cea9f951c003624de628903d3c1bcdaadcabc70
parent41e3ddb291b8578c5c3b44def9cf3892fbc51838 (diff)
downloadmptcp_net-next-655614ea2bd3b5774cdb95c7630d8327bf221934.tar.gz
selftests: net: fix counting totals when some checks fail
Totals currently only pay attention to exceptions, if check fails (say ksft_eq()) the test case will be counted as pass: # At /ksft/drivers/net/./ping.py line 18: # Check failed 1 != 2 not ok 1 ping.test_v4 ok 2 ping.test_v6 ok 3 ping.test_tcp # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0 ^^^^^^^^^^^^^ Pay attention to the result. Fixes: b86761ff6374 ("selftests: net: add scaffolding for Netlink tests in Python") Link: https://lore.kernel.org/r/20240417231146.2435572-2-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 3769b919721306..640dfbf4770225 100644
--- a/tools/testing/selftests/net/lib/py/ksft.py
+++ b/tools/testing/selftests/net/lib/py/ksft.py
@@ -106,7 +106,10 @@ def ksft_run(cases, args=()):
continue
ktap_result(KSFT_RESULT, cnt, case)
- totals['pass'] += 1
+ if KSFT_RESULT:
+ totals['pass'] += 1
+ else:
+ totals['fail'] += 1
print(
f"# Totals: pass:{totals['pass']} fail:{totals['fail']} xfail:{totals['xfail']} xpass:0 skip:{totals['skip']} error:0"