Skip to content

Commit d3373b0

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

File tree

7 files changed

+94
-74
lines changed

7 files changed

+94
-74
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_t91x -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 t91x
117+
working-directory: asset-tracker-template/app/build_t91x
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_t91x
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_t91x/build/asset-tracker-template-*.*
151+
asset-tracker-template/app_nrf9151dk/build/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

+6-6
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@ jobs:
4242
# This will create multiple jobs, one for each target defined in the matrix
4343
strategy:
4444
matrix:
45-
# nrf9151dk not available yet
46-
device: [cia-trd-thingy91x]
45+
device: [thingy91x, nrf9151dk]
4746

4847
# Self-hosted runner is labeled according to the device it is linked with
49-
runs-on: ${{ matrix.device }}
48+
runs-on: cia-trd-${{ matrix.device }}
5049
name: Target Test - ${{ matrix.device }}
5150

5251
permissions:
@@ -102,7 +101,7 @@ jobs:
102101
upload-mcu-symbols \
103102
--software-type asset-tracker-template-ci \
104103
--software-version ${{ inputs.artifact_fw_version }} \
105-
asset-tracker-template-${{ inputs.artifact_fw_version }}-thingy91x-nrf91.elf
104+
asset-tracker-template-${{ inputs.artifact_fw_version }}-${{ matrix.device }}-nrf91.elf
106105
107106
- name: Target Tests
108107
working-directory: asset-tracker-template/tests/on_target
@@ -123,6 +122,7 @@ jobs:
123122
shell: bash
124123
env:
125124
SEGGER: ${{ env.RUNNER_SERIAL_NUMBER }}
125+
DUT_DEVICE_TYPE: ${{ matrix.device }}
126126
UUID: ${{ env.UUID }}
127127
NRFCLOUD_API_KEY: ${{ secrets.NRF_CLOUD_API_KEY }}
128128
LOG_FILENAME: att_test_log
@@ -145,7 +145,7 @@ jobs:
145145
uses: actions/upload-artifact@v4
146146
id: artifact-report
147147
with:
148-
name: test-report
148+
name: test-report-${{ matrix.device }}
149149
path: |
150150
asset-tracker-template/tests/on_target/results/*.html
151151
@@ -154,6 +154,6 @@ jobs:
154154
uses: actions/upload-artifact@v4
155155
id: artifact-upload-test-logs
156156
with:
157-
name: test-logs
157+
name: test-logs-${{ matrix.device }}
158158
path: |
159159
asset-tracker-template/tests/on_target/outcomes/logs/*.txt

tests/on_target/tests/conftest.py

+8-7
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,14 +98,14 @@ 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()
@@ -113,7 +114,7 @@ def t91x_traces(t91x_board):
113114
def hex_file():
114115
# Search for the firmware hex file in the artifacts folder
115116
artifacts_dir = "artifacts"
116-
hex_pattern = r"asset-tracker-template-[0-9a-z\.]+-thingy91x-nrf91\.hex"
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):
@@ -125,7 +126,7 @@ def hex_file():
125126
def bin_file():
126127
# Search for the firmware bin file in the artifacts folder
127128
artifacts_dir = "artifacts"
128-
hex_pattern = r"asset-tracker-template-[0-9a-z\.]+-thingy91x-nrf91-update-signed\.bin"
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

+28-28
Original file line numberDiff line numberDiff line change
@@ -47,46 +47,46 @@ def await_nrfcloud(func, expected, field, timeout):
4747
if expected in data:
4848
break
4949

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

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

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

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

6666
# LTE disconnect
67-
t91x_fota.uart.flush()
68-
t91x_fota.uart.write("lte offline\r\n")
69-
t91x_fota.uart.wait_for_str(patterns_lte_offline, timeout=20)
67+
dut_fota.uart.flush()
68+
dut_fota.uart.write("lte offline\r\n")
69+
dut_fota.uart.wait_for_str(patterns_lte_offline, timeout=20)
7070

7171
# LTE reconnect
72-
t91x_fota.uart.flush()
73-
t91x_fota.uart.write("lte normal\r\n")
74-
t91x_fota.uart.wait_for_str(patterns_lte_normal, timeout=120)
72+
dut_fota.uart.flush()
73+
dut_fota.uart.write("lte normal\r\n")
74+
dut_fota.uart.wait_for_str(patterns_lte_normal, timeout=120)
7575

76-
t91x_fota.uart.wait_for_str("fota_download: Refuse fragment, restart with offset")
77-
t91x_fota.uart.wait_for_str("fota_download: Downloading from offset:")
76+
dut_fota.uart.wait_for_str("fota_download: Refuse fragment, restart with offset")
77+
dut_fota.uart.wait_for_str("fota_download: Downloading from offset:")
7878

7979
@pytest.fixture
80-
def run_fota_fixture(t91x_fota, hex_file):
80+
def run_fota_fixture(dut_fota, hex_file):
8181
def _run_fota(bundle_id="", fota_type="app", fotatimeout=APP_FOTA_TIMEOUT, new_version=TEST_APP_VERSION):
8282
flash_device(os.path.abspath(hex_file))
83-
t91x_fota.uart.xfactoryreset()
84-
t91x_fota.uart.flush()
83+
dut_fota.uart.xfactoryreset()
84+
dut_fota.uart.flush()
8585
reset_device()
86-
t91x_fota.uart.wait_for_str("Connected to Cloud")
86+
dut_fota.uart.wait_for_str("Connected to Cloud")
8787

8888
if fota_type == "app":
89-
bundle_id = t91x_fota.fota.upload_firmware(
89+
bundle_id = dut_fota.fota.upload_firmware(
9090
"nightly_test_app",
9191
TEST_APP_BIN,
9292
TEST_APP_VERSION,
@@ -96,44 +96,44 @@ def _run_fota(bundle_id="", fota_type="app", fotatimeout=APP_FOTA_TIMEOUT, new_v
9696
logger.info(f"Uploaded file {TEST_APP_BIN}: bundleId: {bundle_id}")
9797

9898
try:
99-
t91x_fota.data['job_id'] = t91x_fota.fota.create_fota_job(t91x_fota.device_id, bundle_id)
100-
t91x_fota.data['bundle_id'] = bundle_id
99+
dut_fota.data['job_id'] = dut_fota.fota.create_fota_job(dut_fota.device_id, bundle_id)
100+
dut_fota.data['bundle_id'] = bundle_id
101101
except NRFCloudFOTAError as e:
102102
pytest.skip(f"FOTA create_job REST API error: {e}")
103-
logger.info(f"Created FOTA Job (ID: {t91x_fota.data['job_id']})")
103+
logger.info(f"Created FOTA Job (ID: {dut_fota.data['job_id']})")
104104

105105
# Sleep a bit and trigger fota poll
106106
for i in range(3):
107107
try:
108108
time.sleep(30)
109-
t91x_fota.uart.write("zbus button_press\r\n")
110-
t91x_fota.uart.wait_for_str("nrf_cloud_fota_poll: Starting FOTA download")
109+
dut_fota.uart.write("zbus button_press\r\n")
110+
dut_fota.uart.wait_for_str("nrf_cloud_fota_poll: Starting FOTA download")
111111
break
112112
except AssertionError:
113113
continue
114114
else:
115115
raise AssertionError(f"Fota update not available after {i} attempts")
116116

117117
# if fota_type == "app":
118-
# run_fota_resumption(t91x_fota, "app")
118+
# run_fota_resumption(dut_fota, "app")
119119

120120
await_nrfcloud(
121-
functools.partial(t91x_fota.fota.get_fota_status, t91x_fota.data['job_id']),
121+
functools.partial(dut_fota.fota.get_fota_status, dut_fota.data['job_id']),
122122
"COMPLETED",
123123
"FOTA status",
124124
fotatimeout
125125
)
126126
try:
127127
if fota_type == "app":
128128
await_nrfcloud(
129-
functools.partial(get_appversion, t91x_fota),
129+
functools.partial(get_appversion, dut_fota),
130130
new_version,
131131
"appVersion",
132132
DEVICE_MSG_TIMEOUT
133133
)
134134
else:
135135
await_nrfcloud(
136-
functools.partial(get_modemversion, t91x_fota),
136+
functools.partial(get_modemversion, dut_fota),
137137
new_version,
138138
"modemFirmware",
139139
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")

tests/on_target/tests/test_functional/test_sampling.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
logger = get_logger()
1616

17-
def test_sampling(t91x_board, hex_file):
17+
def test_sampling(dut_board, hex_file):
1818
flash_device(os.path.abspath(hex_file))
19-
t91x_board.uart.xfactoryreset()
19+
dut_board.uart.xfactoryreset()
2020
patterns_cloud_connection = [
2121
"Network connectivity established",
2222
"Connected to Cloud"
@@ -39,14 +39,14 @@ def test_sampling(t91x_board, hex_file):
3939
]
4040

4141
# Cloud connection
42-
t91x_board.uart.flush()
42+
dut_board.uart.flush()
4343
reset_device()
4444

4545
# Sampling
46-
t91x_board.uart.wait_for_str(pattern_list, timeout=120)
46+
dut_board.uart.wait_for_str(pattern_list, timeout=120)
4747

4848
# Extract coordinates from UART output
49-
values = t91x_board.uart.extract_value( \
49+
values = dut_board.uart.extract_value( \
5050
r"location_event_handler: Got location: lat: ([\d.]+), lon: ([\d.]+), acc: ([\d.]+), method: Wi-Fi")
5151
assert values
5252

0 commit comments

Comments
 (0)