TEST_LAUNCHER requires 3.29 and my version in /usr/bin. I downloaded the newest cmake and installed in /usr/local/bin.
/usr/local/bin/cmake --version
cmake version 4.1.0
CMake suite maintained and supported by Kitware (kitware.com/cmake).
My CMakeLists.txt file looks like this.
add_executable(units_pressure_test units_pressure_test.cpp)
target_link_libraries(units_pressure_test PRIVATE
pressure_units
gtest_main
gtest
fmt)
include_directories(
${CMAKE_SOURCE_DIR}/src/lib
)
target_compile_options(units_pressure_test PRIVATE -std=c++23)
set_property(TARGET units_pressure_test PROPERTY TEST_LAUNCHER
${CMAKE_SOURCE_DIR}/cmake/run_test_remotely.sh
)
add_test(
NAME DebugUnitsPressureTests
CONFIGURATIONS Debug Release
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/units_pressure_test
--gtest_output=json:units_pressure_test_results.json
--gtest_filter=UnitsPressureTest.*
)
I added the CONFIGURATIONS because I saw this TEST_LAUNCHER documentation. I guessed at what the values might be. Maybe they are wrong?
When I run the test from VScode’s TESTING Explorer it errors:
[proc] Executing command: /usr/local/bin/ctest -j16 -C Debug -T test --output-on-failure -R ^DebugUnitsPressureTests$
[ctest] Cannot find file: /home/chrisk/Projects/RaspberryPi/WS/build/DartConfiguration.tcl
[ctest] Cannot find file: /home/chrisk/Projects/RaspberryPi/WS/build/DartConfiguration.tcl
[ctest] Test project /home/chrisk/Projects/RaspberryPi/WS/build
[ctest] Start 2: DebugUnitsPressureTests
[ctest] 1/1 Test #2: DebugUnitsPressureTests ..........***Failed 0.01 sec
[ctest] /home/chrisk/Projects/RaspberryPi/WS/build/src/lib/qw/units/pressure/tests/units_pressure_test: 1: Syntax error: word unexpected (expecting ")")
[ctest]
[ctest]
[ctest] 0% tests passed, 1 tests failed out of 1
[ctest]
[ctest] Total Test time (real) = 0.01 sec
[ctest]
[ctest] The following tests FAILED:
[ctest] 2 - DebugUnitsPressureTests (Failed)
[proc] The command: /usr/local/bin/ctest -j16 -C Debug -T test --output-on-failure -R ^DebugUnitsPressureTests$ exited with code: 8
[ctest] CTest finished with return code 8
It does seem to be running /usr/local/bin/ctest so it is running version 4.1.0.
Right now the run_test_remotely.sh just writes some info to a file so I can see if it even gets run.
#!/usr/bin/bash
set -e
echo Hello > /tmp/test.out
exit
TARGET_HOST="chris@qwtest.local"
TARGET_DIR="/tmp/cmake_test"
REMOTE_BINARY="$TARGET_DIR/$(basename "$1")"
# 1. Copy binary to remote
ssh "$TARGET_HOST" "mkdir -p $TARGET_DIR"
scp "$1" "$TARGET_HOST:$REMOTE_BINARY"
# 2. Shift script args so remaining are test arguments
shift
# 3. Run binary on remote and forward stdout/stderr
ssh "$TARGET_HOST" "$REMOTE_BINARY" "$@"
exit 0
The /tmp/test.out file never gets created. So, it seems that script is not getting run. It looks like it is running units_pressure_test locally. That won’t work since it is for a different architecture.
What am I doing wrong?
Thanks
Chris