summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CTestCommandLine/test1-timeout.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-10-29 18:21:38 (GMT)
committerBrad King <brad.king@kitware.com>2019-10-29 19:14:36 (GMT)
commit39ac8b4eb5c5ea99cf1053bd37e76d811f5122fc (patch)
tree284a7da62ff3285b1809618e822dd1c693ec03dd /Tests/RunCMake/CTestCommandLine/test1-timeout.cmake
parent80c2c9d14cf1c1a8f162e119bd00d5f483a94af2 (diff)
downloadCMake-39ac8b4eb5c5ea99cf1053bd37e76d811f5122fc.zip
CMake-39ac8b4eb5c5ea99cf1053bd37e76d811f5122fc.tar.gz
CMake-39ac8b4eb5c5ea99cf1053bd37e76d811f5122fc.tar.bz2
ctest: Add --repeat-after-timeout option
Add an option to re-run tests if they timeout. This will help tolerate sporadic timeouts on busy machines.
Diffstat (limited to 'Tests/RunCMake/CTestCommandLine/test1-timeout.cmake')
-rw-r--r--Tests/RunCMake/CTestCommandLine/test1-timeout.cmake14
1 files changed, 14 insertions, 0 deletions
diff --git a/Tests/RunCMake/CTestCommandLine/test1-timeout.cmake b/Tests/RunCMake/CTestCommandLine/test1-timeout.cmake
new file mode 100644
index 0000000..fbf2ccc
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/test1-timeout.cmake
@@ -0,0 +1,14 @@
+# This is run by test test1 in repeat-after-timeout-cmake.cmake with cmake -P.
+# It reads the file TEST_OUTPUT_FILE and increments the number
+# found in the file by 1. Unless the number is 2, then the
+# code sends out a cmake error causing the test to not timeout only on
+# the second time it is run.
+message("TEST_OUTPUT_FILE = ${TEST_OUTPUT_FILE}")
+file(READ "${TEST_OUTPUT_FILE}" COUNT)
+message("COUNT= ${COUNT}")
+math(EXPR COUNT "${COUNT} + 1")
+file(WRITE "${TEST_OUTPUT_FILE}" "${COUNT}")
+if(NOT COUNT EQUAL 2)
+ message("this test times out except on the 2nd run")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 10)
+endif()