Skip to content

Commit aaaf1d3

Browse files
mathieuchopstmnashif
authored andcommitted
scripts: pytest: hw_adapter: use --dev-id for STM32CubeProgrammer runner
Now that the STM32CubeProgrammer runner supports the standard `--dev-id` argument, replace usage of `--tool-opt` in the pytest harness hardware adapter. Signed-off-by: Mathieu Choplain <[email protected]>
1 parent f1a75d7 commit aaaf1d3

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,9 @@ def _prepare_runner_args(self) -> tuple[list[str], list[str]]:
103103
elif runner == "openocd" and self.device_config.product == "LPC-LINK2 CMSIS-DAP":
104104
extra_args.append("--cmd-pre-init")
105105
extra_args.append(f'adapter serial {board_id}')
106-
elif runner == 'jlink':
106+
elif runner == 'jlink' or (runner == 'stm32cubeprogrammer' and self.device_config.product != "BOOT-SERIAL"):
107107
base_args.append('--dev-id')
108108
base_args.append(board_id)
109-
elif runner == 'stm32cubeprogrammer' and self.device_config.product != "BOOT-SERIAL":
110-
base_args.append(f'--tool-opt=sn={board_id}')
111109
elif runner == 'linkserver':
112110
base_args.append(f'--probe={board_id}')
113111
return base_args, extra_args

scripts/pylib/pytest-twister-harness/tests/device/hardware_adapter_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def test_if_get_command_returns_proper_string_7(patched_which, device: HardwareA
112112
assert isinstance(device.command, list)
113113
assert device.command == [
114114
'west', 'flash', '--skip-rebuild', '--build-dir', 'build', '--runner', 'stm32cubeprogrammer',
115-
'--tool-opt=sn=p_id'
115+
'--dev-id', 'p_id'
116116
]
117117

118118

0 commit comments

Comments
 (0)