summaryrefslogtreecommitdiffstats
path: root/Tests/CTestTestTimeout/sleep.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-05-23 13:47:44 (GMT)
committerBrad King <brad.king@kitware.com>2014-05-23 14:30:39 (GMT)
commit9afcecaf32acb4333b33d46522f98457bfa8856d (patch)
treec27da3ad5fcafddaf930e517b05c5c392e1e92af /Tests/CTestTestTimeout/sleep.c
parent8ae05b420e513252d1fd68dc6085d8dd92f3e624 (diff)
downloadCMake-9afcecaf32acb4333b33d46522f98457bfa8856d.zip
CMake-9afcecaf32acb4333b33d46522f98457bfa8856d.tar.gz
CMake-9afcecaf32acb4333b33d46522f98457bfa8856d.tar.bz2
Tests: Try to make CTestTestTimeout more robust
Write to the timeout test log file before sleeping and flush to be sure it is created. Move the check that the after-sleep line is not written out to the ctest script. Rename the CheckChild test to TestSleep since it no longer checks. Do not try to read the log file if it does not exist.
Diffstat (limited to 'Tests/CTestTestTimeout/sleep.c')
-rw-r--r--Tests/CTestTestTimeout/sleep.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/Tests/CTestTestTimeout/sleep.c b/Tests/CTestTestTimeout/sleep.c
new file mode 100644
index 0000000..33ce307
--- /dev/null
+++ b/Tests/CTestTestTimeout/sleep.c
@@ -0,0 +1,21 @@
+#if defined(_WIN32)
+# include <windows.h>
+#else
+# include <unistd.h>
+#endif
+
+#include <stdio.h>
+
+int main(void)
+{
+ fprintf(stderr, "before sleep\n");
+ fflush(stderr); /* should not be needed, but just in case */
+#if defined(_WIN32)
+ Sleep((TIMEOUT+4)*1000);
+#else
+ sleep((TIMEOUT+4));
+#endif
+ fprintf(stderr, "after sleep\n");
+ fflush(stderr); /* should not be needed, but just in case */
+ return 0;
+}