mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Gow <david@davidgow.net>
To: poulin.louis@student.oaklandcc.edu,
	Brendan Higgins <brendan.higgins@linux.dev>
Cc: Rae Moar <raemoar63@gmail.com>,
	linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] kunit: tool: Count failed suites with only skipped tests
Date: Wed, 25 Nov 2026 13:22:32 +0800	[thread overview]
Message-ID: <7c8034d9-4f56-49be-b3c2-7764114bf599@davidgow.net> (raw)
In-Reply-To: <20261124-kunit-v2-v2-1-e1adbcad6b48@student.oaklandcc.edu>

Le 25/11/2026 à 00:43, Louis H. Poulin II via B4 Relay a écrit :
> From: "Louis H. Poulin II" <poulin.louis@student.oaklandcc.edu>
> 
> 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@student.oaklandcc.edu>
> ---

Thanks very much: this patch survived the sending process successfully.

I do think that it's a little bit confusing to, depending on the status 
of the suite, suddenly get an extra test failure in the result count. 
But ultimately, it's probably less confusing than having the failure 
disappear altogether, so I'm okay with it.

Two other suggestions:
- The test data should live in tools/testing/kunit/test_data alongside 
all of the other test KTAP.
- It'd be nice to update _summarize_failed_tests() to count these. It 
should be as simple as extending the 'len(failed_subtests) == 
len(test.subtests)' check to also compare against 0, as far as I can 
tell. (Note, though, that this doesn't trigger by default unless there 
are >=100 tests run, so you may wish to hack that out to test it.)

With those, I think this would be good.

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']

For consistency, can we put this in a file in 
tools/testing/kunit/test_data -- that's what the other tests here do, 
and it makes it easier to debug the failures, IMO.

If you _really_ want to keep it here (which is fine if you have a really 
good reason, though I'd want to hear it), can we at least reformat it to 
have one line per line: as is, it's quite difficult to read.

> +		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:
> 


  reply	other threads:[~2026-11-25  5:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 16:43 [PATCH v2 0/2] kunit: tool: Preserve failures in parsed KTAP results Louis H. Poulin II via B4 Relay
2026-11-24 16:43 ` [PATCH v2 1/2] kunit: tool: Count failed suites with only skipped tests Louis H. Poulin II via B4 Relay
2026-11-25  5:22   ` David Gow [this message]
2026-11-24 16:43 ` [PATCH v2 2/2] kunit: tool: Fail on out-of-sequence test numbers Louis H. Poulin II via B4 Relay
2026-11-25  5:22   ` David Gow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7c8034d9-4f56-49be-b3c2-7764114bf599@davidgow.net \
    --to=david@davidgow.net \
    --cc=brendan.higgins@linux.dev \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=poulin.louis@student.oaklandcc.edu \
    --cc=raemoar63@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®