Skip to content

Commit 1d6eade

Browse files
workflows: target-test: enable ppk test
Re-enable ppk test. Signed-off-by: Giacomo Dematteis <giacomo.dematteis@nordicsemi.no>
1 parent b1c169e commit 1d6eade

File tree

4 files changed

+24
-15
lines changed

4 files changed

+24
-15
lines changed

.github/workflows/target-test.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ jobs:
4444
fail-fast: false # Don't fail all jobs if one fails
4545
matrix:
4646
include:
47-
- device: nrf9151dk
48-
- device: thingy91x
47+
# - device: nrf9151dk
48+
# - device: thingy91x
49+
- device: ppk_thingy91x
4950

5051
# Self-hosted runner is labeled according to the device it is linked with
5152
runs-on: cia-trd-${{ matrix.device }}

tests/on_target/scripts/commit_badge.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ CSV_FILE_DEST=docs/power_measurements.csv
1515
# Check if files exist
1616
if [ ! -f $BADGE_FILE ]; then
1717
echo "Badge file not found: $BADGE_FILE"
18-
exit 1
18+
exit 0
1919
fi
2020
if [ ! -f $HTML_FILE ]; then
2121
echo "HTML file not found: $HTML_FILE"
22-
exit 1
22+
exit 0
2323
fi
2424
if [ ! -f $CSV_FILE ]; then
2525
echo "CSV file not found: $CSV_FILE"
26-
exit 1
26+
exit 0
2727
fi
2828

2929
# Configure Git

tests/on_target/tests/conftest.py

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
FOTADEVICE_UUID = os.getenv('UUID')
2424
NRFCLOUD_API_KEY = os.getenv('NRFCLOUD_API_KEY')
2525
DUT_DEVICE_TYPE = os.getenv('DUT_DEVICE_TYPE')
26+
if DUT_DEVICE_TYPE == "ppk_thingy91x":
27+
DUT_DEVICE_TYPE == "thingy91x"
28+
2629

2730
def get_uarts():
2831
base_path = "/dev/serial/by-id"

tests/on_target/tests/test_ppk/test_power.py

+15-10
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
logger = get_logger()
2323

2424
UART_TIMEOUT = 60 * 30
25-
POWER_TIMEOUT = 60 * 15
25+
POWER_TIMEOUT = 60 * 5
2626
MAX_CURRENT_PSM_UA = 10
2727
SAMPLING_INTERVAL = 0.01
2828
CSV_FILE = "power_measurements.csv"
@@ -88,7 +88,7 @@ def generate_time_series_html(csv_file, date_column, value_column, output_file="
8888
df = pd.read_csv(csv_file, parse_dates=[date_column])
8989

9090
title = "Asset Tracket Template Current Consumption Plot\n\n"
91-
note_text = "Note: application is still in development, not reaching target psm current yet"
91+
note_text = "Note: Measures are taken with PPK2"
9292
title += f"<br><span style='font-size:12px;color:gray;'>{note_text}</span>"
9393

9494
# Create an interactive Plotly line chart
@@ -130,24 +130,26 @@ def thingy91x_ppk2():
130130
else:
131131
pytest.skip("Failed to get ppk modifiers after 10 attempts")
132132

133-
ppk2_dev.set_source_voltage(3300)
134133
ppk2_dev.use_ampere_meter() # set ampere meter mode
134+
ppk2_dev.set_source_voltage(3300)
135+
ppk2_dev.toggle_DUT_power("OFF") # disable DUT power
136+
time.sleep(2)
135137
ppk2_dev.toggle_DUT_power("ON") # enable DUT power
138+
ppk2_dev.start_measuring()
136139

137140
time.sleep(10)
138141
for _ in range(10):
139142
try:
140143
all_uarts = get_uarts()
141-
logger.warning(f"momo all uarts {all_uarts}")
142144
if not all_uarts:
143145
logger.error("No UARTs found")
144146
log_uart_string = all_uarts[0]
145147
break
146148
except Exception as e:
147149
logger.warning(f"Exception: {e}")
148-
ppk2_dev.toggle_DUT_power("OFF") # disable DUT power
150+
ppk2_dev.toggle_DUT_power("OFF")
149151
time.sleep(2)
150-
ppk2_dev.toggle_DUT_power("ON") # enable DUT power
152+
ppk2_dev.toggle_DUT_power("ON")
151153
time.sleep(5)
152154
continue
153155
else:
@@ -160,6 +162,7 @@ def thingy91x_ppk2():
160162
t91x_uart.stop()
161163
recover_device(serial=SEGGER)
162164
ppk2_dev.stop_measuring()
165+
ppk2_dev.toggle_DUT_power("OFF")
163166

164167
@pytest.mark.slow
165168
def test_power(thingy91x_ppk2, hex_file):
@@ -176,10 +179,8 @@ def test_power(thingy91x_ppk2, hex_file):
176179
pytest.skip("Device unable to connect to cloud, skip ppk test")
177180

178181
# Disable UART on the device
179-
thingy91x_ppk2.t91x_uart.write("pm suspend uartuart@9000\r\n")
180-
thingy91x_ppk2.t91x_uart.write("pm suspend uartuart@8000\r\n")
181-
182-
thingy91x_ppk2.ppk2_dev.start_measuring()
182+
thingy91x_ppk2.t91x_uart.write("pm suspend uart@9000\r\n")
183+
thingy91x_ppk2.t91x_uart.write("pm suspend uart@8000\r\n")
183184

184185
start = time.time()
185186
min_rolling_average = float('inf')
@@ -235,3 +236,7 @@ def test_power(thingy91x_ppk2, hex_file):
235236
# Determine test result based on whether PSM was reached
236237
if not psm_reached:
237238
pytest.fail(f"PSM target not reached after {POWER_TIMEOUT / 60} minutes, only reached {min_rolling_average} uA")
239+
240+
def test_dummy_placeholder():
241+
''' Placeholder to suppress exit code 5, see https://github.com/pytest-dev/pytest/issues/2393 '''
242+
pass

0 commit comments

Comments
 (0)