Re: [PATCH 1/2] kunit: tool: Count failed suites with only skipped tests

From: David Gow

Date: Mon Nov 23 2026 - 04:58:37 EST


Le 06/11/2026 à 02:14, Louis H. Poulin II a écrit :
A suite can report not ok while all its child cases are skipped.
The parser retains the suite status as FAILURE but counts only the
skipped children. The run status is then derived from those counts and
incorrectly reports SKIPPED.

When a suite reports failure and the child aggregate is SKIPPED, add
a failed count for the suite, as is already done when child aggregate
is SUCCESS. Cover a correctly numbered failing suite with a skipped
child.

Fixes: d65d07cb5b01 ("kunit: tool: improve compatibility of
kunit_parser with KTAP specification")

Signed-off-by: Louis H. Poulin II <poulin.louis@xxxxxxxxxxxxxxxxxxxxx>
---

Hi Louis,

Thanks very much for your patch.

Unfortunately, it looks like your email client has mangled it somewhat:, some of the lines have been wrapped.

This is a known issue with some email programs: particularly with gmail. The file Documentation/process/email-clients.rst has some details about different clients:
https://docs.kernel.org/process/email-clients.html

But I'd personally recommend either using git send-email:
- https://git-send-email.io
or the b4 tool:
- https://b4.docs.kernel.org/en/latest/

Those will ensure that the patch will be sent properly, so that maintainers can use git to apply it automatically. I personally use git send-email for my patches, and once it's set up, it works great.

Apart from that, the patch looks okay from here, but I'll run my full battery of tests once I can apply it.

Cheers,
-- David

tools/testing/kunit/kunit_parser.py | 4 +++-
tools/testing/kunit/kunit_tool_test.py | 13 +++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/tools/testing/kunit/kunit_parser.py
b/tools/testing/kunit/kunit_parser.py
index d722874b..dce365d1 100644
--- a/tools/testing/kunit/kunit_parser.py
+++ b/tools/testing/kunit/kunit_parser.py
@@ -694,7 +694,9 @@ def bubble_up_test_results(test: Test) -> None:
elif test.counts.get_status() == TestStatus.TEST_CRASHED:
test.status = TestStatus.TEST_CRASHED

- if status == TestStatus.FAILURE and test.counts.get_status() ==
TestStatus.SUCCESS:
+ # Preserve a failing suite result when its children all pass or skip.
+ if (status == TestStatus.FAILURE and
+ test.counts.get_status() in (TestStatus.SUCCESS, TestStatus.SKIPPED)):
counts.add_status(status)

def parse_test(lines: LineStream, expected_num: int, log: List[str],
is_subtest: bool, printer: Printer) -> Test:
diff --git a/tools/testing/kunit/kunit_tool_test.py
b/tools/testing/kunit/kunit_tool_test.py
index 85ae2175..5fd386d0 100755
--- a/tools/testing/kunit/kunit_tool_test.py
+++ b/tools/testing/kunit/kunit_tool_test.py
@@ -265,6 +265,19 @@ class KUnitParserTest(unittest.TestCase):
self.assertEqual(kunit_parser.TestStatus.SKIPPED, result.status)
self.assertEqual(result.counts, kunit_parser.TestCounts(skipped=5))

+ def test_failed_suite_with_skipped_child_fails(self):
+ output = ['KTAP version 1', '1..1',
+ ' KTAP version 1', ' # Subtest: suite', ' 1..1',
+ ' ok 1 - case # SKIP reason', 'not ok 1 - suite']
+ result = kunit_parser.parse_run_tests(output, stdout)
+ suite = result.subtests[0]
+ self.assertEqual(kunit_parser.TestStatus.SKIPPED, suite.subtests[0].status)
+ self.assertEqual(kunit_parser.TestStatus.FAILURE, suite.status)
+ self.assertEqual(suite.counts,
+ kunit_parser.TestCounts(failed=1, skipped=1))
+ self.assertEqual(kunit_parser.TestStatus.FAILURE, result.status)
+ self.assertEqual(result.counts, suite.counts)
+
def test_ignores_hyphen(self):
hyphen_log = _test_data_path('test_strip_hyphen.log')
with open(hyphen_log) as file: