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)
|
2014-06-25 19:44:09 +04:00
|
|
|
# Give the process time to load and start running.
|
|
|
|
set(TIMEOUT 4)
|
2012-08-13 21:47:32 +04:00
|
|
|
endif()
|
2009-12-02 17:31:49 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
add_definitions(-DTIMEOUT=${TIMEOUT})
|
2014-05-23 17:47:44 +04:00
|
|
|
add_executable (Sleep sleep.c)
|
2009-09-29 23:18:46 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
add_test(NAME TestTimeout
|
2014-05-23 17:47:44 +04:00
|
|
|
COMMAND ${CMAKE_COMMAND} -D Sleep=$<TARGET_FILE:Sleep>
|
2009-12-01 00:31:28 +03:00
|
|
|
-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
|
|
|
|
2014-05-23 17:47:44 +04:00
|
|
|
add_test(NAME TestSleep COMMAND Sleep)
|
|
|
|
set_tests_properties(TestSleep PROPERTIES DEPENDS TestTimeout)
|