summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-05-04 16:25:48 -0400
committerBrad King <brad.king@kitware.com>2023-05-04 16:58:03 -0400
commit3edf7fbb418d0da1e1ef1717b35b828d2003c427 (patch)
tree707f2c8f71310caec7cc3e7c43f2c31791c7c574 /Tests
parent39a20a56ddcde1eecd44b32ab0610b579a7ac4eb (diff)
downloadcmake-3edf7fbb418d0da1e1ef1717b35b828d2003c427.tar.gz
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.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CTestTimeout/ZeroOverridesFlag-stdout.txt6
2 files changed, 8 insertions, 1 deletions
diff --git a/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake b/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake
index e55ba27637..a4080e3fac 100644
--- a/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake
@@ -8,7 +8,7 @@ endif()
function(run_ctest_timeout CASE_NAME)
configure_file(${RunCMake_SOURCE_DIR}/TestTimeout.c
${RunCMake_BINARY_DIR}/${CASE_NAME}/TestTimeout.c COPYONLY)
- run_ctest(${CASE_NAME})
+ run_ctest(${CASE_NAME} ${ARGN})
endfunction()
run_ctest_timeout(Basic)
@@ -27,6 +27,7 @@ block()
# The test sleeps for 4 seconds longer than the TIMEOUT value.
# Set a default timeout to less than that so that the test will
# 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)")
run_ctest_timeout(ZeroOverridesVar)
endblock()
diff --git a/Tests/RunCMake/CTestTimeout/ZeroOverridesFlag-stdout.txt b/Tests/RunCMake/CTestTimeout/ZeroOverridesFlag-stdout.txt
new file mode 100644
index 0000000000..746bc218f3
--- /dev/null
+++ b/Tests/RunCMake/CTestTimeout/ZeroOverridesFlag-stdout.txt
@@ -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