]> Git Repo - linux.git/commitdiff
kunit: tool: tweak error message when no KTAP found
authorDaniel Latypov <[email protected]>
Fri, 11 Nov 2022 03:18:55 +0000 (19:18 -0800)
committerShuah Khan <[email protected]>
Mon, 12 Dec 2022 21:13:47 +0000 (14:13 -0700)
We currently tell people we "couldn't find any KTAP output" with no
indication as to what this might mean.

After this patch, we get:

$ ./tools/testing/kunit/kunit.py parse /dev/null
============================================================
[ERROR] Test: <missing>: Could not find any KTAP output. Did any KUnit tests run?
============================================================
Testing complete. Ran 0 tests: errors: 1

Note: we could try and generate a more verbose message like
> Please check .kunit/test.log to see the raw kernel output.
or the like, but we'd need to know what the build dir was to know where
test.log actually lives.

This patch tries to make a more minimal improvement.

Signed-off-by: Daniel Latypov <[email protected]>
Reviewed-by: David Gow <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>
tools/testing/kunit/kunit_parser.py
tools/testing/kunit/kunit_tool_test.py

index a56c75a973b54c64ed490d453658d380826cdd83..d0ed5dd5cfc447dbea362e0d66b1a70b9b3cdcaf 100644 (file)
@@ -782,7 +782,7 @@ def parse_run_tests(kernel_output: Iterable[str]) -> Test:
        test = Test()
        if not lines:
                test.name = '<missing>'
-               test.add_error('could not find any KTAP output!')
+               test.add_error('Could not find any KTAP output. Did any KUnit tests run?')
                test.status = TestStatus.FAILURE_TO_PARSE_TESTS
        else:
                test = parse_test(lines, 0, [])
index 90c65b072be9520c4631def867611fa810596070..84a08cf072429fccd8bdc490b88f22c1aac25c0e 100755 (executable)
@@ -207,7 +207,7 @@ class KUnitParserTest(unittest.TestCase):
                with open(crash_log) as file:
                        result = kunit_parser.parse_run_tests(
                                kunit_parser.extract_tap_lines(file.readlines()))
-               print_mock.assert_any_call(StrContains('could not find any KTAP output!'))
+               print_mock.assert_any_call(StrContains('Could not find any KTAP output.'))
                print_mock.stop()
                self.assertEqual(0, len(result.subtests))
                self.assertEqual(result.counts.errors, 1)
@@ -588,7 +588,7 @@ class KUnitMainTest(unittest.TestCase):
                self.assertEqual(e.exception.code, 1)
                self.assertEqual(self.linux_source_mock.build_reconfig.call_count, 1)
                self.assertEqual(self.linux_source_mock.run_kernel.call_count, 1)
-               self.print_mock.assert_any_call(StrContains('could not find any KTAP output!'))
+               self.print_mock.assert_any_call(StrContains('Could not find any KTAP output.'))
 
        def test_exec_no_tests(self):
                self.linux_source_mock.run_kernel = mock.Mock(return_value=['TAP version 14', '1..0'])
This page took 0.057705 seconds and 4 git commands to generate.