Skip to content

Commit

Permalink
tests: on_target: split uart and fota steps
Browse files Browse the repository at this point in the history
Splitting fota and uart tests in two steps in the workflow.

Signed-off-by: Giacomo Dematteis <[email protected]>
  • Loading branch information
DematteisGiacomo committed Aug 23, 2024
1 parent 79d5759 commit 0e4459e
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 7 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/on_target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,17 @@ jobs:
run: |
pip install -r requirements.txt --break-system-packages
- name: Run UART and FOTA tests
- name: Run UART tests
working-directory: thingy91x-oob/tests/on_target
run: |
pytest -s -v -m dut1 tests --firmware-hex artifacts/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-debug-app.hex
pytest -s -v -m "dut1 and uart" tests --firmware-hex artifacts/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-debug-app.hex
env:
SEGGER: ${{ secrets.SEGGER_DUT_1 }}

- name: Run FOTA tests
working-directory: thingy91x-oob/tests/on_target
run: |
pytest -s -v -m "dut1 and fota" tests --firmware-hex artifacts/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-debug-app.hex
env:
SEGGER: ${{ secrets.SEGGER_DUT_1 }}
IMEI: ${{ secrets.IMEI_DUT_1 }}
Expand Down
36 changes: 34 additions & 2 deletions tests/on_target/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,44 @@ nrfutil -V
nrfutil device list
```

### Run test
### Install requirements
```shell
cd thingy91x-oob/tests/on_target
pip install -r requirements.txt --break-system-packages
```

### Run UART tests

Precondition: thingy91x with segger fw on 53

```shell
export SEGGER=<your_segger>
pytest -s -v -m "dut1 and uart" tests --firmware-hex artifacts/merged.hex
```

### Run FOTA tests

Precondition: thingy91x with segger fw on 53

```shell
export SEGGER=<your_segger>
pytest -s -v -m dut1 tests --firmware-hex artifacts/merged.hex
export IMEI=<your_imei>
export FINGERPRINT=<your_fingerprint>
pytest -s -v -m "dut1 and fota" tests --firmware-hex artifacts/merged.hex
```

### Run DFU tests

Precondition: thingy91x with external debugger attached

IMPORTANT: switch must be on nrf53 otherwise device will be bricked.

Set all this bunch of env variables appropriately (see worflow for details):
SEGGER_NRF53, SEGGER_NRF91, UART_ID, NRF53_HEX_FILE, NRF53_APP_UPDATE_ZIP,
NRF53_BL_UPDATE_ZIP, NRF91_HEX_FILE, NRF91_APP_UPDATE_ZIP, NRF91_BL_UPDATE_ZIP

```
pytest -s -v -m dut2 tests
```

## Test docker image version control
Expand Down
Binary file added tests/on_target/artifacts/mfw_nrf91x1_2.0.1.zip
Binary file not shown.
6 changes: 4 additions & 2 deletions tests/on_target/tests/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[pytest]
markers =
dut1
dut2
dut1: device used for uart and fota tests
dut2: device used for dfu tests
uart: uart tests
fota: fota tests
1 change: 1 addition & 0 deletions tests/on_target/tests/test_fota.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
APP_FOTA_TIMEOUT = 60 * 10

@pytest.mark.dut1
@pytest.mark.fota
def test_app_fota(t91x_board, hex_file):
flash_device(os.path.abspath(hex_file))
time.sleep(5)
Expand Down
3 changes: 2 additions & 1 deletion tests/on_target/tests/test_uart_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
logger = get_logger()

@pytest.mark.dut1
def test_program_board_and_check_uart(t91x_board, hex_file):
@pytest.mark.uart
def test_uart_output(t91x_board, hex_file):
flash_device(os.path.abspath(hex_file))
time.sleep(5)
t91x_board.uart.xfactoryreset()
Expand Down

0 comments on commit 0e4459e

Please sign in to comment.