Skip to content

Commit c2f5262

Browse files
committed
tests: Matrix, fota, cleanup
WIP
1 parent ffa7964 commit c2f5262

File tree

3 files changed

+34
-24
lines changed

3 files changed

+34
-24
lines changed

.github/workflows/target-test.yml

+11-4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ on:
1616
type: string
1717
required: false
1818
default: tests
19+
matrix:
20+
description: Matrix config
21+
type: string
22+
required: false
23+
default: '["nrf9151dk"]'
1924

2025
workflow_dispatch:
2126
inputs:
@@ -36,17 +41,19 @@ on:
3641
type: string
3742
required: false
3843
default: tests
44+
matrix:
45+
description: Matrix config
46+
type: string
47+
required: false
48+
default: '["nrf9151dk"]'
3949

4050
jobs:
4151
target_test:
4252
# This will create multiple jobs, one for each target defined in the matrix
4353
strategy:
4454
fail-fast: false # Don't fail all jobs if one fails
4555
matrix:
46-
include:
47-
- device: nrf9151dk
48-
- device: thingy91x
49-
56+
device: ${{ fromJSON(inputs.matrix) }}
5057
# Self-hosted runner is labeled according to the device it is linked with
5158
runs-on: cia-trd-${{ matrix.device }}
5259
environment: ${{ matrix.device }}

tests/on_target/tests/test_functional/test_fota.py

+21-18
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@
2727

2828
APP_BUNDLEID = os.getenv("APP_BUNDLEID")
2929

30-
TEST_APP_BIN = {
31-
"thingy91x": "artifacts/stable_version_jan_2025-update-signed.bin",
32-
"nrf9151dk": "artifacts/nrf9151dk_mar_2025_update_signed.bin"
33-
}
34-
3530
DEVICE_MSG_TIMEOUT = 60 * 5
3631
APP_FOTA_TIMEOUT = 60 * 10
3732
FULL_MFW_FOTA_TIMEOUT = 60 * 30
@@ -113,9 +108,15 @@ def run_fota_reschedule(dut_fota, fota_type):
113108
else:
114109
raise AssertionError(f"Fota update not available after {i} attempts")
115110

116-
@pytest.fixture
117-
def run_fota_fixture(dut_fota, hex_file, reschedule=False):
118-
def _run_fota(bundle_id="", fota_type="app", fotatimeout=APP_FOTA_TIMEOUT, new_version=TEST_APP_VERSION, reschedule=False):
111+
def run_fota(
112+
dut_fota,
113+
hex_file,
114+
bundle_id,
115+
reschedule=False,
116+
fota_type="app",
117+
fotatimeout=APP_FOTA_TIMEOUT,
118+
new_version=TEST_APP_VERSION,
119+
):
119120
flash_device(os.path.abspath(hex_file))
120121
dut_fota.uart.xfactoryreset()
121122
dut_fota.uart.flush()
@@ -177,23 +178,24 @@ def _run_fota(bundle_id="", fota_type="app", fotatimeout=APP_FOTA_TIMEOUT, new_v
177178
logger.error(f"Version is not {new_version} after {DEVICE_MSG_TIMEOUT}s")
178179
raise e
179180

180-
return _run_fota
181-
182-
183-
def test_app_fota(run_fota_fixture):
181+
def test_app_fota(dut_fota, hex_file):
184182
'''
185183
Test application FOTA from nightly version to stable version
186184
'''
187-
run_fota_fixture(
185+
run_fota(
186+
dut_fota,
187+
hex_file,
188188
bundle_id=APP_BUNDLEID,
189189
)
190190

191-
def test_delta_mfw_fota(run_fota_fixture):
191+
def test_delta_mfw_fota(dut_fota, hex_file):
192192
'''
193193
Test delta modem FOTA on nrf9151
194194
'''
195195
try:
196-
run_fota_fixture(
196+
run_fota(
197+
dut_fota,
198+
hex_file,
197199
bundle_id=DELTA_MFW_BUNDLEID,
198200
fota_type="delta",
199201
new_version=NEW_MFW_DELTA_VERSION
@@ -203,13 +205,14 @@ def test_delta_mfw_fota(run_fota_fixture):
203205
flash_device(os.path.abspath(MFW_202_FILEPATH))
204206

205207
@pytest.mark.slow
206-
def test_full_mfw_fota(run_fota_fixture):
208+
def test_full_mfw_fota(dut_fota, hex_file):
207209
'''
208210
Test full modem FOTA on nrf9151
209211
'''
210-
211212
try:
212-
run_fota_fixture(
213+
run_fota(
214+
dut_fota,
215+
hex_file,
213216
bundle_id=FULL_MFW_BUNDLEID,
214217
fota_type="full",
215218
new_version=MFW_202_VERSION,

tests/on_target/utils/flash_tools.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
def reset_device(serial=SEGGER, reset_kind="RESET_SYSTEM"):
1818
logger.info(f"Resetting device, segger: {serial}")
1919
try:
20-
result = subprocess.run(
20+
subprocess.run(
2121
['nrfutil', 'device', 'reset', '--serial-number', serial, '--reset-kind', reset_kind],
2222
check=True,
2323
text=True,
@@ -37,7 +37,7 @@ def flash_device(hexfile, serial=SEGGER, extra_args=[]):
3737
raise ValueError("hexfile cannot be None")
3838
logger.info(f"Flashing device, segger: {serial}, firmware: {hexfile}")
3939
try:
40-
result = subprocess.run(['nrfutil', 'device', 'program', *extra_args, '--firmware', hexfile, '--serial-number', serial], check=True, text=True, capture_output=True)
40+
subprocess.run(['nrfutil', 'device', 'program', *extra_args, '--firmware', hexfile, '--serial-number', serial], check=True, text=True, capture_output=True)
4141
logger.info("Command completed successfully.")
4242
except subprocess.CalledProcessError as e:
4343
# Handle errors in the command execution

0 commit comments

Comments
 (0)