Lines Matching refs:test

264 			version_type: str, test: Test) -> None:
278 test.add_error(version_type +
281 test.add_error(
284 def parse_ktap_header(lines: LineStream, test: Test) -> bool:
304 check_version(version_num, KTAP_VERSIONS, 'KTAP', test)
307 check_version(version_num, TAP_VERSIONS, 'TAP', test)
310 test.log.append(lines.pop())
315 def parse_test_header(lines: LineStream, test: Test) -> bool:
333 test.log.append(lines.pop())
334 test.name = match.group(1)
339 def parse_test_plan(lines: LineStream, test: Test) -> bool:
358 test.expected_count = None
359 test.add_error('missing plan line!')
361 test.log.append(lines.pop())
363 test.expected_count = expected_count
365 test.status = TestStatus.NO_TESTS
366 test.add_error('0 tests run!')
373 def peek_test_name_match(lines: LineStream, test: Test) -> bool:
396 return (name == test.name)
398 def parse_test_result(lines: LineStream, test: Test,
428 test.log.append(lines.pop())
432 test.name = skip_match.group(4)
434 test.name = match.group(4)
439 test.add_error('Expected test number ' +
445 test.status = TestStatus.SKIPPED
447 test.status = TestStatus.SUCCESS
449 test.status = TestStatus.FAILURE
476 def parse_crash_in_log(test: Test) -> bool:
488 for line in test.log:
490 test.status = TestStatus.TEST_CRASHED
544 def print_test_header(test: Test) -> None:
555 message = test.name
556 if test.expected_count:
557 if test.expected_count == 1:
558 message += (' (' + str(test.expected_count) +
561 message += (' (' + str(test.expected_count) +
575 def format_test_result(test: Test) -> str:
589 if test.status == TestStatus.SUCCESS:
590 return (green('[PASSED] ') + test.name)
591 elif test.status == TestStatus.SKIPPED:
592 return (yellow('[SKIPPED] ') + test.name)
593 elif test.status == TestStatus.TEST_CRASHED:
594 print_log(test.log)
595 return (red('[CRASHED] ') + test.name)
597 print_log(test.log)
598 return (red('[FAILED] ') + test.name)
600 def print_test_result(test: Test) -> None:
610 print_with_timestamp(format_test_result(test))
612 def print_test_footer(test: Test) -> None:
622 message = format_test_result(test)
626 def print_summary_line(test: Test) -> None:
640 if test.status == TestStatus.SUCCESS:
642 elif test.status == TestStatus.SKIPPED or test.status == TestStatus.NO_TESTS:
646 counts = test.counts
663 def bubble_up_test_results(test: Test) -> None:
673 parse_crash_in_log(test)
674 subtests = test.subtests
675 counts = test.counts
676 status = test.status
681 elif test.counts.get_status() == TestStatus.TEST_CRASHED:
682 test.status = TestStatus.TEST_CRASHED
726 test = Test()
727 test.log.extend(log)
729 main = parse_ktap_header(lines, test)
733 test.name = "main"
734 parse_test_plan(lines, test)
739 parent_test = parse_test_header(lines, test)
743 parse_test_plan(lines, test)
744 print_test_header(test)
745 expected_count = test.expected_count
756 if not lines or (peek_test_name_match(lines, test) and
762 test.add_error('missing expected subtest!')
764 test.counts.add_status(
768 test.log.extend(sub_log)
774 test.subtests = subtests
777 test.log.extend(parse_diagnostic(lines))
778 if (parent_test and peek_test_name_match(lines, test)) or \
780 parse_test_result(lines, test, expected_num)
782 test.add_error('missing subtest result line!')
784 bubble_up_test_results(test)
788 print_test_footer(test)
790 print_test_result(test)
791 return test
807 test = Test()
809 test.add_error('invalid KTAP input!')
810 test.status = TestStatus.FAILURE_TO_PARSE_TESTS
812 test = parse_test(lines, 0, [])
813 if test.status != TestStatus.NO_TESTS:
814 test.status = test.counts.get_status()
816 print_summary_line(test)
817 return TestResult(test.status, test, lines)