[Cmake-commits] [cmake-commits] king committed CMakeLists.txt 1.3 1.4 test.cmake.in 1.1 1.2 timeout.c 1.3 1.4

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Dec 2 09:31:52 EST 2009


Update of /cvsroot/CMake/CMake/Tests/CTestTestTimeout
In directory public:/mounts/ram/cvs-serv28577/Tests/CTestTestTimeout

Modified Files:
	CMakeLists.txt test.cmake.in timeout.c 
Log Message:
Make CTestTestTimeout time configurable

In this test we start up a cmake script that runs a process that sleeps,
and the timeout for the script is shorter than the sleep time.  However,
in order to properly detect that the sleeping grandchild is killed when
the script times out we need to give sufficient time for the script to
start the grandchild.  Otherwise the log file for the grandchild is not
available.

On some (cygwin) builds our previous 1 second timeout for the script was
not long enough to let the interpreter load and start the grandchild.
We make the timeout time configurable by setting CTestTestTimeout_TIME
in the cache for CMake itself.  It tells the test how long to let the
script run.  The grandchild always sleeps for 4 seconds longer to ensure
a comfortable window during which the process tree can be killed.


Index: test.cmake.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/CTestTestTimeout/test.cmake.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** test.cmake.in	29 Sep 2009 19:18:46 -0000	1.1
--- test.cmake.in	2 Dec 2009 14:31:49 -0000	1.2
***************
*** 22,25 ****
--- 22,26 ----
  
  FILE(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" "
+ TIMEOUT:STRING=@CTestTestTimeout_TIME@
  CMAKE_TEST_GENERATOR:STRING=@CMAKE_TEST_GENERATOR@
  CMAKE_TEST_MAKEPROGRAM:FILEPATH=@CMAKE_TEST_MAKEPROGRAM@

Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/CTestTestTimeout/CMakeLists.txt,v
retrieving revision 1.3
retrieving revision 1.4
diff -C 2 -d -r1.3 -r1.4
*** CMakeLists.txt	2 Dec 2009 14:16:29 -0000	1.3
--- CMakeLists.txt	2 Dec 2009 14:31:48 -0000	1.4
***************
*** 3,6 ****
--- 3,11 ----
  INCLUDE(CTest)
  
+ IF(NOT TIMEOUT)
+   SET(TIMEOUT 1)
+ ENDIF()
+ 
+ ADD_DEFINITIONS(-DTIMEOUT=${TIMEOUT})
  ADD_EXECUTABLE (Timeout timeout.c)
  
***************
*** 10,14 ****
                             -P ${CMAKE_CURRENT_SOURCE_DIR}/timeout.cmake
    )
! SET_TESTS_PROPERTIES(TestTimeout PROPERTIES TIMEOUT 1)
  
  ADD_TEST(NAME CheckChild
--- 15,19 ----
                             -P ${CMAKE_CURRENT_SOURCE_DIR}/timeout.cmake
    )
! SET_TESTS_PROPERTIES(TestTimeout PROPERTIES TIMEOUT ${TIMEOUT})
  
  ADD_TEST(NAME CheckChild

Index: timeout.c
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/CTestTestTimeout/timeout.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C 2 -d -r1.3 -r1.4
*** timeout.c	30 Nov 2009 21:31:27 -0000	1.3
--- timeout.c	2 Dec 2009 14:31:49 -0000	1.4
***************
*** 10,16 ****
  {
  #if defined(_WIN32)
!   Sleep(5000);
  #else
!   sleep(5);
  #endif
    printf("timeout process finished sleeping!\n");
--- 10,16 ----
  {
  #if defined(_WIN32)
!   Sleep((TIMEOUT+4)*1000);
  #else
!   sleep((TIMEOUT+4));
  #endif
    printf("timeout process finished sleeping!\n");



More information about the Cmake-commits mailing list