Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kunit: tool: Add test for nested test result reporting

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.

Link: https://lore.kernel.org/r/20251230-kunit-nested-failure-v1-1-98cfbeb87823@linutronix.de
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Rae Moar <rmoar@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Thomas Weißschuh and committed by
Shuah Khan
0c5b86c6 5c7a4741

+17
+10
tools/testing/kunit/kunit_tool_test.py
··· 165 165 self.assertEqual(kunit_parser.TestStatus.FAILURE, result.status) 166 166 self.assertEqual(result.counts.errors, 0) 167 167 168 + def test_parse_failed_nested_tests_log(self): 169 + nested_log = test_data_path('test_is_test_passed-failure-nested.log') 170 + with open(nested_log) as file: 171 + result = kunit_parser.parse_run_tests(file.readlines(), stdout) 172 + self.assertEqual(kunit_parser.TestStatus.FAILURE, result.status) 173 + self.assertEqual(result.counts.failed, 2) 174 + self.assertEqual(kunit_parser.TestStatus.FAILURE, result.subtests[0].status) 175 + self.assertEqual(kunit_parser.TestStatus.FAILURE, result.subtests[1].status) 176 + self.assertEqual(kunit_parser.TestStatus.FAILURE, result.subtests[1].subtests[0].status) 177 + 168 178 def test_no_header(self): 169 179 empty_log = test_data_path('test_is_test_passed-no_tests_run_no_header.log') 170 180 with open(empty_log) as file:
+7
tools/testing/kunit/test_data/test_is_test_passed-failure-nested.log
··· 1 + KTAP version 1 2 + 1..2 3 + not ok 1 subtest 1 4 + KTAP version 1 5 + 1..1 6 + not ok 1 subsubtest 1 7 + not ok 2 subtest 2