Lines Matching +full:line +full:- +full:name
1 # SPDX-License-Identifier: Apache-2.0
71 def trace(self) -> bool:
75 def status(self) -> TwisterStatus:
79 def status(self, value : TwisterStatus) -> None:
82 key = value.name if isinstance(value, Enum) else value
109 Get current TestCase name.
113 def translate_record(self, record: dict) -> dict:
127 def parse_record(self, line) -> re.Match: argument
130 match = self.record_pattern.search(line)
139 def process_test(self, line): argument
141 self.parse_record(line)
143 runid_match = re.search(self.run_id_pattern, line)
150 if self.RUN_PASSED in line:
157 if self.RUN_FAILED in line:
161 if self.fail_on_fault and line == self.FAULT:
164 if self.GCOV_START in line:
166 elif self.GCOV_END in line:
182 def handle(self, line): argument
218 self.instance.execution_time = time.time() - start_time
228 f"Robot test failure: {handler.sourcedir} for {self.instance.platform.name}"
242 Get current TestCase name.
244 Console Harness id has only TestSuite id without TestCase name suffix.
245 Only the first TestCase name might be taken if available when a Ztest with
250 return self.instance.testcases[0].name
262 raise ConfigurationError(self.instance.name, tc.reason)
278 raise ConfigurationError(self.instance.name, tc.reason)
281 def handle(self, line): argument
283 if self.pattern.search(line):
290 self.patterns[self.next_pattern].search(line)):
300 if pattern.search(line) and r not in self.matches:
301 self.matches[r] = line
310 if self.fail_on_fault and self.FAULT in line:
313 if self.GCOV_START in line:
315 elif self.GCOV_END in line:
318 self.process_test(line)
387 '--twister-harness',
388 '-s', '-v',
389 f'--build-dir={self.running_dir}',
390 f'--junit-xml={self.report_file}',
391 '--log-file-level=DEBUG',
392 '--log-file-format=%(asctime)s.%(msecs)03d:%(levelname)s:%(name)s: %(message)s',
393 f'--log-file={self.pytest_log_file_path}',
394 f'--platform={self.instance.platform.name}'
400 command.append(f'--dut-scope={pytest_dut_scope}')
404 '--log-cli-level=DEBUG',
405 '--log-cli-format=%(levelname)s: %(message)s'
410 command.append(f'--base-timeout={base_timeout}')
417 command.append(f'--device-type={handler.type_str}')
419 command.append('--device-type=custom')
427 command.append(f'--twister-fixture={fixture}')
430 command.append(f'--extra-test-args={shlex.join(handler.options.extra_test_args)}')
440 command = ['--device-type=hardware']
449 command.append(f'--device-serial-pty={hardware.serial_pty}')
452 f'--device-serial={hardware.serial}',
453 f'--device-serial-baud={hardware.baud}'
457 command.append(f'--flash-timeout={hardware.flash_timeout}')
461 command.append(f'--runner={runner}')
465 command.append(f'--runner-params={param}')
468 command.append(f'--west-flash-extra-args={options.west_flash}')
471 command.append(f'--device-id={board_id}')
474 command.append(f'--device-product={hardware.product}')
477 command.append(f'--pre-script={hardware.pre_script}')
480 command.append(f'--post-flash-script={hardware.post_flash_script}')
483 command.append(f'--post-script={hardware.post_script}')
486 command.append(f'--flash-before={hardware.flash_before}')
489 command.append(f'--twister-fixture={fixture}')
518 self.instance.reason = f'Pytest error - return code {proc.returncode}'
527 pytest by update PYTHONPATH and append -p argument to pytest command.
531 cmd.extend(['-p', 'twister_harness.plugin'])
536 'pytest-twister-harness',
556 line = proc.stdout.readline().decode().strip()
557 if not line:
559 self._output.append(line)
560 logger.debug(f'PYTEST: {line}')
561 self.parse_record(line)
602 tc = self.instance.add_testcase(f"{self.id}.{elem_tc.get('name')}")
622 ANSI_ESCAPE = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
623 _NAME_PATTERN = "[a-zA-Z_][a-zA-Z0-9_]*"
631 + "\\[----------\\] Global test environment tear-down)"
639 def handle(self, line): argument
641 non_ansi_line = self.ANSI_ESCAPE.sub('', line)
649 # Add the suite name
654 # Generate the internal name of the test
655 name = "{}.{}.{}".format(self.id, suite_name, test_start_match.group("test_name"))
662 # Check that the instance doesn't exist yet (prevents re-running)
663 tc = self.instance.get_case_by_name(name)
667 tc = self.instance.get_case_or_create(name)
670 self.testcase_output += line + "\n"
686 state, name = self._check_result(non_ansi_line)
687 if state == TwisterStatus.NONE or name is None:
692 tc = self.instance.get_case_by_name(name)
708 def _check_result(self, line): argument
709 test_pass_match = re.search(self.TEST_PASS_PATTERN, line)
716 test_skip_match = re.search(self.TEST_SKIP_PATTERN, line)
723 test_fail_match = re.search(self.TEST_FAIL_PATTERN, line)
740 test_case_start_pattern = re.compile(r"START - (test_)?([a-zA-Z0-9_-]+)")
742 r".*(PASS|FAIL|SKIP) - (test_)?(\S*) in (\d*[.,]?\d*) seconds"
745 r"SUITE (?P<suite_status>\S*) - .* \[(?P<suite_name>\S*)\]:"
749 r" - (PASS|FAIL|SKIP) - \[([^\.]*).(test_)?(\S*)\] duration = (\d*[.,]?\d*) seconds"
769 # First, try to match the test case ID to the first running Ztest suite with this test name.
810 self.started_suites[suite_name]['count'] -= 1
813 self.started_suites[suite_name]['count'] -= 1
835 self.started_cases[tc_name]['count'] -= 1
840 def handle(self, line): argument
843 self.testcase_output += line + "\n"
845 if test_suite_start_match := re.search(self.test_suite_start_pattern, line):
847 elif test_suite_end_match := re.search(self.test_suite_end_pattern, line):
850 elif testcase_match := re.search(self.test_case_start_pattern, line):
853 self.start_case(tc.name)
859 self.testcase_output += line + "\n"
864 elif result_match := self.test_case_end_pattern.match(line):
868 self.end_case(tc.name)
878 elif test_suite_summary_match := self.test_suite_summary_pattern.match(line):
884 elif test_case_summary_match := self.test_case_summary_pattern.match(line):
889 self.end_case(tc.name, 'TS_SUM')
900 self.process_test(line)
929 logger.warning('Cannot copy bsim exe - cannot find original executable.')
934 logger.warning('Cannot copy bsim exe - BSIM_OUT_PATH not provided.')
939 new_exe_name = f'bs_{self.instance.platform.name}_{new_exe_name}'
941 new_exe_name = self.instance.name