From 1535dcd894eab9eea023d93aec6a0274babc7fd3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Apr 2015 09:06:51 -0400 Subject: 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. --- Tests/RunCMake/RunCMake.cmake | 10 ++++++++-- 1 file 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() -- cgit v0.12