-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds location tests for Wi-Fi and GNSS. GNSS not active yet. Signed-off-by: David Dilner <[email protected]>
- Loading branch information
Showing
3 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -211,6 +211,16 @@ jobs: | |
NRF91_CUSTOM_APP_ZIP: artifacts/usb_uart_bridge_app.zip | ||
LOG_FILENAME: oob_conn_bridge_test_log | ||
|
||
- name: Run Wi-Fi location tests | ||
working-directory: thingy91x-oob/tests/on_target | ||
run: | | ||
mkdir -p results | ||
pytest -s -v -m "dut1 and wifi" \ | ||
--junit-xml=results/test-results-wifi-location.xml \ | ||
tests | ||
env: | ||
SEGGER: ${{ secrets.SEGGER_DUT_1 }} | ||
|
||
- name: Results | ||
if: always() | ||
uses: pmeier/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
########################################################################################## | ||
# Copyright (c) 2024 Nordic Semiconductor | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
########################################################################################## | ||
|
||
import pytest | ||
import time | ||
import os | ||
import re | ||
from utils.flash_tools import flash_device, reset_device | ||
import sys | ||
sys.path.append(os.getcwd()) | ||
from utils.logger import get_logger | ||
|
||
logger = get_logger() | ||
|
||
@pytest.mark.wifi | ||
@pytest.mark.dut1 | ||
def test_wifi_location(t91x_board, hex_file): | ||
run_location(t91x_board, hex_file, location_method="Wi-Fi") | ||
|
||
@pytest.mark.gnss | ||
def test_gnss_location(t91x_board, hex_file): | ||
run_location(t91x_board, hex_file, location_method="GNSS") | ||
|
||
def run_location(t91x_board, hex_file, location_method): | ||
flash_device(os.path.abspath(hex_file)) | ||
time.sleep(5) | ||
t91x_board.uart.xfactoryreset() | ||
patterns_cloud_connection = [ | ||
"Network connectivity established", | ||
"Connected to Cloud" | ||
] | ||
patterns_location = [ | ||
f"location_core_location_get_pos: Requesting location with '{location_method}' method", | ||
f"location: LOCATION_REQ_MODE_ALL: acquired location using '{location_method}'", | ||
"location_event_handler: Got location: lat:", | ||
"blocked_run: Location search done",] | ||
|
||
# Cloud connection | ||
t91x_board.uart.flush() | ||
reset_device() | ||
t91x_board.uart.wait_for_str(patterns_cloud_connection, timeout=60) | ||
|
||
# Location | ||
t91x_board.uart.wait_for_str(patterns_location, timeout=180) | ||
|
||
# Extract coordinates from UART output | ||
location_pattern = re.compile(r"location_event_handler: Got location: lat: ([\d.]+), lon: ([\d.]+), acc: ([\d.]+)") | ||
match = location_pattern.search(t91x_board.uart.log) | ||
assert match, "Failed to extract coordinates from UART output" | ||
lat, lon, _ = match.groups() | ||
assert abs(float(lat) - 61.5) < 2 and abs(float(lon) - 10.5) < 1, \ | ||
f"Coordinates ({lat}, {lon}) are not in the same part of the world as the test servers." |