summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Tests/CTestTestTimeout/CMakeLists.txt7
-rw-r--r--Tests/CTestTestTimeout/test.cmake.in1
-rw-r--r--Tests/CTestTestTimeout/timeout.c4
3 files changed, 9 insertions, 3 deletions
diff --git a/Tests/CTestTestTimeout/CMakeLists.txt b/Tests/CTestTestTimeout/CMakeLists.txt
index 5fce680..d22c63d 100644
--- a/Tests/CTestTestTimeout/CMakeLists.txt
+++ b/Tests/CTestTestTimeout/CMakeLists.txt
@@ -2,6 +2,11 @@ cmake_minimum_required (VERSION 2.8)
PROJECT(CTestTestTimeout)
INCLUDE(CTest)
+IF(NOT TIMEOUT)
+ SET(TIMEOUT 1)
+ENDIF()
+
+ADD_DEFINITIONS(-DTIMEOUT=${TIMEOUT})
ADD_EXECUTABLE (Timeout timeout.c)
ADD_TEST(NAME TestTimeout
@@ -9,7 +14,7 @@ ADD_TEST(NAME TestTimeout
-D Log=${CMAKE_CURRENT_BINARY_DIR}/timeout.log
-P ${CMAKE_CURRENT_SOURCE_DIR}/timeout.cmake
)
-SET_TESTS_PROPERTIES(TestTimeout PROPERTIES TIMEOUT 1)
+SET_TESTS_PROPERTIES(TestTimeout PROPERTIES TIMEOUT ${TIMEOUT})
ADD_TEST(NAME CheckChild
COMMAND ${CMAKE_COMMAND} -D Timeout=$<TARGET_FILE:Timeout>
diff --git a/Tests/CTestTestTimeout/test.cmake.in b/Tests/CTestTestTimeout/test.cmake.in
index 4582801..2aa41e2 100644
--- a/Tests/CTestTestTimeout/test.cmake.in
+++ b/Tests/CTestTestTimeout/test.cmake.in
@@ -21,6 +21,7 @@ SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIP
#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY})
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@
MAKECOMMAND:STRING=@MAKECOMMAND@
diff --git a/Tests/CTestTestTimeout/timeout.c b/Tests/CTestTestTimeout/timeout.c
index ba91bc0..370ab22 100644
--- a/Tests/CTestTestTimeout/timeout.c
+++ b/Tests/CTestTestTimeout/timeout.c
@@ -9,9 +9,9 @@
int main(void)
{
#if defined(_WIN32)
- Sleep(5000);
+ Sleep((TIMEOUT+4)*1000);
#else
- sleep(5);
+ sleep((TIMEOUT+4));
#endif
printf("timeout process finished sleeping!\n");
return -1;