Skip to content

Commit

Permalink
Merge tag 'linux_kselftest-kunit-6.15-rc2' of git://git.kernel.org/pu…
Browse files Browse the repository at this point in the history
…b/scm/linux/kernel/git/shuah/linux-kselftest

Pull kunit fixes from Shuah Khan:

 - Fix the tool to report test count in case of a late test plan when
   tests are specified before the test plan

 - Fix spelling error

* tag 'linux_kselftest-kunit-6.15-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  kunit: Spelling s/slowm/slow/
  kunit: tool: fix count of tests if late test plan
  • Loading branch information
Linus Torvalds committed Apr 9, 2025
2 parents 0e88632 + d1be0cf commit a245882
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/kunit/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ enum kunit_status {

/*
* Speed Attribute is stored as an enum and separated into categories of
* speed: very_slowm, slow, and normal. These speeds are relative to
* speed: very_slow, slow, and normal. These speeds are relative to
* other KUnit tests.
*
* Note: unset speed attribute acts as default of KUNIT_SPEED_NORMAL.
Expand Down
4 changes: 4 additions & 0 deletions tools/testing/kunit/kunit_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,10 @@ def parse_test(lines: LineStream, expected_num: int, log: List[str], is_subtest:
test.log.extend(parse_diagnostic(lines))
if test.name != "" and not peek_test_name_match(lines, test):
test.add_error(printer, 'missing subtest result line!')
elif not lines:
print_log(test.log, printer)
test.status = TestStatus.NO_TESTS
test.add_error(printer, 'No more test results!')
else:
parse_test_result(lines, test, expected_num, printer)

Expand Down
4 changes: 2 additions & 2 deletions tools/testing/kunit/kunit_tool_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ def test_parse_late_test_plan(self):
"""
result = kunit_parser.parse_run_tests(output.splitlines(), stdout)
# Missing test results after test plan should alert a suspected test crash.
self.assertEqual(kunit_parser.TestStatus.TEST_CRASHED, result.status)
self.assertEqual(result.counts, kunit_parser.TestCounts(passed=1, crashed=1, errors=1))
self.assertEqual(kunit_parser.TestStatus.SUCCESS, result.status)
self.assertEqual(result.counts, kunit_parser.TestCounts(passed=1, errors=2))

def line_stream_from_strs(strs: Iterable[str]) -> kunit_parser.LineStream:
return kunit_parser.LineStream(enumerate(strs, start=1))
Expand Down

0 comments on commit a245882

Please sign in to comment.