CI(pico-sensor): tunnel ID can now be set directly in the pipeline

This commit is contained in:
SylvanArnold
2025-06-04 09:48:11 +02:00
parent 1d05424721
commit 2a5b481d66
2 changed files with 14 additions and 3 deletions

View File

@@ -23,9 +23,11 @@ pico-sensor-docker-build:
pico-sensor-test: pico-sensor-test:
stage: test stage: test
image: registry.forge.hefr.ch/team-raclette/project-softweng/pico-sensor:latest image: registry.forge.hefr.ch/team-raclette/project-softweng/pico-sensor:latest
variables:
TUNNEL_ID: "801000372" # Tunnel ID to reach the pico-sensor device
script: script:
- cd pico-sensor - cd pico-sensor
- cmake --preset Test - cmake --preset Test -DTUNNEL_ID=$TUNNEL_ID
- cmake --build --preset app-test - cmake --build --preset app-test
- cd build/Test - cd build/Test
- ctest -T test --output-on-failure --output-junit test-results.xml -R ^DUMMY$ - ctest -T test --output-on-failure --output-junit test-results.xml -R ^DUMMY$

View File

@@ -4,6 +4,7 @@
# Need to include CTest on every CMakeLists.txt which is going to use tests # Need to include CTest on every CMakeLists.txt which is going to use tests
include(CTest) include(CTest)
set(TUNNEL_ID "" CACHE STRING "Tunnel ID for JRun") # Default is empty
set(THIS_LIBRARY_NAME srcTestsLib) set(THIS_LIBRARY_NAME srcTestsLib)
@@ -33,9 +34,17 @@ target_include_directories(
PUBLIC PUBLIC
. .
) )
# Add tunnel ID if provided by user during cmake command execution
if(TUNNEL_ID)
set(JRUN_IP_ARG --ip "tunnel:${TUNNEL_ID}")
else()
set(JRUN_IP_ARG)
endif()
################################################################################# #################################################################################
# Note: --pc off --sp off are needed, if application runs from the ROM bootloader, might add --verbose # Note: --pc off --sp off are needed, if application runs from the ROM bootloader, might add --verbose
set (JRUN_CTEST_COMMAND "JRun" --device RP2040_M0_0 --rtt -if SWD --pc off --sp off --ip "tunnel:801000372") set(JRUN_CTEST_COMMAND "JRun" --device RP2040_M0_0 --rtt -if SWD --pc off --sp off ${JRUN_IP_ARG})
add_test( add_test(
NAME Led NAME Led
@@ -60,5 +69,5 @@ add_test(
set_tests_properties( set_tests_properties(
Led Sensor DNS Led Sensor DNS
PROPERTIES PROPERTIES
TIMEOUT 30 TIMEOUT 50
) )