From dd779a4bc2f1b845a03b00885cd33ed2cc8adac3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 29 Sep 2023 08:54:51 -0400 Subject: Tests: Clarify RunCMake.CTestTimeout case name --- Tests/RunCMake/CTestTimeout/PropertyOverridesScript-stdout.txt | 6 ------ Tests/RunCMake/CTestTimeout/PropertyOverridesVar-stdout.txt | 6 ++++++ Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) delete mode 100644 Tests/RunCMake/CTestTimeout/PropertyOverridesScript-stdout.txt create mode 100644 Tests/RunCMake/CTestTimeout/PropertyOverridesVar-stdout.txt diff --git a/Tests/RunCMake/CTestTimeout/PropertyOverridesScript-stdout.txt b/Tests/RunCMake/CTestTimeout/PropertyOverridesScript-stdout.txt deleted file mode 100644 index 6e46485..0000000 --- a/Tests/RunCMake/CTestTimeout/PropertyOverridesScript-stdout.txt +++ /dev/null @@ -1,6 +0,0 @@ -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 diff --git a/Tests/RunCMake/CTestTimeout/PropertyOverridesVar-stdout.txt b/Tests/RunCMake/CTestTimeout/PropertyOverridesVar-stdout.txt new file mode 100644 index 0000000..aeeb3c9 --- /dev/null +++ b/Tests/RunCMake/CTestTimeout/PropertyOverridesVar-stdout.txt @@ -0,0 +1,6 @@ +Test project [^ +]*/Tests/RunCMake/CTestTimeout/PropertyOverridesVar-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 2f9eda1..e9ecc5f 100644 --- a/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake @@ -92,5 +92,5 @@ 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) + run_ctest_timeout(PropertyOverridesVar) endblock() -- cgit v0.12 From d267c128a232e9beb99576f901ee1b9291ba1480 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 29 Sep 2023 09:00:30 -0400 Subject: 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 --- Help/manual/ctest.1.rst | 3 ++- Source/CTest/cmCTestRunTest.cxx | 11 ++++++----- Tests/RunCMake/CTestTimeout/FlagOverridesVar-stdout.txt | 6 ++++++ Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake | 7 +++++++ 4 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 Tests/RunCMake/CTestTimeout/FlagOverridesVar-stdout.txt 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 ` 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() -- cgit v0.12