ctest: --timeout silently ignored
If I pass a value of 10,000,000 or more to ctest --timeout
then it is silently ignored, and the default value of 1500 is used instead.
I spent several hours on google trying to figure out why the --timeout
option does not work, and eventually figured it out for myself when I randomly tried a smaller number. This is incredibly frustrating because the --verbose
output does not explain at all why the "computed" test timeout is different from the specified value. I expect the timeout to be what I specify, nothing more and nothing less. If it must be different for some reason, then there should at least be a warning emitted.
Furthermore, there seems to be no way to specify a timeout of "unlimited" using ctest. If there is in fact a way, please let me know what it is, and please also put it in the documentation for other users.
$ ctest --version
ctest version 3.24.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).
$ cat main.cpp
int main() {}
$ cat CMakeLists.txt
cmake_minimum_required(VERSION 3.24.0)
project(timeout-test LANGUAGES CXX)
include(CTest)
add_executable(timeout-test main.cpp)
add_test(timeout-test timeout-test)
$ ctest --verbose --timeout 10000000
UpdateCTestConfiguration from :/home/sweemer/test/cmake/DartConfiguration.tcl
Parse Config file:/home/sweemer/test/cmake/DartConfiguration.tcl
UpdateCTestConfiguration from :/home/sweemer/test/cmake/DartConfiguration.tcl
Parse Config file:/home/sweemer/test/cmake/DartConfiguration.tcl
Test project /home/sweemer/test/cmake
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 1
Start 1: timeout-test
1: Test command: /home/sweemer/test/cmake/timeout-test
1: Working Directory: /home/sweemer/test/cmake
1: Test timeout computed to be: 1500
1/1 Test #1: timeout-test ..................... Passed 0.00 sec
100% tests passed, 0 tests failed out of 1
Total Test time (real) = 0.00 sec
$ ctest --verbose --timeout 1000000
UpdateCTestConfiguration from :/home/sweemer/test/cmake/DartConfiguration.tcl
Parse Config file:/home/sweemer/test/cmake/DartConfiguration.tcl
UpdateCTestConfiguration from :/home/sweemer/test/cmake/DartConfiguration.tcl
Parse Config file:/home/sweemer/test/cmake/DartConfiguration.tcl
Test project /home/sweemer/test/cmake
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 1
Start 1: timeout-test
1: Test command: /home/sweemer/test/cmake/timeout-test
1: Working Directory: /home/sweemer/test/cmake
1: Test timeout computed to be: 1000000
1/1 Test #1: timeout-test ..................... Passed 0.00 sec
100% tests passed, 0 tests failed out of 1
Total Test time (real) = 0.00 sec