mirror of
https://github.com/torvalds/linux.git
synced 2024-11-30 16:11:38 +00:00
kunit: tool: Fix spelling of "diagnostic" in kunit_parser
Various helper functions were misspelling "diagnostic" in their names. It finally got annoying, so fix it. Signed-off-by: David Gow <davidgow@google.com> Reviewed-by: Brendan Higgins <brendanhiggins@google.com> Tested-by: Brendan Higgins <brendanhiggins@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
parent
65a4e52997
commit
ebfd44883a
@ -97,11 +97,11 @@ def print_log(log):
|
|||||||
|
|
||||||
TAP_ENTRIES = re.compile(r'^(TAP|[\s]*ok|[\s]*not ok|[\s]*[0-9]+\.\.[0-9]+|[\s]*#).*$')
|
TAP_ENTRIES = re.compile(r'^(TAP|[\s]*ok|[\s]*not ok|[\s]*[0-9]+\.\.[0-9]+|[\s]*#).*$')
|
||||||
|
|
||||||
def consume_non_diagnositic(lines: List[str]) -> None:
|
def consume_non_diagnostic(lines: List[str]) -> None:
|
||||||
while lines and not TAP_ENTRIES.match(lines[0]):
|
while lines and not TAP_ENTRIES.match(lines[0]):
|
||||||
lines.pop(0)
|
lines.pop(0)
|
||||||
|
|
||||||
def save_non_diagnositic(lines: List[str], test_case: TestCase) -> None:
|
def save_non_diagnostic(lines: List[str], test_case: TestCase) -> None:
|
||||||
while lines and not TAP_ENTRIES.match(lines[0]):
|
while lines and not TAP_ENTRIES.match(lines[0]):
|
||||||
test_case.log.append(lines[0])
|
test_case.log.append(lines[0])
|
||||||
lines.pop(0)
|
lines.pop(0)
|
||||||
@ -113,7 +113,7 @@ OK_NOT_OK_SUBTEST = re.compile(r'^[\s]+(ok|not ok) [0-9]+ - (.*)$')
|
|||||||
OK_NOT_OK_MODULE = re.compile(r'^(ok|not ok) ([0-9]+) - (.*)$')
|
OK_NOT_OK_MODULE = re.compile(r'^(ok|not ok) ([0-9]+) - (.*)$')
|
||||||
|
|
||||||
def parse_ok_not_ok_test_case(lines: List[str], test_case: TestCase) -> bool:
|
def parse_ok_not_ok_test_case(lines: List[str], test_case: TestCase) -> bool:
|
||||||
save_non_diagnositic(lines, test_case)
|
save_non_diagnostic(lines, test_case)
|
||||||
if not lines:
|
if not lines:
|
||||||
test_case.status = TestStatus.TEST_CRASHED
|
test_case.status = TestStatus.TEST_CRASHED
|
||||||
return True
|
return True
|
||||||
@ -139,7 +139,7 @@ SUBTEST_DIAGNOSTIC = re.compile(r'^[\s]+# (.*)$')
|
|||||||
DIAGNOSTIC_CRASH_MESSAGE = re.compile(r'^[\s]+# .*?: 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_diagnostic(lines, test_case)
|
||||||
if not lines:
|
if not lines:
|
||||||
return False
|
return False
|
||||||
line = lines[0]
|
line = lines[0]
|
||||||
@ -155,7 +155,7 @@ def parse_diagnostic(lines: List[str], test_case: TestCase) -> bool:
|
|||||||
|
|
||||||
def parse_test_case(lines: List[str]) -> Optional[TestCase]:
|
def parse_test_case(lines: List[str]) -> Optional[TestCase]:
|
||||||
test_case = TestCase()
|
test_case = TestCase()
|
||||||
save_non_diagnositic(lines, test_case)
|
save_non_diagnostic(lines, test_case)
|
||||||
while parse_diagnostic(lines, test_case):
|
while parse_diagnostic(lines, test_case):
|
||||||
pass
|
pass
|
||||||
if parse_ok_not_ok_test_case(lines, test_case):
|
if parse_ok_not_ok_test_case(lines, test_case):
|
||||||
@ -166,7 +166,7 @@ def parse_test_case(lines: List[str]) -> Optional[TestCase]:
|
|||||||
SUBTEST_HEADER = re.compile(r'^[\s]+# Subtest: (.*)$')
|
SUBTEST_HEADER = re.compile(r'^[\s]+# Subtest: (.*)$')
|
||||||
|
|
||||||
def parse_subtest_header(lines: List[str]) -> Optional[str]:
|
def parse_subtest_header(lines: List[str]) -> Optional[str]:
|
||||||
consume_non_diagnositic(lines)
|
consume_non_diagnostic(lines)
|
||||||
if not lines:
|
if not lines:
|
||||||
return None
|
return None
|
||||||
match = SUBTEST_HEADER.match(lines[0])
|
match = SUBTEST_HEADER.match(lines[0])
|
||||||
@ -179,7 +179,7 @@ def parse_subtest_header(lines: List[str]) -> Optional[str]:
|
|||||||
SUBTEST_PLAN = re.compile(r'[\s]+[0-9]+\.\.([0-9]+)')
|
SUBTEST_PLAN = re.compile(r'[\s]+[0-9]+\.\.([0-9]+)')
|
||||||
|
|
||||||
def parse_subtest_plan(lines: List[str]) -> Optional[int]:
|
def parse_subtest_plan(lines: List[str]) -> Optional[int]:
|
||||||
consume_non_diagnositic(lines)
|
consume_non_diagnostic(lines)
|
||||||
match = SUBTEST_PLAN.match(lines[0])
|
match = SUBTEST_PLAN.match(lines[0])
|
||||||
if match:
|
if match:
|
||||||
lines.pop(0)
|
lines.pop(0)
|
||||||
@ -202,7 +202,7 @@ def max_status(left: TestStatus, right: TestStatus) -> TestStatus:
|
|||||||
def parse_ok_not_ok_test_suite(lines: List[str],
|
def parse_ok_not_ok_test_suite(lines: List[str],
|
||||||
test_suite: TestSuite,
|
test_suite: TestSuite,
|
||||||
expected_suite_index: int) -> bool:
|
expected_suite_index: int) -> bool:
|
||||||
consume_non_diagnositic(lines)
|
consume_non_diagnostic(lines)
|
||||||
if not lines:
|
if not lines:
|
||||||
test_suite.status = TestStatus.TEST_CRASHED
|
test_suite.status = TestStatus.TEST_CRASHED
|
||||||
return False
|
return False
|
||||||
@ -235,7 +235,7 @@ def bubble_up_test_case_errors(test_suite: TestSuite) -> TestStatus:
|
|||||||
def parse_test_suite(lines: List[str], expected_suite_index: int) -> Optional[TestSuite]:
|
def parse_test_suite(lines: List[str], expected_suite_index: int) -> Optional[TestSuite]:
|
||||||
if not lines:
|
if not lines:
|
||||||
return None
|
return None
|
||||||
consume_non_diagnositic(lines)
|
consume_non_diagnostic(lines)
|
||||||
test_suite = TestSuite()
|
test_suite = TestSuite()
|
||||||
test_suite.status = TestStatus.SUCCESS
|
test_suite.status = TestStatus.SUCCESS
|
||||||
name = parse_subtest_header(lines)
|
name = parse_subtest_header(lines)
|
||||||
@ -264,7 +264,7 @@ def parse_test_suite(lines: List[str], expected_suite_index: int) -> Optional[Te
|
|||||||
TAP_HEADER = re.compile(r'^TAP version 14$')
|
TAP_HEADER = re.compile(r'^TAP version 14$')
|
||||||
|
|
||||||
def parse_tap_header(lines: List[str]) -> bool:
|
def parse_tap_header(lines: List[str]) -> bool:
|
||||||
consume_non_diagnositic(lines)
|
consume_non_diagnostic(lines)
|
||||||
if TAP_HEADER.match(lines[0]):
|
if TAP_HEADER.match(lines[0]):
|
||||||
lines.pop(0)
|
lines.pop(0)
|
||||||
return True
|
return True
|
||||||
@ -274,7 +274,7 @@ def parse_tap_header(lines: List[str]) -> bool:
|
|||||||
TEST_PLAN = re.compile(r'[0-9]+\.\.([0-9]+)')
|
TEST_PLAN = re.compile(r'[0-9]+\.\.([0-9]+)')
|
||||||
|
|
||||||
def parse_test_plan(lines: List[str]) -> Optional[int]:
|
def parse_test_plan(lines: List[str]) -> Optional[int]:
|
||||||
consume_non_diagnositic(lines)
|
consume_non_diagnostic(lines)
|
||||||
match = TEST_PLAN.match(lines[0])
|
match = TEST_PLAN.match(lines[0])
|
||||||
if match:
|
if match:
|
||||||
lines.pop(0)
|
lines.pop(0)
|
||||||
@ -286,7 +286,7 @@ def bubble_up_suite_errors(test_suite_list: List[TestSuite]) -> TestStatus:
|
|||||||
return bubble_up_errors(lambda x: x.status, test_suite_list)
|
return bubble_up_errors(lambda x: x.status, test_suite_list)
|
||||||
|
|
||||||
def parse_test_result(lines: List[str]) -> TestResult:
|
def parse_test_result(lines: List[str]) -> TestResult:
|
||||||
consume_non_diagnositic(lines)
|
consume_non_diagnostic(lines)
|
||||||
if not lines or not parse_tap_header(lines):
|
if not lines or not parse_tap_header(lines):
|
||||||
return TestResult(TestStatus.NO_TESTS, [], lines)
|
return TestResult(TestStatus.NO_TESTS, [], lines)
|
||||||
expected_test_suite_num = parse_test_plan(lines)
|
expected_test_suite_num = parse_test_plan(lines)
|
||||||
|
Loading…
Reference in New Issue
Block a user