kunit: kunit_tool: Correctly parse diagnostic messages
Currently, kunit_tool expects all diagnostic lines in test results to contain ": " somewhere, as both the subtest header and the crash report do. Fix this to accept any line starting with (minus indent) "# " as being a valid diagnostic line. This matches what the TAP spec[1] and the draft KTAP spec[2] are expecting. [1]: http://testanything.org/tap-specification.html [2]: https://lore.kernel.org/linux-kselftest/CY4PR13MB1175B804E31E502221BC8163FD830@CY4PR13MB1175.namprd13.prod.outlook.com/T/ Signed-off-by: David Gow <davidgow@google.com> Acked-by: Marco Elver <elver@google.com> Reviewed-by: Brendan Higgins <brendanhiggins@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
parent
1f0e943df6
commit
0c7a7e1a8f
|
@ -135,8 +135,8 @@ def parse_ok_not_ok_test_case(lines: List[str], test_case: TestCase) -> bool:
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
SUBTEST_DIAGNOSTIC = re.compile(r'^[\s]+# .*?: (.*)$')
|
SUBTEST_DIAGNOSTIC = re.compile(r'^[\s]+# (.*)$')
|
||||||
DIAGNOSTIC_CRASH_MESSAGE = 'kunit test case crashed!'
|
DIAGNOSTIC_CRASH_MESSAGE = re.compile(r'^[\s]+# .*?: kunit test case crashed!$')
|
||||||
|
|
||||||
def parse_diagnostic(lines: List[str], test_case: TestCase) -> bool:
|
def parse_diagnostic(lines: List[str], test_case: TestCase) -> bool:
|
||||||
save_non_diagnositic(lines, test_case)
|
save_non_diagnositic(lines, test_case)
|
||||||
|
@ -146,7 +146,8 @@ def parse_diagnostic(lines: List[str], test_case: TestCase) -> bool:
|
||||||
match = SUBTEST_DIAGNOSTIC.match(line)
|
match = SUBTEST_DIAGNOSTIC.match(line)
|
||||||
if match:
|
if match:
|
||||||
test_case.log.append(lines.pop(0))
|
test_case.log.append(lines.pop(0))
|
||||||
if match.group(1) == DIAGNOSTIC_CRASH_MESSAGE:
|
crash_match = DIAGNOSTIC_CRASH_MESSAGE.match(line)
|
||||||
|
if crash_match:
|
||||||
test_case.status = TestStatus.TEST_CRASHED
|
test_case.status = TestStatus.TEST_CRASHED
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue