1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 10:47:59 +08:00

ctest: Restore default test timeout for command-line -T Test step

In commit 774fcbe49c (CTest: Base command line mode on top of scripting
commands, 2024-10-05, v4.0.0-rc1~653^2) the implementation of this step
was converted to use `ctest_test` internally.  That command has its own
default test timeout of 600s if the ctest "TimeOut" configuration value
is not set.  If "TimeOut" is not set then default it to our previous
command-line mode default test timeout.

Fixes: #27139
This commit is contained in:
Brad King
2025-08-18 14:10:17 -04:00
parent 8745e6308e
commit 9dc3edbba8
4 changed files with 29 additions and 0 deletions

View File

@@ -717,6 +717,13 @@ int cmCTest::ProcessSteps()
this->UpdateCTestConfiguration();
this->BlockTestErrorDiagnostics();
if (this->GetCTestConfiguration("TimeOut").empty()) {
this->SetCTestConfiguration(
"TimeOut",
std::to_string(cmDurationTo<unsigned int>(cmCTest::MaxDuration())),
true);
}
int res = 0;
cmCTestScriptHandler script(this);
script.CreateCMake();
@@ -3260,6 +3267,9 @@ void cmCTest::SetCMakeVariables(cmMakefile& mf)
set("CTEST_BUILD_COMMAND", "MakeCommand");
set("CTEST_USE_LAUNCHERS", "UseLaunchers");
// CTest Test Step
set("CTEST_TEST_TIMEOUT", "TimeOut");
// CTest Coverage Step
set("CTEST_COVERAGE_COMMAND", "CoverageCommand");
set("CTEST_COVERAGE_EXTRA_FLAGS", "CoverageExtraFlags");

View File

@@ -630,6 +630,21 @@ run_output_junit()
run_cmake_command(invalid-ctest-argument ${CMAKE_CTEST_COMMAND} --not-a-valid-ctest-argument)
block()
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TimeoutDefault)
set(RunCMake_TEST_NO_CLEAN 1)
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
file(WRITE "${RunCMake_TEST_BINARY_DIR}/DartConfiguration.tcl" "
BuildDirectory: ${RunCMake_TEST_BINARY_DIR}
")
file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
add_test(test1 \"${CMAKE_COMMAND}\" -E true)
")
run_cmake_command(TimeoutDefault ${CMAKE_CTEST_COMMAND} -V)
run_cmake_command(TimeoutDefault-T-Test ${CMAKE_CTEST_COMMAND} -V -T Test)
endblock()
if(WIN32)
block()
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TimeoutSignalWindows)

View File

@@ -0,0 +1,2 @@
1: Test timeout computed to be: 10000000
1/1 Test #1: test1[ ]

View File

@@ -0,0 +1,2 @@
1: Test timeout computed to be: 10000000
1/1 Test #1: test1[ ]