Enable overriding contract test timeout values.

Use a longer value as the default timeout (6 hours).

For a per-contract-test timeout value, set ${project}_TEST_TIMEOUT
in the project's RunTest.cmake file. To use a longer value for
all non-specific contract tests, set a CMake cache variable
named CMAKE_CONTRACT_TEST_TIMEOUT_DEFAULT.

All timeout values are in seconds.

Also, patch up last commit to defer evaluation of ENV{HOME}
until EnforceConfig.cmake is included at ctest time. This
allows Windows machines to have "\\" characters in the HOME
environment variable if they want to.
This commit is contained in:
David Cole 2010-10-22 14:31:36 -04:00
parent c81ad34e85
commit 1e4fd5fc9c
1 changed files with 11 additions and 2 deletions

View File

@ -23,7 +23,7 @@ IF(DEFINED ENV{HOME} AND NOT CTEST_NO_TEST_HOME)
SET(TEST_HOME_ENV_CODE "# Fake a user home directory to avoid polluting the real one. SET(TEST_HOME_ENV_CODE "# Fake a user home directory to avoid polluting the real one.
# But provide original ENV{HOME} value in ENV{CTEST_REAL_HOME} for tests that # But provide original ENV{HOME} value in ENV{CTEST_REAL_HOME} for tests that
# need access to the real HOME directory. # need access to the real HOME directory.
SET(ENV{CTEST_REAL_HOME} \"$ENV{HOME}\") SET(ENV{CTEST_REAL_HOME} \"\$ENV{HOME}\")
SET(ENV{HOME} \"${TEST_HOME}\") SET(ENV{HOME} \"${TEST_HOME}\")
") ")
ENDIF() ENDIF()
@ -1776,7 +1776,16 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
INCLUDE(Contracts/${project}/RunTest.cmake) INCLUDE(Contracts/${project}/RunTest.cmake)
ADD_TEST_MACRO(Contracts.${project} ADD_TEST_MACRO(Contracts.${project}
${${project}_RUN_TEST}) ${${project}_RUN_TEST})
SET_TESTS_PROPERTIES(Contracts.${project} PROPERTIES TIMEOUT 5400) # Contract test timeout in seconds.
# Default to 6 hours.
IF(DEFINED ${project}_TEST_TIMEOUT)
SET(timeout ${${project}_TEST_TIMEOUT})
ELSEIF(CMAKE_CONTRACT_TEST_TIMEOUT_DEFAULT)
SET(timeout ${CMAKE_CONTRACT_TEST_TIMEOUT_DEFAULT})
ELSE()
SET(timeout 21600)
ENDIF()
SET_TESTS_PROPERTIES(Contracts.${project} PROPERTIES TIMEOUT ${timeout})
ENDFOREACH() ENDFOREACH()
ENDIF(BUILD_TESTING) ENDIF(BUILD_TESTING)