# Having trouble getting TEST\_LAUNCHER to work

**URL:** <https://discourse.cmake.org/t/having-trouble-getting-test-launcher-to-work/15093>\
**Category:** Code\
**Created:** [August 22, 2025, 2:05am UTC](https://discourse.cmake.org/t/having-trouble-getting-test-launcher-to-work/15093 "2025-08-22T02:05:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chriskot870](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/c/53a042/32.png) [@chriskot870](https://discourse.cmake.org/u/chriskot870)\
**Post date:** [August 22, 2025, 2:05am UTC](https://discourse.cmake.org/t/having-trouble-getting-test-launcher-to-work/15093/1 "2025-08-22T02:05:07Z")

</div>

TEST\_LAUNCHER requires 3.29 and my version in /usr/bin. I downloaded the newest cmake and installed in /usr/local/bin.

```auto
/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.

```auto
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](https://discourse.cmake.org/t/test-launcher-documentation/14410). I guessed at what the values might be. Maybe they are wrong?

When I run the test from VScode’s TESTING Explorer it errors:

```auto
[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.

```auto
#!/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

---

<div class="post-metadata">

**Author:** ![Angew](https://discourse.cmake.org/user_avatar/discourse.cmake.org/angew/32/229_2.png) [@Angew](https://discourse.cmake.org/u/Angew)\
**Post date:** [August 27, 2025, 7:57am UTC](https://discourse.cmake.org/t/having-trouble-getting-test-launcher-to-work/15093/2 "2025-08-27T07:57:57Z")

</div>

> [@chriskot870](#):
>
> `COMMAND ${CMAKE_CURRENT_BINARY_DIR}/units_pressure_test`

Use the target name instead of a path to the executable here, like this:

```auto
COMMAND units_pressure_test

```

CMake knows how to run an executable target in the test, and it will allow it to apply all of the target’s relevant properties (such as `TEST_LAUNCHER`).

If you use a path instead, you’re effectively just telling CMake “run that particular executable,” without any logical link to the target.
