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:
|
def __init__(self, device_config: DeviceConfig) -> None:
|
||||||
super().__init__(device_config)
|
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_connection: serial.Serial | None = None
|
||||||
self._serial_pty_proc: subprocess.Popen | None = None
|
self._serial_pty_proc: subprocess.Popen | None = None
|
||||||
self._serial_buffer: bytearray = bytearray()
|
self._serial_buffer: bytearray = bytearray()
|
||||||
|
|
|
@ -36,8 +36,13 @@ def pytest_addoption(parser: pytest.Parser):
|
||||||
type=float,
|
type=float,
|
||||||
default=60.0,
|
default=60.0,
|
||||||
help='Set base timeout (in seconds) used during monitoring if some '
|
help='Set base timeout (in seconds) used during monitoring if some '
|
||||||
'operations are finished in a finite amount of time (e.g. waiting '
|
'operations are finished in a finite amount of time.'
|
||||||
'for flashing).'
|
)
|
||||||
|
twister_harness_group.addoption(
|
||||||
|
'--flash-timeout',
|
||||||
|
type=float,
|
||||||
|
default=60.0,
|
||||||
|
help='Set timeout for device flashing (in seconds).'
|
||||||
)
|
)
|
||||||
twister_harness_group.addoption(
|
twister_harness_group.addoption(
|
||||||
'--build-dir',
|
'--build-dir',
|
||||||
|
|
|
@ -19,6 +19,7 @@ class DeviceConfig:
|
||||||
type: str
|
type: str
|
||||||
build_dir: Path
|
build_dir: Path
|
||||||
base_timeout: float = 60.0 # [s]
|
base_timeout: float = 60.0 # [s]
|
||||||
|
flash_timeout: float = 60.0 # [s]
|
||||||
platform: str = ''
|
platform: str = ''
|
||||||
serial: str = ''
|
serial: str = ''
|
||||||
baud: int = 115200
|
baud: int = 115200
|
||||||
|
@ -65,6 +66,7 @@ class TwisterHarnessConfig:
|
||||||
type=config.option.device_type,
|
type=config.option.device_type,
|
||||||
build_dir=_cast_to_path(config.option.build_dir),
|
build_dir=_cast_to_path(config.option.build_dir),
|
||||||
base_timeout=config.option.base_timeout,
|
base_timeout=config.option.base_timeout,
|
||||||
|
flash_timeout=config.option.flash_timeout,
|
||||||
platform=config.option.platform,
|
platform=config.option.platform,
|
||||||
serial=config.option.device_serial,
|
serial=config.option.device_serial,
|
||||||
baud=config.option.device_serial_baud,
|
baud=config.option.device_serial_baud,
|
||||||
|
|
|
@ -443,6 +443,9 @@ class Pytest(Harness):
|
||||||
f'--device-serial-baud={hardware.baud}'
|
f'--device-serial-baud={hardware.baud}'
|
||||||
])
|
])
|
||||||
|
|
||||||
|
if hardware.flash_timeout:
|
||||||
|
command.append(f'--flash-timeout={hardware.flash_timeout}')
|
||||||
|
|
||||||
options = handler.options
|
options = handler.options
|
||||||
if runner := hardware.runner or options.west_runner:
|
if runner := hardware.runner or options.west_runner:
|
||||||
command.append(f'--runner={runner}')
|
command.append(f'--runner={runner}')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue