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.
This commit is contained in:
parent
9b7213dc47
commit
1535dcd894
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue