zephyr/scripts/pylib/pytest-twister-harness/tests
Reto Schneider 7f1c3d1841 twister: runner: j-link: Fix parameter passing
To specify the serial number, JLink expects either one argument
('--dev-id=xxx') or two (e.g. '--dev-id' 'xxx'), but it can not deal
with a single one that is '--dev-id xxx'.

The problem has been introduced (or just made visible?) by commit
5ee4284320 (twister: runner: j-link: use
dev-id instead of SelectEmuBySN) in PR #76931.

How to reproduce:

1. Create a HW configuration map, e.g.:

```
$ cat zephyr-hw-map-nrf52840dk-1.yml
- connected: true
  id: '683517317'
  platform: nrf52840dk/nrf52840
  product: nRF52840 DK 1
  runner: jlink
  serial: /dev/ttyACM-nrf-dk-1
```

2. Run test `logging.dictionary` with Twister:

```
$ west twister --platform nrf52840dk/nrf52840 --device-testing \
  --hardware-map zephyr-hw-map-nrf52840dk-1.yml -s logging.dictionary
```

3. The build will fail, and the `twister_harness.log` contains:

```
10:21:24.375:DEBUG:twister_harness.device.factory: Get device type
  "hardware"
10:21:24.375:DEBUG:twister_harness.device.hardware_adapter: Opening
  serial connection for /dev/ttyACM-nrf-dk-1
10:21:24.376:DEBUG:twister_harness.device.hardware_adapter: Flashing
  device 683517317
10:21:24.376:DEBUG:twister_harness.device.hardware_adapter: Flashing
  command: <snip>/bin/west flash --skip-rebuild --build-dir
  twister-out/<snip>/tests/subsys/logging/dictionary/logging.dictionary
  --runner jlink '--dev-id 683517317'
10:21:24.590:ERROR:twister_harness.device.hardware_adapter: Could not
  flash device 683517317
10:21:24.592:DEBUG:twister_harness.device.hardware_adapter: Closed
  serial connection for /dev/ttyACM-nrf-dk-1
```
(note the '--dev-id 683517317' part)

4. Running the stated `west flash` command shows the following error
   message:

```
-- west flash: using runner jlink
FATAL ERROR: runner jlink received unknown arguments: ['--dev-id
  683517317']
```

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-08-26 17:07:40 +02:00
..
device
fixtures
helpers
resources
conftest.py
plugin_test.py