diff options
author | Wouter Klouwen <wouter.klouwen@youview.com> | 2018-11-16 16:06:54 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2018-12-20 20:52:08 (GMT) |
commit | 19d86e26e392a80163d90cbc1accaf45412968f8 (patch) | |
tree | 4bf9fbc24eab74fbc25f22392c5677bb22da32d5 /Tests/RunCMake | |
parent | 772edffbf0c08fc0a6fcf74fb98545b7afcfee13 (diff) | |
download | CMake-19d86e26e392a80163d90cbc1accaf45412968f8.zip CMake-19d86e26e392a80163d90cbc1accaf45412968f8.tar.gz CMake-19d86e26e392a80163d90cbc1accaf45412968f8.tar.bz2 |
ExternalProject: add LOG_OUTPUT_ON_FAILURE option
This option only has an effect if at least one of the other LOG_<step>
options is enabled. If an error occurs for a step which has logging to
file enabled, that step's output will be printed to the console. For
cases where a large amount of output is recorded, just the end of that
output may be printed to the console.
Diffstat (limited to 'Tests/RunCMake')
9 files changed, 67 insertions, 0 deletions
diff --git a/Tests/RunCMake/ExternalProject/LogOutputOnFailure-build-result.txt b/Tests/RunCMake/ExternalProject/LogOutputOnFailure-build-result.txt new file mode 100644 index 0000000..c20fd86 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/LogOutputOnFailure-build-result.txt @@ -0,0 +1 @@ +^[^0] diff --git a/Tests/RunCMake/ExternalProject/LogOutputOnFailure-build-stderr.txt b/Tests/RunCMake/ExternalProject/LogOutputOnFailure-build-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/LogOutputOnFailure-build-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/ExternalProject/LogOutputOnFailure-build-stdout.txt b/Tests/RunCMake/ExternalProject/LogOutputOnFailure-build-stdout.txt new file mode 100644 index 0000000..87e5384 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/LogOutputOnFailure-build-stdout.txt @@ -0,0 +1,8 @@ +( )?-- stdout output is: +( )?This is some dummy output with some long lines to ensure formatting is preserved +( )? Including lines with leading spaces +( )? +( )?And also blank lines[ + ]+ +( )?-- stderr output is: +( )?cmake -E env: no command given diff --git a/Tests/RunCMake/ExternalProject/LogOutputOnFailure.cmake b/Tests/RunCMake/ExternalProject/LogOutputOnFailure.cmake new file mode 100644 index 0000000..863bbef --- /dev/null +++ b/Tests/RunCMake/ExternalProject/LogOutputOnFailure.cmake @@ -0,0 +1,20 @@ +include(ExternalProject) + +set(dummyOutput [[ +This is some dummy output with some long lines to ensure formatting is preserved + Including lines with leading spaces + +And also blank lines +]]) + +ExternalProject_Add(FailsWithOutput + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR} + CONFIGURE_COMMAND "" + BUILD_COMMAND ${CMAKE_COMMAND} -E echo ${dummyOutput} + COMMAND ${CMAKE_COMMAND} -E env # missing command, forces fail + TEST_COMMAND "" + INSTALL_COMMAND "" + LOG_BUILD YES + LOG_OUTPUT_ON_FAILURE YES + USES_TERMINAL_BUILD YES +) diff --git a/Tests/RunCMake/ExternalProject/LogOutputOnFailureMerged-build-result.txt b/Tests/RunCMake/ExternalProject/LogOutputOnFailureMerged-build-result.txt new file mode 100644 index 0000000..c20fd86 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/LogOutputOnFailureMerged-build-result.txt @@ -0,0 +1 @@ +^[^0] diff --git a/Tests/RunCMake/ExternalProject/LogOutputOnFailureMerged-build-stderr.txt b/Tests/RunCMake/ExternalProject/LogOutputOnFailureMerged-build-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/LogOutputOnFailureMerged-build-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/ExternalProject/LogOutputOnFailureMerged-build-stdout.txt b/Tests/RunCMake/ExternalProject/LogOutputOnFailureMerged-build-stdout.txt new file mode 100644 index 0000000..11c7317 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/LogOutputOnFailureMerged-build-stdout.txt @@ -0,0 +1,7 @@ +( )?-- Log output is: +( )?This is some dummy output with some long lines to ensure formatting is preserved +( )? Including lines with leading spaces +( )? +( )?And also blank lines[ + ]+ +( )?cmake -E env: no command given diff --git a/Tests/RunCMake/ExternalProject/LogOutputOnFailureMerged.cmake b/Tests/RunCMake/ExternalProject/LogOutputOnFailureMerged.cmake new file mode 100644 index 0000000..116448b --- /dev/null +++ b/Tests/RunCMake/ExternalProject/LogOutputOnFailureMerged.cmake @@ -0,0 +1,21 @@ +include(ExternalProject) + +set(dummyOutput [[ +This is some dummy output with some long lines to ensure formatting is preserved + Including lines with leading spaces + +And also blank lines +]]) + +ExternalProject_Add(FailsWithOutput + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR} + CONFIGURE_COMMAND "" + BUILD_COMMAND ${CMAKE_COMMAND} -E echo ${dummyOutput} + COMMAND ${CMAKE_COMMAND} -E env # missing command, forces fail + TEST_COMMAND "" + INSTALL_COMMAND "" + LOG_BUILD YES + LOG_OUTPUT_ON_FAILURE YES + LOG_MERGED_STDOUTERR YES + USES_TERMINAL_BUILD YES +) diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index bf11381..caaf0d2 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -29,6 +29,13 @@ endfunction() __ep_test_with_build(MultiCommand) +# Output is not predictable enough to be able to verify it reliably +# when using the various different Visual Studio generators +if(NOT RunCMake_GENERATOR MATCHES "Visual Studio") + __ep_test_with_build(LogOutputOnFailure) + __ep_test_with_build(LogOutputOnFailureMerged) +endif() + # We can't test the substitution when using the old MSYS due to # make/sh mangling the paths (substitution is performed correctly, # but the mangling means we can't reliably test the output). |