Tests: Teach RunCMake infrastructure to optionally timeout

Add a RunCMake_TEST_TIMEOUT option that tests can set to cause RunCMake
to limit the time it waits for the child process to finish.
This commit is contained in:
Brad King 2015-06-24 09:53:37 -04:00
parent 93904772d7
commit dffc307c81
1 changed files with 7 additions and 0 deletions

View File

@ -66,6 +66,11 @@ function(run_cmake test)
else()
set(actual_stderr_var actual_stderr)
endif()
if(DEFINED RunCMake_TEST_TIMEOUT)
set(maybe_timeout TIMEOUT ${RunCMake_TEST_TIMEOUT})
else()
set(maybe_timeout "")
endif()
if(RunCMake_TEST_COMMAND)
execute_process(
COMMAND ${RunCMake_TEST_COMMAND}
@ -73,6 +78,7 @@ function(run_cmake test)
OUTPUT_VARIABLE actual_stdout
ERROR_VARIABLE ${actual_stderr_var}
RESULT_VARIABLE actual_result
${maybe_timeout}
)
else()
execute_process(
@ -87,6 +93,7 @@ function(run_cmake test)
OUTPUT_VARIABLE actual_stdout
ERROR_VARIABLE ${actual_stderr_var}
RESULT_VARIABLE actual_result
${maybe_timeout}
)
endif()
set(msg "")