Tests: Teach RunCMake to report command-line on failure

When a test sets RunCMake_TEST_COMMAND, report the command line
on failure to make it easier to run by hand for debugging.
This commit is contained in:
Brad King 2015-01-15 14:36:10 -05:00
parent 3dec4a2bfb
commit 6c121924ad
1 changed files with 4 additions and 0 deletions

View File

@ -93,6 +93,10 @@ function(run_cmake test)
if(RunCMake_TEST_FAILED) if(RunCMake_TEST_FAILED)
set(msg "${RunCMake_TEST_FAILED}\n${msg}") set(msg "${RunCMake_TEST_FAILED}\n${msg}")
endif() endif()
if(msg AND RunCMake_TEST_COMMAND)
string(REPLACE ";" "\" \"" command "\"${RunCMake_TEST_COMMAND}\"")
set(msg "${msg}Command was:\n command> ${command}\n")
endif()
if(msg) if(msg)
string(REGEX REPLACE "\n" "\n actual-out> " actual_out " actual-out> ${actual_stdout}") 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}") string(REGEX REPLACE "\n" "\n actual-err> " actual_err " actual-err> ${actual_stderr}")