Lines Matching +full:line +full:- +full:name

1 # SPDX-License-Identifier: GPL-2.0
20 def __init__(self) -> None:
22 self.name = ''
25 def __str__(self) -> str:
26 return 'TestSuite(' + str(self.status) + ',' + self.name + ',' + str(self.cases) + ')'
28 def __repr__(self) -> str:
32 def __init__(self) -> None:
34 self.name = ''
37 def __str__(self) -> str:
38 return 'TestCase(' + str(self.status) + ',' + self.name + ',' + str(self.log) + ')'
40 def __repr__(self) -> str:
52 """Provides a peek()/pop() interface over an iterator of (line#, text)."""
63 def _get_next(self) -> None:
69 def peek(self) -> str:
72 def pop(self) -> str:
77 def __bool__(self) -> bool:
81 def __iter__(self) -> Iterator[str]:
85 def line_number(self) -> int:
88 kunit_start_re = re.compile(r'TAP version [0-9]+$')
90 'Kernel panic - not syncing: VFS:|reboot: System halted)')
92 def extract_tap_lines(kernel_output: Iterable[str]) -> LineStream:
93 def isolate_kunit_output(kernel_output: Iterable[str]) -> Iterator[Tuple[int, str]]:
96 for line in kernel_output:
98 line = line.rstrip() # line always has a trailing \n
99 if kunit_start_re.search(line):
100 prefix_len = len(line.split('TAP version')[0])
102 yield line_num, line[prefix_len:]
103 elif kunit_end_re.search(line):
106 yield line_num, line[prefix_len:]
113 def red(text) -> str:
116 def yellow(text) -> str:
119 def green(text) -> str:
122 def print_with_timestamp(message) -> None:
125 def format_suite_divider(message) -> str:
128 def print_suite_divider(message) -> None:
132 def print_log(log) -> None:
136 TAP_ENTRIES = re.compile(r'^(TAP|[\s]*ok|[\s]*not ok|[\s]*[0-9]+\.\.[0-9]+|[\s]*# (Subtest:|.*: kun…
138 def consume_non_diagnostic(lines: LineStream) -> None:
142 def save_non_diagnostic(lines: LineStream, test_case: TestCase) -> None:
149 OK_NOT_OK_SKIP = re.compile(r'^[\s]*(ok|not ok) [0-9]+ - (.*) # SKIP(.*)$')
151 OK_NOT_OK_SUBTEST = re.compile(r'^[\s]+(ok|not ok) [0-9]+ - (.*)$')
153 OK_NOT_OK_MODULE = re.compile(r'^(ok|not ok) ([0-9]+) - (.*)$')
155 def parse_ok_not_ok_test_case(lines: LineStream, test_case: TestCase) -> bool:
160 line = lines.peek()
161 match = OK_NOT_OK_SUBTEST.match(line)
163 line = lines.pop()
164 match = OK_NOT_OK_SUBTEST.match(line)
167 test_case.name = match.group(2)
168 skip_match = OK_NOT_OK_SKIP.match(line)
185 def parse_diagnostic(lines: LineStream, test_case: TestCase) -> bool:
189 line = lines.peek()
190 match = SUBTEST_DIAGNOSTIC.match(line)
193 crash_match = DIAGNOSTIC_CRASH_MESSAGE.match(line)
200 def parse_test_case(lines: LineStream) -> Optional[TestCase]:
212 def parse_subtest_header(lines: LineStream) -> Optional[str]:
223 SUBTEST_PLAN = re.compile(r'[\s]+[0-9]+\.\.([0-9]+)')
225 def parse_subtest_plan(lines: LineStream) -> Optional[int]:
234 def max_status(left: TestStatus, right: TestStatus) -> TestStatus:
248 expected_suite_index: int) -> bool:
253 line = lines.peek()
254 match = OK_NOT_OK_MODULE.match(line)
261 skip_match = OK_NOT_OK_SKIP.match(line)
274 def bubble_up_errors(status_list: Iterable[TestStatus]) -> TestStatus:
277 def bubble_up_test_case_errors(test_suite: TestSuite) -> TestStatus:
281 def parse_test_suite(lines: LineStream, expected_suite_index: int) -> Optional[TestSuite]:
287 name = parse_subtest_header(lines)
288 if not name:
290 test_suite.name = name
299 expected_test_case_num -= 1
307 print(f'failed to parse end of suite "{name}", at line {lines.line_number()}: {lines.peek()}')
312 def parse_tap_header(lines: LineStream) -> bool:
320 TEST_PLAN = re.compile(r'[0-9]+\.\.([0-9]+)')
322 def parse_test_plan(lines: LineStream) -> Optional[int]:
331 def bubble_up_suite_errors(test_suites: Iterable[TestSuite]) -> TestStatus:
334 def parse_test_result(lines: LineStream) -> TestResult:
352 ' test suites, but got ' + str(i - 2))
354 test_suite = parse_test_suite(lines, -1)
357 'got unexpected test suite: ' + test_suite.name)
375 def total(self) -> int:
378 def print_and_count_results(test_result: TestResult) -> TestCounts:
382 print_suite_divider(green('[PASSED] ') + test_suite.name)
384 print_suite_divider(yellow('[SKIPPED] ') + test_suite.name)
386 print_suite_divider(red('[CRASHED] ' + test_suite.name))
388 print_suite_divider(red('[FAILED] ') + test_suite.name)
392 print_with_timestamp(green('[PASSED] ') + test_case.name)
395 print_with_timestamp(yellow('[SKIPPED] ') + test_case.name)
398 print_with_timestamp(red('[CRASHED] ' + test_case.name))
403 print_with_timestamp(red('[FAILED] ') + test_case.name)
408 def parse_run_tests(kernel_output: Iterable[str]) -> TestResult: