summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-04-07 13:06:51 (GMT)
committerBrad King <brad.king@kitware.com>2015-04-07 13:08:39 (GMT)
commit1535dcd894eab9eea023d93aec6a0274babc7fd3 (patch)
tree5ab4595f14640917af0f95978322d1d8ff92f800
parent9b7213dc47d2477cb4ceb5032a9078412b5474bd (diff)
downloadCMake-1535dcd894eab9eea023d93aec6a0274babc7fd3.zip
CMake-1535dcd894eab9eea023d93aec6a0274babc7fd3.tar.gz
CMake-1535dcd894eab9eea023d93aec6a0274babc7fd3.tar.bz2
Tests: Teach RunCMake to optionally merge command output to stdout
Some tests may need to read "cmake --build" output passed through from native build tools and do not know if it will be on stdout or stderr. Optionally use the same variable for the execute_process output so that it merges them and we can always match using expected stdout.
-rw-r--r--Tests/RunCMake/RunCMake.cmake10
1 files changed, 8 insertions, 2 deletions
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index abac66e..6333703 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -54,12 +54,18 @@ function(run_cmake test)
if(RunCMake_MAKE_PROGRAM)
list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}")
endif()
+ if(RunCMake_TEST_OUTPUT_MERGE)
+ set(actual_stderr_var actual_stdout)
+ set(actual_stderr "")
+ else()
+ set(actual_stderr_var actual_stderr)
+ endif()
if(RunCMake_TEST_COMMAND)
execute_process(
COMMAND ${RunCMake_TEST_COMMAND}
WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}"
OUTPUT_VARIABLE actual_stdout
- ERROR_VARIABLE actual_stderr
+ ERROR_VARIABLE ${actual_stderr_var}
RESULT_VARIABLE actual_result
)
else()
@@ -73,7 +79,7 @@ function(run_cmake test)
${RunCMake_TEST_OPTIONS}
WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}"
OUTPUT_VARIABLE actual_stdout
- ERROR_VARIABLE actual_stderr
+ ERROR_VARIABLE ${actual_stderr_var}
RESULT_VARIABLE actual_result
)
endif()