From 925c026c31551bee2c28069d85eed4fb22e79b3f Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 2 Jul 2020 10:03:25 -0400 Subject: Tests: Verify SLA in CPackComponentsForAll-DragNDrop-* DMG files Issue: #20889 --- Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index 253d128..7ab8820 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -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}") + 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 -- cgit v0.12