diff options
author | Brad King <brad.king@kitware.com> | 2012-04-18 11:09:18 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-04-19 08:32:57 -0400 |
commit | 38c3943b6fd30cbc684211a1abf73330813dcda1 (patch) | |
tree | 02b900883fc5feb56b83a0e6827976743542ece5 /Tests/RunCMake/RunCMake.cmake | |
parent | 31e7fadbb3bfd225e0d48e2d072ccc745d7f2689 (diff) | |
download | cmake-38c3943b6fd30cbc684211a1abf73330813dcda1.tar.gz |
Teach RunCMake tests to allow custom checks
Look for a <SubTest>-check.cmake script and load it to check side
effects of the sub test. Provide it with the test source and build tree
paths in variables. Check for a failure message in a result variable.
Diffstat (limited to 'Tests/RunCMake/RunCMake.cmake')
-rw-r--r-- | Tests/RunCMake/RunCMake.cmake | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 26394639fa..c3c161abee 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -25,14 +25,14 @@ function(run_cmake test) unset(expect_std${o}) endif() endforeach() - set(source_dir "${top_src}") - set(binary_dir "${top_bin}/${test}-build") - file(REMOVE_RECURSE "${binary_dir}") - file(MAKE_DIRECTORY "${binary_dir}") + set(RunCMake_TEST_SOURCE_DIR "${top_src}") + set(RunCMake_TEST_BINARY_DIR "${top_bin}/${test}-build") + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") execute_process( - COMMAND ${CMAKE_COMMAND} "${source_dir}" + COMMAND ${CMAKE_COMMAND} "${RunCMake_TEST_SOURCE_DIR}" -G "${RunCMake_GENERATOR}" -DRunCMake_TEST=${test} - WORKING_DIRECTORY "${binary_dir}" + WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" OUTPUT_VARIABLE actual_stdout ERROR_VARIABLE actual_stderr RESULT_VARIABLE actual_result @@ -53,6 +53,11 @@ function(run_cmake test) endif() endif() endforeach() + unset(RunCMake_TEST_FAILED) + include(${top_src}/${test}-check.cmake OPTIONAL) + if(RunCMake_TEST_FAILED) + set(msg "${RunCMake_TEST_FAILED}\n${msg}") + endif() if(msg) string(REGEX REPLACE "\n" "\n actual-out> " actual_out " actual-out> ${actual_stdout}") string(REGEX REPLACE "\n" "\n actual-err> " actual_err " actual-err> ${actual_stderr}") |