Merge topic 'fix-ctest-timeout-regression' into release-3.27

0e8584c89c CTest: Fix regression in calculating test timeout

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8647
This commit is contained in:
Brad King 2023-07-25 13:20:59 +00:00 committed by Kitware Robot
commit 1e085cbff7
3 changed files with 18 additions and 3 deletions

View File

@ -758,11 +758,13 @@ bool cmCTestRunTest::ForkProcess()
}
// An explicit TIMEOUT=0 test property means "no timeout".
if (timeout && *timeout == std::chrono::duration<double>::zero()) {
timeout = cm::nullopt;
if (timeout) {
if (*timeout == std::chrono::duration<double>::zero()) {
timeout = cm::nullopt;
}
} else {
// Check --timeout.
if (!timeout && this->CTest->GetGlobalTimeout() > cmDuration::zero()) {
if (this->CTest->GetGlobalTimeout() > cmDuration::zero()) {
timeout = this->CTest->GetGlobalTimeout();
}

View File

@ -0,0 +1,6 @@
Test project [^
]*/Tests/RunCMake/CTestTimeout/PropertyOverridesScript-build
Start 1: TestTimeout
1/1 Test #1: TestTimeout ...................... Passed +[1-9][0-9.]* sec
+
100% tests passed, 0 tests failed out of 1

View File

@ -87,3 +87,10 @@ block()
set(CASE_TEST_PREFIX_CODE "set(CTEST_TEST_TIMEOUT 2)")
run_ctest_timeout(ZeroOverridesVar)
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 10)\n")
run_ctest_timeout(PropertyOverridesScript)
endblock()