diff options
author | David Gow <davidgow@google.com> | 2021-11-02 00:30:11 -0700 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2021-12-13 13:36:06 -0700 |
commit | c68077b14692f4a5d42334625d6d4924b234791e (patch) | |
tree | de43fd9a4c0d73f36896077816efd56c8c3d7f6e /tools/testing/kunit/kunit_tool_test.py | |
parent | ee92ed38364e7073bb741577d7b243b232442014 (diff) | |
download | linux-c68077b14692f4a5d42334625d6d4924b234791e.tar.gz linux-c68077b14692f4a5d42334625d6d4924b234791e.tar.bz2 linux-c68077b14692f4a5d42334625d6d4924b234791e.zip |
kunit: tool: Do not error on tests without test plans
The (K)TAP spec encourages test output to begin with a 'test plan': a
count of the number of tests being run of the form:
1..n
However, some test suites might not know the number of subtests in
advance (for example, KUnit's parameterised tests use a generator
function). In this case, it's not possible to print the test plan in
advance.
kunit_tool already parses test output which doesn't contain a plan, but
reports an error. Since we want to use nested subtests with KUnit
paramterised tests, remove this error.
Signed-off-by: David Gow <davidgow@google.com>
Reviewed-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/kunit/kunit_tool_test.py')
-rwxr-xr-x | tools/testing/kunit/kunit_tool_test.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/kunit_tool_test.py index 34cb0a12ba18..0fcdddf0124c 100755 --- a/tools/testing/kunit/kunit_tool_test.py +++ b/tools/testing/kunit/kunit_tool_test.py @@ -191,7 +191,10 @@ class KUnitParserTest(unittest.TestCase): result = kunit_parser.parse_run_tests( kunit_parser.extract_tap_lines( file.readlines())) - self.assertEqual(2, result.test.counts.errors) + # A missing test plan is not an error. + self.assertEqual(0, result.test.counts.errors) + # All tests should be accounted for. + self.assertEqual(10, result.test.counts.total()) self.assertEqual( kunit_parser.TestStatus.SUCCESS, result.status) |