diff options
author | Brad King <brad.king@kitware.com> | 2021-06-10 14:51:49 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-06-10 14:53:02 (GMT) |
commit | 45935ac973a280ea9602ba17aa448d94a66a056d (patch) | |
tree | 1401b788516e063574a1973059f71f3484dc6c92 /Tests/CPackComponentsForAll | |
parent | 5fd68d3ef75d590da383b5189ee7f952bd560a30 (diff) | |
download | CMake-45935ac973a280ea9602ba17aa448d94a66a056d.zip CMake-45935ac973a280ea9602ba17aa448d94a66a056d.tar.gz CMake-45935ac973a280ea9602ba17aa448d94a66a056d.tar.bz2 |
Tests: Improve CPackComponentsForAll test error formatting
Format message content for `message(FATAL_ERROR)`.
Diffstat (limited to 'Tests/CPackComponentsForAll')
-rw-r--r-- | Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index 31e843a..3e1c13d 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -115,8 +115,17 @@ execute_process(COMMAND ${CMAKE_CPACK_COMMAND} ${config_verbose} -G ${CPackGen} ERROR_VARIABLE CPack_error WORKING_DIRECTORY ${CPackComponentsForAll_BINARY_DIR}) +string(REPLACE "\n" "\n cpack-out> " cpack_out "\n${CPack_output}") +string(REPLACE "\n" "\n cpack-err> " cpack_err "\n${CPack_error}") +string(REPLACE "\n" "\n cpack-res> " cpack_res "\n${CPack_result}") +string(CONCAT output_error_message + "CPack output:${cpack_out}\n" + "CPack error:${cpack_err}\n" + "CPack result:${cpack_res}\n" + ) + if(CPack_result) - message(FATAL_ERROR "error: CPack execution went wrong!, CPack_output=${CPack_output}, CPack_error=${CPack_error}") + message(FATAL_ERROR "error: CPack execution went wrong!,\n${output_error_message}") else () message(STATUS "CPack_output=${CPack_output}") endif() @@ -132,13 +141,13 @@ if(expected_file_mask) message(STATUS "expected_file_mask='${expected_file_mask}'") if(NOT expected_file) - message(FATAL_ERROR "error: expected_file does not exist: CPackComponentsForAll test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error}") + message(FATAL_ERROR "error: expected_file does not exist: CPackComponentsForAll test fails.\n${output_error_message}") endif() list(LENGTH expected_file actual_count) message(STATUS "actual_count='${actual_count}'") if(NOT actual_count EQUAL expected_count) - message(FATAL_ERROR "error: expected_count=${expected_count} does not match actual_count=${actual_count}: CPackComponents test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error})") + message(FATAL_ERROR "error: expected_count=${expected_count} does not match actual_count=${actual_count}: CPackComponents test fails.\n${output_error_message}") endif() if(expect_dmg_sla) |