mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-23 16:53:58 -05:00
kunit: tool: fix parsing of test attributes
Add parsing of attributes as diagnostic data. Fixes issue with test plan being parsed incorrectly as diagnostic data when located after suite-level attributes. Note that if there does not exist a test plan line, the diagnostic lines between the suite header and the first result will be saved in the suite log rather than the first test case log. Signed-off-by: Rae Moar <rmoar@google.com> Reviewed-by: David Gow <davidgow@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
parent
1557e89d3a
commit
8ae27bc7ff
1 changed files with 3 additions and 1 deletions
|
@ -450,7 +450,7 @@ def parse_diagnostic(lines: LineStream) -> List[str]:
|
||||||
Log of diagnostic lines
|
Log of diagnostic lines
|
||||||
"""
|
"""
|
||||||
log = [] # type: List[str]
|
log = [] # type: List[str]
|
||||||
non_diagnostic_lines = [TEST_RESULT, TEST_HEADER, KTAP_START, TAP_START]
|
non_diagnostic_lines = [TEST_RESULT, TEST_HEADER, KTAP_START, TAP_START, TEST_PLAN]
|
||||||
while lines and not any(re.match(lines.peek())
|
while lines and not any(re.match(lines.peek())
|
||||||
for re in non_diagnostic_lines):
|
for re in non_diagnostic_lines):
|
||||||
log.append(lines.pop())
|
log.append(lines.pop())
|
||||||
|
@ -726,6 +726,7 @@ def parse_test(lines: LineStream, expected_num: int, log: List[str], is_subtest:
|
||||||
# test plan
|
# test plan
|
||||||
test.name = "main"
|
test.name = "main"
|
||||||
ktap_line = parse_ktap_header(lines, test)
|
ktap_line = parse_ktap_header(lines, test)
|
||||||
|
test.log.extend(parse_diagnostic(lines))
|
||||||
parse_test_plan(lines, test)
|
parse_test_plan(lines, test)
|
||||||
parent_test = True
|
parent_test = True
|
||||||
else:
|
else:
|
||||||
|
@ -737,6 +738,7 @@ def parse_test(lines: LineStream, expected_num: int, log: List[str], is_subtest:
|
||||||
if parent_test:
|
if parent_test:
|
||||||
# If KTAP version line and/or subtest header is found, attempt
|
# If KTAP version line and/or subtest header is found, attempt
|
||||||
# to parse test plan and print test header
|
# to parse test plan and print test header
|
||||||
|
test.log.extend(parse_diagnostic(lines))
|
||||||
parse_test_plan(lines, test)
|
parse_test_plan(lines, test)
|
||||||
print_test_header(test)
|
print_test_header(test)
|
||||||
expected_count = test.expected_count
|
expected_count = test.expected_count
|
||||||
|
|
Loading…
Add table
Reference in a new issue