Skip to content

Commit 929836e

Browse files
committed
tests: Add nrf9151dk
Signed-off-by: Jorgen Kvalvaag <jorgen.kvalvaag@nordicsemi.no>
1 parent d530383 commit 929836e

File tree

7 files changed

+111
-92
lines changed

7 files changed

+111
-92
lines changed

.github/workflows/build.yml

+28-8
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,28 @@ jobs:
9393
fi
9494
9595
# Asset Tracker Template firmware build
96+
- name: Build thingy91x firmware
97+
working-directory: asset-tracker-template/app
98+
run: |
99+
cp overlay-memfault.conf overlay-memfault-att.conf
100+
echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ secrets.MEMFAULT_PROJECT_KEY }}\"" >> overlay-memfault-att.conf
101+
echo CONFIG_MEMFAULT_NCS_FW_VERSION_STATIC=y >> overlay-memfault-att.conf
102+
echo CONFIG_MEMFAULT_NCS_FW_VERSION=\"${{ env.VERSION }}\" >> overlay-memfault-att.conf
103+
echo CONFIG_MEMFAULT_NCS_FW_TYPE=\"${{ env.MEMFAULT_SW_TYPE }}\" >> overlay-memfault-att.conf
104+
west build -b thingy91x/nrf9151/ns -d build_thingy91x -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault-att.conf"
96105
97-
- name: Build nrf91 firmware
106+
- name: Build nrf9151dk firmware
98107
working-directory: asset-tracker-template/app
99108
run: |
100109
cp overlay-memfault.conf overlay-memfault-att.conf
101110
echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ secrets.MEMFAULT_PROJECT_KEY }}\"" >> overlay-memfault-att.conf
102111
echo CONFIG_MEMFAULT_NCS_FW_VERSION_STATIC=y >> overlay-memfault-att.conf
103112
echo CONFIG_MEMFAULT_NCS_FW_VERSION=\"${{ env.VERSION }}\" >> overlay-memfault-att.conf
104113
echo CONFIG_MEMFAULT_NCS_FW_TYPE=\"${{ env.MEMFAULT_SW_TYPE }}\" >> overlay-memfault-att.conf
105-
west build -b thingy91x/nrf9151/ns -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault-att.conf"
114+
west build -b nrf9151dk/nrf9151/ns -d build_nrf9151dk -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault-att.conf"
106115
107-
- name: Rename artifacts
108-
working-directory: asset-tracker-template/app/build
116+
- name: Rename artifacts thingy91x
117+
working-directory: asset-tracker-template/app/build_thingy91x
109118
run: |
110119
cp merged.hex asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91.hex
111120
cp app/zephyr/.config asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91.config
@@ -114,8 +123,18 @@ jobs:
114123
cp app/zephyr/zephyr.elf asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91.elf
115124
cp dfu_application.zip asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91-dfu.zip
116125
117-
- name: Create partition manager report for nRF91 firmware
118-
working-directory: asset-tracker-template/app/build
126+
- name: Rename artifacts dk
127+
working-directory: asset-tracker-template/app/build_nrf9151dk
128+
run: |
129+
cp merged.hex asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91.hex
130+
cp app/zephyr/.config asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91.config
131+
cp app/zephyr/zephyr.signed.bin asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91-update-signed.bin
132+
cp app/zephyr/zephyr.signed.hex asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91-update-signed.hex
133+
cp app/zephyr/zephyr.elf asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91.elf
134+
cp dfu_application.zip asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91-dfu.zip
135+
136+
- name: Create partition manager report for thingy91x firmware
137+
working-directory: asset-tracker-template/app/build_thingy91x
119138
run: |
120139
ninja partition_manager_report
121140
ninja partition_manager_report > pmr-nrf91-default-${{ env.VERSION }}.txt
@@ -128,11 +147,12 @@ jobs:
128147
name: firmware-att
129148
if-no-files-found: error
130149
path: |
131-
asset-tracker-template/app/build/asset-tracker-template-*.*
150+
asset-tracker-template/app/build_thingy91x/asset-tracker-template-*.*
151+
asset-tracker-template/app/build_nrf9151dk/asset-tracker-template-*.*
132152
133153
# Asset Tracker Template debug firmware build
134154

135-
- name: Build nrf91 debug firmware
155+
- name: Build thingy91x debug firmware
136156
if: ${{ inputs.build_debug }}
137157
working-directory: asset-tracker-template/app
138158
run: |

.github/workflows/target-test.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,16 @@ jobs:
4141
target_test:
4242
# This will create multiple jobs, one for each target defined in the matrix
4343
strategy:
44-
fail-fast: false # Don't fail all jobs if one fails
44+
fail-fast: false # Don't fail all jobs if one fails
4545
matrix:
46-
include:
47-
- device: cia-trd-thingy91x
48-
- device: ppk_thingy91x
49-
if: ${{ inputs.pytest_marker == '' || inputs.pytest_marker == 'no_markers_flag' || inputs.pytest_marker == 'slow' }}
46+
device: [nrf9151dk, thingy91x]
47+
# include:
48+
# - device: thingy91x
49+
# - device: ppk_thingy91x
50+
# if: ${{ inputs.pytest_marker == '' || inputs.pytest_marker == 'no_markers_flag' || inputs.pytest_marker == 'slow' }}
5051

5152
# Self-hosted runner is labeled according to the device it is linked with
52-
runs-on: ${{ matrix.device }}
53+
runs-on: cia-trd-${{ matrix.device }}
5354
name: Target Test - ${{ matrix.device }}
5455

5556
permissions:
@@ -105,7 +106,7 @@ jobs:
105106
upload-mcu-symbols \
106107
--software-type asset-tracker-template-ci \
107108
--software-version ${{ inputs.artifact_fw_version }} \
108-
asset-tracker-template-${{ inputs.artifact_fw_version }}-thingy91x-nrf91.elf
109+
build_${{ matrix.device }}/asset-tracker-template-${{ inputs.artifact_fw_version }}-${{ matrix.device }}-nrf91.elf
109110
110111
- name: Target Tests
111112
working-directory: asset-tracker-template/tests/on_target
@@ -135,6 +136,7 @@ jobs:
135136
shell: bash
136137
env:
137138
SEGGER: ${{ env.RUNNER_SERIAL_NUMBER }}
139+
DUT_DEVICE_TYPE: ${{ matrix.device }}
138140
UUID: ${{ env.UUID }}
139141
NRFCLOUD_API_KEY: ${{ secrets.NRF_CLOUD_API_KEY }}
140142
LOG_FILENAME: att_test_log

tests/on_target/tests/conftest.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
UART_ID = os.getenv('UART_ID', SEGGER)
2323
FOTADEVICE_UUID = os.getenv('UUID')
2424
NRFCLOUD_API_KEY = os.getenv('NRFCLOUD_API_KEY')
25+
DUT_DEVICE_TYPE = os.getenv('DUT_DEVICE_TYPE')
2526

2627
def get_uarts():
2728
base_path = "/dev/serial/by-id"
@@ -54,7 +55,7 @@ def pytest_runtest_logfinish(nodeid, location):
5455
logger.info(f"Finished test: {nodeid}")
5556

5657
@pytest.fixture(scope="function")
57-
def t91x_board():
58+
def dut_board():
5859
all_uarts = get_uarts()
5960
if not all_uarts:
6061
pytest.fail("No UARTs found")
@@ -70,7 +71,7 @@ def t91x_board():
7071
scan_log_for_assertions(uart_log)
7172

7273
@pytest.fixture(scope="function")
73-
def t91x_fota(t91x_board):
74+
def dut_fota(dut_board):
7475
if not NRFCLOUD_API_KEY:
7576
pytest.skip("NRFCLOUD_API_KEY environment variable not set")
7677
if not FOTADEVICE_UUID:
@@ -86,7 +87,7 @@ def t91x_fota(t91x_board):
8687

8788
yield types.SimpleNamespace(
8889
fota=fota,
89-
uart=t91x_board.uart,
90+
uart=dut_board.uart,
9091
device_id=device_id,
9192
data=data
9293
)
@@ -97,23 +98,23 @@ def t91x_fota(t91x_board):
9798

9899

99100
@pytest.fixture(scope="module")
100-
def t91x_traces(t91x_board):
101+
def dut_traces(dut_board):
101102
all_uarts = get_uarts()
102103
trace_uart_string = all_uarts[1]
103104
uart_trace = UartBinary(trace_uart_string)
104105

105106
yield types.SimpleNamespace(
106107
trace=uart_trace,
107-
uart=t91x_board.uart
108+
uart=dut_board.uart
108109
)
109110

110111
uart_trace.stop()
111112

112113
@pytest.fixture(scope="session")
113114
def hex_file():
114115
# Search for the firmware hex file in the artifacts folder
115-
artifacts_dir = "artifacts"
116-
hex_pattern = r"asset-tracker-template-[0-9a-z\.]+-thingy91x-nrf91\.hex"
116+
artifacts_dir = f"artifacts/build_{DUT_DEVICE_TYPE}"
117+
hex_pattern = f"asset-tracker-template-{r"[0-9a-z\.]+"}-{DUT_DEVICE_TYPE}-nrf91.hex"
117118

118119
for file in os.listdir(artifacts_dir):
119120
if re.match(hex_pattern, file):
@@ -124,8 +125,8 @@ def hex_file():
124125
@pytest.fixture(scope="session")
125126
def bin_file():
126127
# Search for the firmware bin file in the artifacts folder
127-
artifacts_dir = "artifacts"
128-
hex_pattern = r"asset-tracker-template-[0-9a-z\.]+-thingy91x-nrf91-update-signed\.bin"
128+
artifacts_dir = f"artifacts/build_{DUT_DEVICE_TYPE}"
129+
hex_pattern = f"asset-tracker-template-{r"[0-9a-z\.]+"}-{DUT_DEVICE_TYPE}-nrf91-update-signed.hex"
129130

130131
for file in os.listdir(artifacts_dir):
131132
if re.match(hex_pattern, file):

tests/on_target/tests/test_functional/test_fota.py

+40-43
Original file line numberDiff line numberDiff line change
@@ -46,81 +46,80 @@ def await_nrfcloud(func, expected, field, timeout):
4646
if expected in data:
4747
break
4848

49-
def get_appversion(t91x_fota):
50-
shadow = t91x_fota.fota.get_device(t91x_fota.device_id)
49+
def get_appversion(dut_fota):
50+
shadow = dut_fota.fota.get_device(dut_fota.device_id)
5151
return shadow["state"]["reported"]["device"]["deviceInfo"]["appVersion"]
5252

53-
def get_modemversion(t91x_fota):
54-
shadow = t91x_fota.fota.get_device(t91x_fota.device_id)
53+
def get_modemversion(dut_fota):
54+
shadow = dut_fota.fota.get_device(dut_fota.device_id)
5555
return shadow["state"]["reported"]["device"]["deviceInfo"]["modemFirmware"]
5656

57-
def run_fota_resumption(t91x_fota, fota_type):
57+
def run_fota_resumption(dut_fota, fota_type):
5858
timeout_50_percent= APP_FOTA_TIMEOUT/2
59-
t91x_fota.uart.wait_for_str("50%", timeout=timeout_50_percent)
59+
dut_fota.uart.wait_for_str("50%", timeout=timeout_50_percent)
6060
logger.debug(f"Testing fota resumption on disconnect for {fota_type} fota")
6161

6262
patterns_lte_offline = ["network: Network connectivity lost"]
6363
patterns_lte_normal = ["network: Network connectivity established"]
6464

6565
# LTE disconnect
66-
t91x_fota.uart.flush()
67-
t91x_fota.uart.write("zbus disconnect\r\n")
68-
t91x_fota.uart.wait_for_str(patterns_lte_offline, timeout=20)
66+
dut_fota.uart.flush()
67+
dut_fota.uart.write("zbus disconnect\r\n")
68+
dut_fota.uart.wait_for_str(patterns_lte_offline, timeout=20)
6969

7070
# LTE reconnect
71-
t91x_fota.uart.flush()
72-
t91x_fota.uart.write("zbus connect\r\n")
73-
t91x_fota.uart.wait_for_str(patterns_lte_normal, timeout=120)
74-
75-
t91x_fota.uart.wait_for_str("fota_download: Refuse fragment, restart with offset")
76-
t91x_fota.uart.wait_for_str("fota_download: Downloading from offset:")
77-
78-
def run_fota_reschedule(t91x_fota, fota_type):
79-
t91x_fota.uart.wait_for_str(f"5%", timeout=APP_FOTA_TIMEOUT)
71+
dut_fota.uart.flush()
72+
dut_fota.uart.write("zbus connect\r\n")
73+
dut_fota.uart.wait_for_str(patterns_lte_normal, timeout=120)
74+
dut_fota.uart.wait_for_str("fota_download: Refuse fragment, restart with offset")
75+
dut_fota.uart.wait_for_str("fota_download: Downloading from offset:")
76+
77+
def run_fota_reschedule(dut_fota, fota_type):
78+
dut_fota.uart.wait_for_str(f"5%", timeout=APP_FOTA_TIMEOUT)
8079
logger.debug(f"Cancelling FOTA, type: {fota_type}")
8180

82-
t91x_fota.fota.cancel_fota_job(t91x_fota.data['job_id'])
81+
dut_fota.fota.cancel_fota_job(dut_fota.data['job_id'])
8382

8483
await_nrfcloud(
85-
functools.partial(t91x_fota.fota.get_fota_status, t91x_fota.data['job_id']),
84+
functools.partial(dut_fota.fota.get_fota_status, dut_fota.data['job_id']),
8685
"CANCELLED",
8786
"FOTA status",
8887
APP_FOTA_TIMEOUT
8988
)
9089

9190
patterns_fota_cancel = ["Firmware download canceled", "state_waiting_for_poll_request_entry"]
9291

93-
t91x_fota.uart.wait_for_str(patterns_fota_cancel, timeout=180)
92+
dut_fota.uart.wait_for_str(patterns_fota_cancel, timeout=180)
9493

95-
t91x_fota.data['job_id'] = t91x_fota.fota.create_fota_job(t91x_fota.device_id, t91x_fota.data['bundle_id'])
94+
dut_fota.data['job_id'] = dut_fota.fota.create_fota_job(dut_fota.device_id, dut_fota.data['bundle_id'])
9695

97-
logger.info(f"Rescheduled FOTA Job (ID: {t91x_fota.data['job_id']})")
96+
logger.info(f"Rescheduled FOTA Job (ID: {dut_fota.data['job_id']})")
9897

9998
# Sleep a bit and trigger fota poll
10099
for i in range(3):
101100
try:
102101
time.sleep(30)
103-
t91x_fota.uart.write("zbus button_press\r\n")
104-
t91x_fota.uart.wait_for_str("nrf_cloud_fota_poll: Starting FOTA download")
102+
dut_fota.uart.write("zbus button_press\r\n")
103+
dut_fota.uart.wait_for_str("nrf_cloud_fota_poll: Starting FOTA download")
105104
break
106105
except AssertionError:
107106
continue
108107
else:
109108
raise AssertionError(f"Fota update not available after {i} attempts")
110109

111110
@pytest.fixture
112-
def run_fota_fixture(t91x_fota, hex_file, reschedule=False):
111+
def run_fota_fixture(dut_fota, hex_file, reschedule=False):
113112
def _run_fota(bundle_id="", fota_type="app", fotatimeout=APP_FOTA_TIMEOUT, new_version=TEST_APP_VERSION, reschedule=False):
114113
flash_device(os.path.abspath(hex_file))
115-
t91x_fota.uart.xfactoryreset()
116-
t91x_fota.uart.flush()
114+
dut_fota.uart.xfactoryreset()
115+
dut_fota.uart.flush()
117116
reset_device()
118-
t91x_fota.uart.wait_for_str("Connected to Cloud")
117+
dut_fota.uart.wait_for_str("Connected to Cloud")
119118

120119
time.sleep(60)
121120

122121
if fota_type == "app":
123-
bundle_id = t91x_fota.fota.upload_firmware(
122+
bundle_id = dut_fota.fota.upload_firmware(
124123
"nightly_test_app",
125124
TEST_APP_BIN,
126125
TEST_APP_VERSION,
@@ -130,39 +129,37 @@ def _run_fota(bundle_id="", fota_type="app", fotatimeout=APP_FOTA_TIMEOUT, new_v
130129
logger.info(f"Uploaded file {TEST_APP_BIN}: bundleId: {bundle_id}")
131130

132131
try:
133-
t91x_fota.data['job_id'] = t91x_fota.fota.create_fota_job(t91x_fota.device_id, bundle_id)
134-
t91x_fota.data['bundle_id'] = bundle_id
132+
dut_fota.data['job_id'] = dut_fota.fota.create_fota_job(dut_fota.device_id, bundle_id)
133+
dut_fota.data['bundle_id'] = bundle_id
135134
except NRFCloudFOTAError as e:
136135
pytest.skip(f"FOTA create_job REST API error: {e}")
137-
logger.info(f"Created FOTA Job (ID: {t91x_fota.data['job_id']})")
136+
logger.info(f"Created FOTA Job (ID: {dut_fota.data['job_id']})")
138137

139138
# Sleep a bit and trigger fota poll
140139
for i in range(3):
141140
try:
142141
time.sleep(10)
143-
t91x_fota.uart.write("zbus button_press\r\n")
144-
t91x_fota.uart.wait_for_str("nrf_cloud_fota_poll: Starting FOTA download")
142+
dut_fota.uart.write("zbus button_press\r\n")
143+
dut_fota.uart.wait_for_str("nrf_cloud_fota_poll: Starting FOTA download")
145144
break
146145
except AssertionError:
147146
continue
148147
else:
149148
raise AssertionError(f"Fota update not available after {i} attempts")
150149

151150
if reschedule:
152-
run_fota_reschedule(t91x_fota, fota_type)
151+
run_fota_reschedule(dut_fota, fota_type)
153152

154153
if fota_type == "app":
155-
run_fota_resumption(t91x_fota, "app")
156-
154+
run_fota_resumption(dut_fota, "app")
157155
await_nrfcloud(
158-
functools.partial(t91x_fota.fota.get_fota_status, t91x_fota.data['job_id']),
156+
functools.partial(dut_fota.fota.get_fota_status, dut_fota.data['job_id']),
159157
"IN_PROGRESS",
160158
"FOTA status",
161159
fotatimeout
162160
)
163-
164161
await_nrfcloud(
165-
functools.partial(t91x_fota.fota.get_fota_status, t91x_fota.data['job_id']),
162+
functools.partial(dut_fota.fota.get_fota_status, dut_fota.data['job_id']),
166163
"COMPLETED",
167164
"FOTA status",
168165
fotatimeout
@@ -171,14 +168,14 @@ def _run_fota(bundle_id="", fota_type="app", fotatimeout=APP_FOTA_TIMEOUT, new_v
171168
try:
172169
if fota_type == "app":
173170
await_nrfcloud(
174-
functools.partial(get_appversion, t91x_fota),
171+
functools.partial(get_appversion, dut_fota),
175172
new_version,
176173
"appVersion",
177174
DEVICE_MSG_TIMEOUT
178175
)
179176
else:
180177
await_nrfcloud(
181-
functools.partial(get_modemversion, t91x_fota),
178+
functools.partial(get_modemversion, dut_fota),
182179
new_version,
183180
"modemFirmware",
184181
DEVICE_MSG_TIMEOUT

tests/on_target/tests/test_functional/test_memfault.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def timestamp(event):
4444
)
4545

4646

47-
def test_memfault(t91x_board, hex_file):
47+
def test_memfault(dut_board, hex_file):
4848
# Save timestamp of latest coredump
4949
coredumps = get_latest_coredump_traces(IMEI)
5050
logger.debug(f"Found coredumps: {coredumps}")
@@ -53,15 +53,15 @@ def test_memfault(t91x_board, hex_file):
5353

5454

5555
flash_device(os.path.abspath(hex_file))
56-
t91x_board.uart.xfactoryreset()
57-
t91x_board.uart.flush()
56+
dut_board.uart.xfactoryreset()
57+
dut_board.uart.flush()
5858
reset_device()
59-
t91x_board.uart.wait_for_str("Connected to Cloud", timeout=120)
59+
dut_board.uart.wait_for_str("Connected to Cloud", timeout=120)
6060

6161
time.sleep(10)
6262

6363
# Trigger usage fault to generate coredump
64-
t91x_board.uart.write("mflt test usagefault\r\n")
64+
dut_board.uart.write("mflt test usagefault\r\n")
6565

6666
# Wait for upload to be reported to memfault api
6767
start = time.time()
@@ -80,5 +80,4 @@ def test_memfault(t91x_board, hex_file):
8080
if timestamp(coredumps[0]) > timestamp_old_coredump:
8181
break
8282
else:
83-
raise RuntimeError(f"No new coredump observed")
84-
83+
raise RuntimeError("No new coredump observed")

0 commit comments

Comments
 (0)