diff options
author | Brad King <brad.king@kitware.com> | 2023-09-29 13:00:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-09-29 13:25:01 (GMT) |
commit | d267c128a232e9beb99576f901ee1b9291ba1480 (patch) | |
tree | b017f5ccc4a31087bc41a8d57ce1a7fe13ec1e1f | |
parent | dd779a4bc2f1b845a03b00885cd33ed2cc8adac3 (diff) | |
download | CMake-d267c128a232e9beb99576f901ee1b9291ba1480.zip CMake-d267c128a232e9beb99576f901ee1b9291ba1480.tar.gz CMake-d267c128a232e9beb99576f901ee1b9291ba1480.tar.bz2 |
ctest: Restore support for --timeout values higher than default test timeout
Since refactoring in commit 0a5aeaf302 (cmCTestRunTest: Consolidate test
timeout selection logic, 2023-05-04, v3.27.0-rc1~120^2) we accidentally
truncate `--timeout` values to ctest's default `TimeOut`. Fix the
logic to prefer the flag whenever the `TIMEOUT` property is not set.
In combination with the prior refactoring, this also fixes a bug that
caused `--timeout` values of 10000000 seconds or more to be ignored.
Fixes: #23979
-rw-r--r-- | Help/manual/ctest.1.rst | 3 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 11 | ||||
-rw-r--r-- | Tests/RunCMake/CTestTimeout/FlagOverridesVar-stdout.txt | 6 | ||||
-rw-r--r-- | Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake | 7 |
4 files changed, 21 insertions, 6 deletions
diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index 994ae47..5c3889e 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -1230,7 +1230,8 @@ Configuration settings include: ``TimeOut`` The default timeout for each test if not specified by the - :prop_test:`TIMEOUT` test property. + :prop_test:`TIMEOUT` test property or the + :option:`--timeout <ctest --timeout>` flag. * `CTest Script`_ variable: :variable:`CTEST_TEST_TIMEOUT` * :module:`CTest` module variable: ``DART_TESTING_TIMEOUT`` diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 563439a..19e505f 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -768,11 +768,12 @@ bool cmCTestRunTest::ForkProcess() timeout = this->CTest->GetGlobalTimeout(); } - // Check CTEST_TEST_TIMEOUT. - cmDuration ctestTestTimeout = this->CTest->GetTimeOut(); - if (ctestTestTimeout > cmDuration::zero() && - (!timeout || ctestTestTimeout < *timeout)) { - timeout = ctestTestTimeout; + if (!timeout) { + // Check CTEST_TEST_TIMEOUT. + cmDuration ctestTestTimeout = this->CTest->GetTimeOut(); + if (ctestTestTimeout > cmDuration::zero()) { + timeout = ctestTestTimeout; + } } } diff --git a/Tests/RunCMake/CTestTimeout/FlagOverridesVar-stdout.txt b/Tests/RunCMake/CTestTimeout/FlagOverridesVar-stdout.txt new file mode 100644 index 0000000..f580871 --- /dev/null +++ b/Tests/RunCMake/CTestTimeout/FlagOverridesVar-stdout.txt @@ -0,0 +1,6 @@ +Test project [^ +]*/Tests/RunCMake/CTestTimeout/FlagOverridesVar-build + Start 1: TestTimeout +1/1 Test #1: TestTimeout ...................... Passed +[1-9][0-9.]* sec ++ +100% tests passed, 0 tests failed out of 1 diff --git a/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake b/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake index e9ecc5f..470bbd8 100644 --- a/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake @@ -94,3 +94,10 @@ block() set(CASE_CMAKELISTS_SUFFIX_CODE "set_property(TEST TestTimeout PROPERTY TIMEOUT 10)\n") run_ctest_timeout(PropertyOverridesVar) endblock() + +block() + set(TIMEOUT 4) + set(CASE_TEST_PREFIX_CODE "set(CTEST_TEST_TIMEOUT 2)") + set(CASE_CMAKELISTS_SUFFIX_CODE "set_property(TEST TestTimeout PROPERTY TIMEOUT)\n") + run_ctest_timeout(FlagOverridesVar --timeout 10000001) +endblock() |