From nobody Sat Feb 7 09:46:57 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99DB22EA75E; Tue, 30 Dec 2025 12:26:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767097607; cv=none; b=UMfv4IJxZkwqI+h7SeguNdBQdGzHrNCexwOF7KdBn8HNxtsLOw8rVz91WG1NHbVd1ns6NbYDmYhrkxaGykwZ0h86/RRPyY9I4eUhkQhsyudPeTnbzvZkfofykbkLy3sA++OS6V3xuB6S5WxtpZyM3qLPIMYcwujx/Kp+tpK1OF0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767097607; c=relaxed/simple; bh=ZMbxzGWr/vrZP/8PKzVCh8okmNKn/J8jot4OuPSzvNo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OqHBCasPvtThwnMxb+I9BysG4LtGh2oHISJA4OlOfF/DjDtdAE9wmUAOF1fmvxmXbpRNDOICzo882q2MDK8mWPS4iZXpeBIHuwu5is8/Krf/QgO3YJYtoXAVN3xq7EkMfUPdaraGQxekjeVdIXHBvDRdz4Bb6EEpORSiMKNt2TY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=iU1TgcRm; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=IyhCdcd3; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="iU1TgcRm"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="IyhCdcd3" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1767097603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TNZEdmarCwKajBwZbA69hu0SIivcfckoXMusV43q5YQ=; b=iU1TgcRmWFj8CUQr9hUse0RvaThe2nLojPvrsnYhlx+mkLTE1MVM/zW64LAA8mq6zR+dgl qOIked77hy4s8bmKIqEXok1jtbVSbz7USXe3Skk6SrN6qrKjudahGAcQrfqVlHtEoVM46U 1HeAV0Jb5qRPTqYbdTWMjuJ2RRk/r6JffxVpJWAfDhyXS6Pnw8FgBdRJHgGaBf6oL59+Ot VnEY8w0Edpa8id91t85K0LUrmz0Z/i11+zN/dMf19dJ7/vwgfZusfuyJDp1VROHyG+8ss7 2jTTeH8f1y9Cd7/kTCZOKNVL1/8lMx9A2Nsx2hElQMBXP+IzVnIxXXgxJ9HEug== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1767097603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TNZEdmarCwKajBwZbA69hu0SIivcfckoXMusV43q5YQ=; b=IyhCdcd31tx4NwNgoHAg3ga9iR4c6W+f6pVfVJWIT4X4SLgoV/yQVbg4QMv5m/nTU+iMsJ LRq/01QA/XsBmQBw== Date: Tue, 30 Dec 2025 13:26:35 +0100 Subject: [PATCH 1/2] kunit: tool: Add test for nested test result reporting Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251230-kunit-nested-failure-v1-1-98cfbeb87823@linutronix.de> References: <20251230-kunit-nested-failure-v1-0-98cfbeb87823@linutronix.de> In-Reply-To: <20251230-kunit-nested-failure-v1-0-98cfbeb87823@linutronix.de> To: Brendan Higgins , David Gow , Rae Moar Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , Rae Moar X-Developer-Signature: v=1; a=ed25519-sha256; t=1767097602; l=2152; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=ZMbxzGWr/vrZP/8PKzVCh8okmNKn/J8jot4OuPSzvNo=; b=yk6V8AcqSrranhCkRNEVpWTtvoL4Dof4ifyeau19oY0OhhRqBDGrxHJbHO/XMcYQ0OhOTBPek xkUNtglTmwUB6FYpOE6RpNdFL8I5KTeNWOFFj8ge4aey/fxQtoCTjUY X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= Currently there is a lack of tests validating the result reporting from nested tests. Add one, it will also be used to validate upcoming changes to the nested test parsing. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: David Gow Reviewed-by: Rae Moar --- tools/testing/kunit/kunit_tool_test.py | 10 ++++++= ++++ .../kunit/test_data/test_is_test_passed-failure-nested.log | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/k= unit_tool_test.py index bbba921e0eac..b74dc05fc2fe 100755 --- a/tools/testing/kunit/kunit_tool_test.py +++ b/tools/testing/kunit/kunit_tool_test.py @@ -165,6 +165,16 @@ class KUnitParserTest(unittest.TestCase): self.assertEqual(kunit_parser.TestStatus.FAILURE, result.status) self.assertEqual(result.counts.errors, 0) =20 + def test_parse_failed_nested_tests_log(self): + nested_log =3D test_data_path('test_is_test_passed-failure-nested.log') + with open(nested_log) as file: + result =3D kunit_parser.parse_run_tests(file.readlines(), stdout) + self.assertEqual(kunit_parser.TestStatus.FAILURE, result.status) + self.assertEqual(result.counts.failed, 2) + self.assertEqual(kunit_parser.TestStatus.FAILURE, result.subtests[0].sta= tus) + self.assertEqual(kunit_parser.TestStatus.FAILURE, result.subtests[1].sta= tus) + self.assertEqual(kunit_parser.TestStatus.FAILURE, result.subtests[1].sub= tests[0].status) + def test_no_header(self): empty_log =3D test_data_path('test_is_test_passed-no_tests_run_no_header= .log') with open(empty_log) as file: diff --git a/tools/testing/kunit/test_data/test_is_test_passed-failure-nest= ed.log b/tools/testing/kunit/test_data/test_is_test_passed-failure-nested.l= og new file mode 100644 index 000000000000..2e528da39ab5 --- /dev/null +++ b/tools/testing/kunit/test_data/test_is_test_passed-failure-nested.log @@ -0,0 +1,7 @@ +KTAP version 1 +1..2 +not ok 1 subtest 1 + KTAP version 1 + 1..1 + not ok 1 subsubtest 1 +not ok 2 subtest 2 --=20 2.52.0 From nobody Sat Feb 7 09:46:57 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C7152EBDC0; Tue, 30 Dec 2025 12:26:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767097609; cv=none; b=rjyFQREDfnF0UPo5okiL25oIqZcYaVC3PbdqkorDAG8dA2IbKPBqPe4llYMaC60oB8n439rrft+XJ1zJbAR4Kk5zAZe8JgaaUAThSCdZkVGaqsQUMSBZb2ej3UpokLQYLeFzOePvVcOsfP77TkFn4wkD+cUJFgqpQ8r9wsJ2Drw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767097609; c=relaxed/simple; bh=L2zjGW5l7ZMPlC5yZ8Bim6bC0+WpdGuMq6bHHK7bPcU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BD2MXbbvL8VBCCiuCjsGNg8w21y3QShd7zhNxpGzdwQm31GfnOUESCtiyDjc04p5jrHx7z1lo1ytSQeG4rdvi/Q80ot5qsGgYZSH7DSKGZoO3+evY3159Zv2aoW2fPiK4tpwM2H88YmhtG1l2t00tZIafDUXg4WkfINthrBOUjE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=g0ml8lfH; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=yYwy9JQw; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="g0ml8lfH"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="yYwy9JQw" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1767097604; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SUER9XFccQJK1WQYTH3/B0/Lr1N/zdpvMEIN1uy6dQE=; b=g0ml8lfHcRdFcuujyE9717UZyVg4//9o4533oUlCXKu1PPV3y1ghQala2qmFAy0VpcGoJM FwPLQoSdUvX1Uj5sF497jBQlVC8DYuI7/Ggea3/BmI30wUQMMSU4sIq2m2XRthtgvVd/4O G+qLtxi7csHCHrMYWHA7dbQqOT9ZGnPjwJV0AV0k8wBfayL8JRwHw2U4fGTyfV08HHvKVF 7izqHccra8ENUADQOCNBkmFgluK43eBOqm6aeSVaGRCxrrG5sAxBQuTA/rUEJ5nK8j6gvo 9CmSGFtv/2BHZD4knbm1Hrg3yIn4i8cSaHUK9WPsxVVIEnBsBcziv8rygT5Lig== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1767097604; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SUER9XFccQJK1WQYTH3/B0/Lr1N/zdpvMEIN1uy6dQE=; b=yYwy9JQwdDlsWc3nKssK7Y1tUrPPnwmqdJov4thnwV5Isfqntsy/IJWGbRWgE/v9/7s3BE 6VKV7CVG2OlrBjAw== Date: Tue, 30 Dec 2025 13:26:36 +0100 Subject: [PATCH 2/2] kunit: tool: Don't overwrite test status based on subtest counts Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251230-kunit-nested-failure-v1-2-98cfbeb87823@linutronix.de> References: <20251230-kunit-nested-failure-v1-0-98cfbeb87823@linutronix.de> In-Reply-To: <20251230-kunit-nested-failure-v1-0-98cfbeb87823@linutronix.de> To: Brendan Higgins , David Gow , Rae Moar Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1767097602; l=2661; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=L2zjGW5l7ZMPlC5yZ8Bim6bC0+WpdGuMq6bHHK7bPcU=; b=PxVnXMVfjO/budpsu/UuSbKZi2VD6fmlgBp3mLHT7t5ll4uSlBLLSqJw1LkK0tRjWzLB1JQCM E6iRuGaqjF4DNxLLmaY+Tt5thbzW6V3ksU2HtJdOsGqdgdXLDiUfR0J X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= If a subtest itself reports success, but the outer testcase fails, the whole testcase should be reported as a failure. However the status is recalculated based on the test counts, overwriting the outer test result. Synthesize a failed test in this case to make sure the failure is not swallowed. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: David Gow --- tools/testing/kunit/kunit_parser.py | 3 += ++ tools/testing/kunit/kunit_tool_test.py | 1 + tools/testing/kunit/test_data/test_is_test_passed-failure-nested.log | 3 += ++ 3 files changed, 7 insertions(+) diff --git a/tools/testing/kunit/kunit_parser.py b/tools/testing/kunit/kuni= t_parser.py index 333cd3a4a56b..5338489dcbe4 100644 --- a/tools/testing/kunit/kunit_parser.py +++ b/tools/testing/kunit/kunit_parser.py @@ -689,6 +689,9 @@ def bubble_up_test_results(test: Test) -> None: elif test.counts.get_status() =3D=3D TestStatus.TEST_CRASHED: test.status =3D TestStatus.TEST_CRASHED =20 + if status =3D=3D TestStatus.FAILURE and test.counts.get_status() =3D=3D T= estStatus.SUCCESS: + counts.add_status(status) + def parse_test(lines: LineStream, expected_num: int, log: List[str], is_su= btest: bool, printer: Printer) -> Test: """ Finds next test to parse in LineStream, creates new Test object, diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/k= unit_tool_test.py index b74dc05fc2fe..d5bbcb95ab6a 100755 --- a/tools/testing/kunit/kunit_tool_test.py +++ b/tools/testing/kunit/kunit_tool_test.py @@ -172,6 +172,7 @@ class KUnitParserTest(unittest.TestCase): self.assertEqual(kunit_parser.TestStatus.FAILURE, result.status) self.assertEqual(result.counts.failed, 2) self.assertEqual(kunit_parser.TestStatus.FAILURE, result.subtests[0].sta= tus) + self.assertEqual(kunit_parser.TestStatus.SUCCESS, result.subtests[0].sub= tests[0].status) self.assertEqual(kunit_parser.TestStatus.FAILURE, result.subtests[1].sta= tus) self.assertEqual(kunit_parser.TestStatus.FAILURE, result.subtests[1].sub= tests[0].status) =20 diff --git a/tools/testing/kunit/test_data/test_is_test_passed-failure-nest= ed.log b/tools/testing/kunit/test_data/test_is_test_passed-failure-nested.l= og index 2e528da39ab5..5498dfd0b0db 100644 --- a/tools/testing/kunit/test_data/test_is_test_passed-failure-nested.log +++ b/tools/testing/kunit/test_data/test_is_test_passed-failure-nested.log @@ -1,5 +1,8 @@ KTAP version 1 1..2 + KTAP version 1 + 1..1 + ok 1 test 1 not ok 1 subtest 1 KTAP version 1 1..1 --=20 2.52.0