summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-01-19 14:09:33 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-01-19 14:09:39 (GMT)
commit1ca83ae2bbf9e474c46b6ea094c5035420bbfd45 (patch)
treea0066654d30c814d5606e59a5eb7e0c50fa85dba /Tests/RunCMake
parent196243d66858a42ea9ba572e67111a2b661f0922 (diff)
parent9e38bfa915c142edcf7d6e154fa1dc10bba400f1 (diff)
downloadCMake-1ca83ae2bbf9e474c46b6ea094c5035420bbfd45.zip
CMake-1ca83ae2bbf9e474c46b6ea094c5035420bbfd45.tar.gz
CMake-1ca83ae2bbf9e474c46b6ea094c5035420bbfd45.tar.bz2
Merge topic 'cpack-dmg-sla'
9e38bfa915 CPack/DMG: Add explicit option to use CPACK_RESOURCE_FILE_LICENSE for SLA 542ba6ac1a Tests: Add CPack/DMG case covering SLA from CPACK_RESOURCE_FILE_LICENSE Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6876
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/DMG_SLA_FILE/Example.txt4
-rw-r--r--Tests/RunCMake/CPack/tests/DMG_SLA_FILE/ExpectedFiles.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/DMG_SLA_FILE/VerifyResult.cmake22
-rw-r--r--Tests/RunCMake/CPack/tests/DMG_SLA_FILE/test.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/DMG_SLA_OFF/Example.txt4
-rw-r--r--Tests/RunCMake/CPack/tests/DMG_SLA_OFF/ExpectedFiles.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/DMG_SLA_OFF/VerifyResult.cmake12
-rw-r--r--Tests/RunCMake/CPack/tests/DMG_SLA_OFF/test.cmake3
9 files changed, 53 insertions, 0 deletions
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index eb9ff03..ef4cf5e 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -21,6 +21,8 @@ if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND")
endif()
run_cpack_test(DIST "RPM.DIST" false "MONOLITHIC")
run_cpack_test(DMG_SLA "DragNDrop" false "MONOLITHIC")
+run_cpack_test(DMG_SLA_FILE "DragNDrop" false "MONOLITHIC")
+run_cpack_test(DMG_SLA_OFF "DragNDrop" false "MONOLITHIC")
run_cpack_test(EMPTY_DIR "RPM.EMPTY_DIR;DEB.EMPTY_DIR;TGZ" true "MONOLITHIC;COMPONENT")
run_cpack_test(VERSION "RPM.VERSION;DEB.VERSION" false "MONOLITHIC;COMPONENT")
run_cpack_test(EXTRA "DEB.EXTRA" false "COMPONENT")
diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/Example.txt b/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/Example.txt
new file mode 100644
index 0000000..94b19c3
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/Example.txt
@@ -0,0 +1,4 @@
+Example License File
+--------------------
+
+This is an example license file for a DMG.
diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/ExpectedFiles.cmake
new file mode 100644
index 0000000..d1a3a5f
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/ExpectedFiles.cmake
@@ -0,0 +1,2 @@
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt")
diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/VerifyResult.cmake
new file mode 100644
index 0000000..55fb3fb
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/VerifyResult.cmake
@@ -0,0 +1,22 @@
+set(dmg "${bin_dir}/${FOUND_FILE_1}")
+execute_process(COMMAND hdiutil udifderez -xml "${dmg}" OUTPUT_VARIABLE out ERROR_VARIABLE err RESULT_VARIABLE res)
+if(NOT res EQUAL 0)
+ string(REPLACE "\n" "\n " err " ${err}")
+ message(FATAL_ERROR "Running 'hdiutil udifderez -xml' on\n ${dmg}\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 ${dmg}\ndid not show '${key}' key:\n${out}")
+ endif()
+endforeach()
+foreach(line
+ # TEXT first and last base64 lines
+ "\tRXhhbXBsZSBMaWNlbnNlIEZpbGUNLS0tLS0tLS0tLS0tLS0tLS0t\n"
+ "\tYSBETUcuDQ0=\n"
+ )
+ if(NOT out MATCHES "${line}")
+ string(REPLACE "\n" "\n " out " ${out}")
+ message(FATAL_ERROR "error: running 'hdiutil udifderez -xml' on\n ${dmg}\ndid not show '${line}':\n${out}")
+ endif()
+endforeach()
diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/test.cmake b/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/test.cmake
new file mode 100644
index 0000000..eac820e
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/test.cmake
@@ -0,0 +1,2 @@
+install(FILES CMakeLists.txt DESTINATION foo)
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_LIST_DIR}/Example.txt")
diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/Example.txt b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/Example.txt
new file mode 100644
index 0000000..94b19c3
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/Example.txt
@@ -0,0 +1,4 @@
+Example License File
+--------------------
+
+This is an example license file for a DMG.
diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/ExpectedFiles.cmake
new file mode 100644
index 0000000..d1a3a5f
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/ExpectedFiles.cmake
@@ -0,0 +1,2 @@
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt")
diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/VerifyResult.cmake
new file mode 100644
index 0000000..571a4df
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/VerifyResult.cmake
@@ -0,0 +1,12 @@
+set(dmg "${bin_dir}/${FOUND_FILE_1}")
+execute_process(COMMAND hdiutil udifderez -xml "${dmg}" OUTPUT_VARIABLE out ERROR_VARIABLE err RESULT_VARIABLE res)
+if(NOT res EQUAL 0)
+ string(REPLACE "\n" "\n " err " ${err}")
+ message(FATAL_ERROR "Running 'hdiutil udifderez -xml' on\n ${dmg}\nfailed with:\n${err}")
+endif()
+foreach(key "LPic" "STR#" "TEXT")
+ if(out MATCHES "<key>${key}</key>")
+ string(REPLACE "\n" "\n " out " ${out}")
+ message(FATAL_ERROR "error: running 'hdiutil udifderez -xml' on\n ${dmg}\nhas unexpected '${key}' key:\n${out}")
+ endif()
+endforeach()
diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/test.cmake b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/test.cmake
new file mode 100644
index 0000000..2b09cab
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/test.cmake
@@ -0,0 +1,3 @@
+install(FILES CMakeLists.txt DESTINATION foo)
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_LIST_DIR}/Example.txt")
+set(CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE OFF)