mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-03 12:19:41 -06:00
Tests: Verify SLA in CPackComponentsForAll-DragNDrop-* DMG files
Issue: #20889
This commit is contained in:
@@ -88,12 +88,14 @@ if(CPackGen MATCHES "DragNDrop")
|
||||
set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/MyLib-*.dmg")
|
||||
if(${CPackComponentWay} STREQUAL "default")
|
||||
set(expected_count 1)
|
||||
set(expect_dmg_sla 1)
|
||||
elseif(${CPackComponentWay} STREQUAL "OnePackPerGroup")
|
||||
set(expected_count 3)
|
||||
elseif(${CPackComponentWay} STREQUAL "IgnoreGroup")
|
||||
set(expected_count 4)
|
||||
elseif(${CPackComponentWay} STREQUAL "AllInOne")
|
||||
set(expected_count 1)
|
||||
set(expect_dmg_sla 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -138,6 +140,20 @@ if(expected_file_mask)
|
||||
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})")
|
||||
endif()
|
||||
|
||||
if(expect_dmg_sla)
|
||||
execute_process(COMMAND hdiutil udifderez -xml "${expected_file}" OUTPUT_VARIABLE out ERROR_VARIABLE err RESULT_VARIABLE res)
|
||||
if(NOT res EQUAL 0)
|
||||
string(REPLACE "\n" "\n " err " ${err}")
|
||||
message(FATAL_ERROR "error: running 'hdiutil udifderez -xml' on\n ${expected_file}\nfailed with:\n${err}")
|
||||
endif()
|
||||
foreach(key "LPic" "STR#" "TEXT")
|
||||
if(NOT out MATCHES "<key>${key}</key>")
|
||||
string(REPLACE "\n" "\n " out " ${out}")
|
||||
message(FATAL_ERROR "error: running 'hdiutil udifderez -xml' on\n ${expected_file}\ndid not show '${key}' key:\n${out}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Validate content
|
||||
|
||||
Reference in New Issue
Block a user