mirror of
https://github.com/Kitware/CMake.git
synced 2026-08-04 14:50:23 +00:00
ctest: Fix TIMEOUT test property with value 0 with --timeout flag
An explicit zero TIMEOUT test property value should not be overridden by the `--timeout` flag.
This commit is contained in:
@@ -1379,7 +1379,7 @@ bool cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed,
|
|||||||
p.Cost = static_cast<float>(rand());
|
p.Cost = static_cast<float>(rand());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p.Timeout == cmDuration::zero() &&
|
if (p.Timeout == cmDuration::zero() && !p.ExplicitTimeout &&
|
||||||
this->CTest->GetGlobalTimeout() != cmDuration::zero()) {
|
this->CTest->GetGlobalTimeout() != cmDuration::zero()) {
|
||||||
p.Timeout = this->CTest->GetGlobalTimeout();
|
p.Timeout = this->CTest->GetGlobalTimeout();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ endif()
|
|||||||
function(run_ctest_timeout CASE_NAME)
|
function(run_ctest_timeout CASE_NAME)
|
||||||
configure_file(${RunCMake_SOURCE_DIR}/TestTimeout.c
|
configure_file(${RunCMake_SOURCE_DIR}/TestTimeout.c
|
||||||
${RunCMake_BINARY_DIR}/${CASE_NAME}/TestTimeout.c COPYONLY)
|
${RunCMake_BINARY_DIR}/${CASE_NAME}/TestTimeout.c COPYONLY)
|
||||||
run_ctest(${CASE_NAME})
|
run_ctest(${CASE_NAME} ${ARGN})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
run_ctest_timeout(Basic)
|
run_ctest_timeout(Basic)
|
||||||
@@ -27,6 +27,7 @@ block()
|
|||||||
# The test sleeps for 4 seconds longer than the TIMEOUT value.
|
# The test sleeps for 4 seconds longer than the TIMEOUT value.
|
||||||
# Set a default timeout to less than that so that the test will
|
# Set a default timeout to less than that so that the test will
|
||||||
# timeout if the zero TIMEOUT does not suppress it.
|
# timeout if the zero TIMEOUT does not suppress it.
|
||||||
|
run_ctest_timeout(ZeroOverridesFlag --timeout 2)
|
||||||
set(CASE_TEST_PREFIX_CODE "set(CTEST_TEST_TIMEOUT 2)")
|
set(CASE_TEST_PREFIX_CODE "set(CTEST_TEST_TIMEOUT 2)")
|
||||||
run_ctest_timeout(ZeroOverridesVar)
|
run_ctest_timeout(ZeroOverridesVar)
|
||||||
endblock()
|
endblock()
|
||||||
|
|||||||
6
Tests/RunCMake/CTestTimeout/ZeroOverridesFlag-stdout.txt
Normal file
6
Tests/RunCMake/CTestTimeout/ZeroOverridesFlag-stdout.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Test project [^
|
||||||
|
]*/Tests/RunCMake/CTestTimeout/ZeroOverridesFlag-build
|
||||||
|
Start 1: TestTimeout
|
||||||
|
1/1 Test #1: TestTimeout ...................... Passed +[1-9][0-9.]* sec
|
||||||
|
+
|
||||||
|
100% tests passed, 0 tests failed out of 1
|
||||||
Reference in New Issue
Block a user