[4.0.0 rc2] - "There was an error running ctest to determine available test executables"

Brief Issue Summary

Currently getting this error when running tests via the microsoft/vscode-cmake-tools extension tool:

[proc] The command: /../ctest --show-only=json-v1 -j14 -C Debug -T test --output-on-failure exited with code: 8
[ctest] There was an error running ctest to determine available test executables

When I run it manually I get the following:

ctest --show-only=json-v1 -j14 -C Debug -T test --output-on-failure --test-dir build
CMake Error in .:
  ctest_test Failed to change working directory to "": No such file or
  directory

So this isn’t an issue with the extension.

Running ctest -C Debug --output-on-failure --test-dir build works fine. So it’s one of the above CLI options causing an issue with the working directory (I think).

I believe I’ve triaged it down to -T test. Adding that to my ctest command causes the error.

$ ctest -j14 -C Debug --output-on-failure --test-dir build
Test project /home/juaramos/projects/glslang/build
    Start 1: glslang-testsuite
    Start 2: glslang-gtests
1/2 Test #2: glslang-gtests ...................   Passed   15.46 sec
2/2 Test #1: glslang-testsuite ................   Passed   28.28 sec

100% tests passed, 0 tests failed out of 2

Total Test time (real) =  28.28 sec
$ ctest -j14 -C Debug --output-on-failure --test-dir build -T test
Cannot find file: /home/juaramos/projects/glslang/build/DartConfiguration.tcl
Cannot find file: /home/juaramos/projects/glslang/build/DartConfiguration.tcl
CTEST_BINARY_DIRECTORY not set
CMake Error in .:
  ctest_test Failed to change working directory to "": No such file or
  directory

$ ctest --show-only=json-v1 -j14 -C Debug --output-on-failure --test-dir build -T test
CMake Error in .:
  ctest_test Failed to change working directory to "": No such file or
  directory

Additional Information

I was using CMake version 3.22.1 which worked fine.

Thanks for trying the release candidate!

I reproduced that with glslang and narrowed it to a simple test case.

I’ve opened CMake Issue 26743 for this.

1 Like

@buildSystemPerson what is the use case for passing -T test to ctest for glslang? The ctest -T <action> option is part of the Dashboard Client Mode, which is normally used in combination with include(CTest) in the project, which would populate DartConfiguration.tcl and avoid this error. If that is not the intention, one should avoid passing -T test in the first place.

I’m not sure what the use case is. But the vscode cmake tools extension is using it:

I’m not exactly sure what for though.

I’ve made a PR removing this from the vscode cmake extension:

This also fixes a long standing error message for many users who don’t include the ctest CMake module.
Cannot find file: D:/Projects/cpp/bound/build/DartConfiguration.tcl.