mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 03:48:02 +08:00
Tests: Improve CPackComponentsForAll test error formatting
Format message content for `message(FATAL_ERROR)`.
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user