Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Rae Moar and committed by
Shuah Khan
8ae27bc7 1557e89d

+3 -1
+3 -1
tools/testing/kunit/kunit_parser.py
··· 450 450 Log of diagnostic lines 451 451 """ 452 452 log = [] # type: List[str] 453 - non_diagnostic_lines = [TEST_RESULT, TEST_HEADER, KTAP_START, TAP_START] 453 + non_diagnostic_lines = [TEST_RESULT, TEST_HEADER, KTAP_START, TAP_START, TEST_PLAN] 454 454 while lines and not any(re.match(lines.peek()) 455 455 for re in non_diagnostic_lines): 456 456 log.append(lines.pop()) ··· 726 726 # test plan 727 727 test.name = "main" 728 728 ktap_line = parse_ktap_header(lines, test) 729 + test.log.extend(parse_diagnostic(lines)) 729 730 parse_test_plan(lines, test) 730 731 parent_test = True 731 732 else: ··· 738 737 if parent_test: 739 738 # If KTAP version line and/or subtest header is found, attempt 740 739 # to parse test plan and print test header 740 + test.log.extend(parse_diagnostic(lines)) 741 741 parse_test_plan(lines, test) 742 742 print_test_header(test) 743 743 expected_count = test.expected_count