mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 10:50:16 -06:00
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
This commit is contained in:
@@ -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``
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
6
Tests/RunCMake/CTestTimeout/FlagOverridesVar-stdout.txt
Normal file
6
Tests/RunCMake/CTestTimeout/FlagOverridesVar-stdout.txt
Normal file
@@ -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
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user