[Cmake-commits] CMake branch, next, updated. v3.0.0-rc6-3331-g85f4f7b

Brad King brad.king at kitware.com
Fri May 23 10:38:07 EDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  85f4f7bd214eac2b5ded36fc9d666d5f69342916 (commit)
       via  9afcecaf32acb4333b33d46522f98457bfa8856d (commit)
      from  9c9ec442134e0cfd9481021f69311a2110430a6d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=85f4f7bd214eac2b5ded36fc9d666d5f69342916
commit 85f4f7bd214eac2b5ded36fc9d666d5f69342916
Merge: 9c9ec44 9afceca
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri May 23 10:38:06 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri May 23 10:38:06 2014 -0400

    Merge topic 'revise-CTestTestTimeout' into next
    
    9afcecaf Tests: Try to make CTestTestTimeout more robust


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9afcecaf32acb4333b33d46522f98457bfa8856d
commit 9afcecaf32acb4333b33d46522f98457bfa8856d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri May 23 09:47:44 2014 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri May 23 10:30:39 2014 -0400

    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.

diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 5014ef3..8d2b7fc 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -2394,7 +2394,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
     --output-log "${CMake_BINARY_DIR}/Tests/CTestTestTimeout/testOutput.log"
     )
   set_tests_properties(CTestTestTimeout PROPERTIES
-    PASS_REGULAR_EXPRESSION "TestTimeout *\\.+ *\\*\\*\\*Timeout.*CheckChild *\\.+ *Passed")
+    PASS_REGULAR_EXPRESSION "TestTimeout *\\.+ *\\*\\*\\*Timeout.*TestSleep *\\.+ *Passed.*timeout correctly killed child")
 
   add_test(
     NAME CTestTestRerunFailed
diff --git a/Tests/CTestTestTimeout/CMakeLists.txt b/Tests/CTestTestTimeout/CMakeLists.txt
index 476d0a5..2e3bd6a 100644
--- a/Tests/CTestTestTimeout/CMakeLists.txt
+++ b/Tests/CTestTestTimeout/CMakeLists.txt
@@ -11,18 +11,14 @@ if(NOT TIMEOUT)
 endif()
 
 add_definitions(-DTIMEOUT=${TIMEOUT})
-add_executable (Timeout timeout.c)
+add_executable (Sleep sleep.c)
 
 add_test(NAME TestTimeout
-  COMMAND ${CMAKE_COMMAND} -D Timeout=$<TARGET_FILE:Timeout>
+  COMMAND ${CMAKE_COMMAND} -D Sleep=$<TARGET_FILE:Sleep>
                            -D Log=${CMAKE_CURRENT_BINARY_DIR}/timeout.log
                            -P ${CMAKE_CURRENT_SOURCE_DIR}/timeout.cmake
   )
 set_tests_properties(TestTimeout PROPERTIES TIMEOUT ${TIMEOUT})
 
-add_test(NAME CheckChild
-  COMMAND ${CMAKE_COMMAND} -D Timeout=$<TARGET_FILE:Timeout>
-                           -D Log=${CMAKE_CURRENT_BINARY_DIR}/timeout.log
-                           -P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake
-  )
-set_tests_properties(CheckChild PROPERTIES DEPENDS TestTimeout)
+add_test(NAME TestSleep COMMAND Sleep)
+set_tests_properties(TestSleep PROPERTIES DEPENDS TestTimeout)
diff --git a/Tests/CTestTestTimeout/check.cmake b/Tests/CTestTestTimeout/check.cmake
deleted file mode 100644
index b16f2aa..0000000
--- a/Tests/CTestTestTimeout/check.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-# Block just as long as timeout.cmake would if it were not killed.
-execute_process(COMMAND ${Timeout})
-
-# Verify that the log is empty, which indicates that the grandchild
-# was killed before it finished sleeping.
-file(READ "${Log}" LOG)
-if(NOT "${LOG}" STREQUAL "")
-  message(FATAL_ERROR "${LOG}")
-endif()
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;
+}
diff --git a/Tests/CTestTestTimeout/test.cmake.in b/Tests/CTestTestTimeout/test.cmake.in
index 4178849..68c74d8 100644
--- a/Tests/CTestTestTimeout/test.cmake.in
+++ b/Tests/CTestTestTimeout/test.cmake.in
@@ -24,3 +24,16 @@ CTEST_START(Experimental)
 CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
 CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
 CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
+
+set(log ${CTEST_BINARY_DIRECTORY}/timeout.log)
+if(EXISTS "${log}")
+  # Verify that the timeout test did not finish sleeping.
+  file(STRINGS "${log}" after_sleep REGEX "after sleep")
+  if(after_sleep)
+    message(FATAL_ERROR "Log indicates timeout did not kill child.")
+  else()
+    message("Log indicates timeout correctly killed child.")
+  endif()
+else()
+  message(FATAL_ERROR "Log does not exist:\n  ${log}")
+endif()
diff --git a/Tests/CTestTestTimeout/timeout.c b/Tests/CTestTestTimeout/timeout.c
deleted file mode 100644
index 370ab22..0000000
--- a/Tests/CTestTestTimeout/timeout.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#if defined(_WIN32)
-# include <windows.h>
-#else
-# include <unistd.h>
-#endif
-
-#include <stdio.h>
-
-int main(void)
-{
-#if defined(_WIN32)
-  Sleep((TIMEOUT+4)*1000);
-#else
-  sleep((TIMEOUT+4));
-#endif
-  printf("timeout process finished sleeping!\n");
-  return -1;
-}
diff --git a/Tests/CTestTestTimeout/timeout.cmake b/Tests/CTestTestTimeout/timeout.cmake
index 198cc97..0989b65 100644
--- a/Tests/CTestTestTimeout/timeout.cmake
+++ b/Tests/CTestTestTimeout/timeout.cmake
@@ -3,4 +3,4 @@ file(REMOVE ${Log})
 
 # Run a child that sleeps longer than the timout of this test.
 # Log its output so check.cmake can verify it dies.
-execute_process(COMMAND ${Timeout} OUTPUT_FILE ${Log})
+execute_process(COMMAND ${Sleep} ERROR_FILE ${Log})

-----------------------------------------------------------------------

Summary of changes:
 Tests/CMakeLists.txt                  |    2 +-
 Tests/CTestTestTimeout/CMakeLists.txt |   12 ++++--------
 Tests/CTestTestTimeout/check.cmake    |    9 ---------
 Tests/CTestTestTimeout/sleep.c        |   21 +++++++++++++++++++++
 Tests/CTestTestTimeout/test.cmake.in  |   13 +++++++++++++
 Tests/CTestTestTimeout/timeout.c      |   18 ------------------
 Tests/CTestTestTimeout/timeout.cmake  |    2 +-
 7 files changed, 40 insertions(+), 37 deletions(-)
 delete mode 100644 Tests/CTestTestTimeout/check.cmake
 create mode 100644 Tests/CTestTestTimeout/sleep.c
 delete mode 100644 Tests/CTestTestTimeout/timeout.c


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list