2009-12-01 00:31:28 +03:00
|
|
|
cmake_minimum_required (VERSION 2.8)
|
2012-08-13 21:47:32 +04:00
|
|
|
project(CTestTestTimeout)
|
|
|
|
include(CTest)
|
2009-09-29 23:18:46 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if(NOT TIMEOUT)
|
|
|
|
if(CYGWIN)
|
|
|
|
set(TIMEOUT 4) # Cygwin CMake sometimes takes > 1 second to load!
|
|
|
|
else()
|
|
|
|
set(TIMEOUT 1)
|
|
|
|
endif()
|
|
|
|
endif()
|
2009-12-02 17:31:49 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
add_definitions(-DTIMEOUT=${TIMEOUT})
|
|
|
|
add_executable (Timeout timeout.c)
|
2009-09-29 23:18:46 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
add_test(NAME TestTimeout
|
2009-12-01 00:31:28 +03:00
|
|
|
COMMAND ${CMAKE_COMMAND} -D Timeout=$<TARGET_FILE:Timeout>
|
|
|
|
-D Log=${CMAKE_CURRENT_BINARY_DIR}/timeout.log
|
|
|
|
-P ${CMAKE_CURRENT_SOURCE_DIR}/timeout.cmake
|
|
|
|
)
|
2012-08-13 21:47:32 +04:00
|
|
|
set_tests_properties(TestTimeout PROPERTIES TIMEOUT ${TIMEOUT})
|
2009-09-29 23:18:46 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
add_test(NAME CheckChild
|
2009-12-01 00:31:28 +03:00
|
|
|
COMMAND ${CMAKE_COMMAND} -D Timeout=$<TARGET_FILE:Timeout>
|
|
|
|
-D Log=${CMAKE_CURRENT_BINARY_DIR}/timeout.log
|
|
|
|
-P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake
|
|
|
|
)
|
2012-08-13 21:47:32 +04:00
|
|
|
set_tests_properties(CheckChild PROPERTIES DEPENDS TestTimeout)
|