twister: Pass device flash timeout to pytest-harness.
Pass flashing timeout to pytest-harness and use them Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
This commit is contained in:
parent
4384e4b575
commit
392304706b
4 changed files with 13 additions and 3 deletions
|
@ -30,7 +30,7 @@ class HardwareAdapter(DeviceAdapter):
|
|||
|
||||
def __init__(self, device_config: DeviceConfig) -> None:
|
||||
super().__init__(device_config)
|
||||
self._flashing_timeout: float = self.base_timeout
|
||||
self._flashing_timeout: float = device_config.flash_timeout
|
||||
self._serial_connection: serial.Serial | None = None
|
||||
self._serial_pty_proc: subprocess.Popen | None = None
|
||||
self._serial_buffer: bytearray = bytearray()
|
||||
|
|
|
@ -36,8 +36,13 @@ def pytest_addoption(parser: pytest.Parser):
|
|||
type=float,
|
||||
default=60.0,
|
||||
help='Set base timeout (in seconds) used during monitoring if some '
|
||||
'operations are finished in a finite amount of time (e.g. waiting '
|
||||
'for flashing).'
|
||||
'operations are finished in a finite amount of time.'
|
||||
)
|
||||
twister_harness_group.addoption(
|
||||
'--flash-timeout',
|
||||
type=float,
|
||||
default=60.0,
|
||||
help='Set timeout for device flashing (in seconds).'
|
||||
)
|
||||
twister_harness_group.addoption(
|
||||
'--build-dir',
|
||||
|
|
|
@ -19,6 +19,7 @@ class DeviceConfig:
|
|||
type: str
|
||||
build_dir: Path
|
||||
base_timeout: float = 60.0 # [s]
|
||||
flash_timeout: float = 60.0 # [s]
|
||||
platform: str = ''
|
||||
serial: str = ''
|
||||
baud: int = 115200
|
||||
|
@ -65,6 +66,7 @@ class TwisterHarnessConfig:
|
|||
type=config.option.device_type,
|
||||
build_dir=_cast_to_path(config.option.build_dir),
|
||||
base_timeout=config.option.base_timeout,
|
||||
flash_timeout=config.option.flash_timeout,
|
||||
platform=config.option.platform,
|
||||
serial=config.option.device_serial,
|
||||
baud=config.option.device_serial_baud,
|
||||
|
|
|
@ -443,6 +443,9 @@ class Pytest(Harness):
|
|||
f'--device-serial-baud={hardware.baud}'
|
||||
])
|
||||
|
||||
if hardware.flash_timeout:
|
||||
command.append(f'--flash-timeout={hardware.flash_timeout}')
|
||||
|
||||
options = handler.options
|
||||
if runner := hardware.runner or options.west_runner:
|
||||
command.append(f'--runner={runner}')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue