diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2018-06-11 19:33:23 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2018-07-02 13:51:02 (GMT) |
commit | 2ef966bc77e9efd036747ee9d6977e2f2c7e024d (patch) | |
tree | 3823d55e5706dfee4aa903766956df4246b8de97 /Tests/RunCMake/CPack/tests | |
parent | 80914d88da3e5c997158fd3cc703a39b6673f780 (diff) | |
download | CMake-2ef966bc77e9efd036747ee9d6977e2f2c7e024d.zip CMake-2ef966bc77e9efd036747ee9d6977e2f2c7e024d.tar.gz CMake-2ef966bc77e9efd036747ee9d6977e2f2c7e024d.tar.bz2 |
Testing: Add test for CPack External generator
This test case ensures that the CPack External generator produces
the proper .json file, and also ensures that the version negotation
with CPACK_EXT_REQUESTED_VERSIONS works properly.
Diffstat (limited to 'Tests/RunCMake/CPack/tests')
7 files changed, 286 insertions, 0 deletions
diff --git a/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake new file mode 100644 index 0000000..2634111 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake @@ -0,0 +1,6 @@ +if(RunCMake_SUBTEST_SUFFIX MATCHES "^(none|good(_multi)?|invalid_good)$") + set(EXPECTED_FILES_COUNT "1") + set(EXPECTED_FILE_CONTENT_1_LIST "/share;/share/cpack-test;/share/cpack-test/f1.txt;/share/cpack-test/f2.txt;/share/cpack-test/f3.txt;/share/cpack-test/f4.txt") +else() + set(EXPECTED_FILES_COUNT "0") +endif() diff --git a/Tests/RunCMake/CPack/tests/EXT/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/EXT/VerifyResult.cmake new file mode 100644 index 0000000..97b74f7 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/VerifyResult.cmake @@ -0,0 +1,3 @@ +if(RunCMake_SUBTEST_SUFFIX MATCHES "^(none|good(_multi)?|invalid_good)") + check_ext_json("${src_dir}/tests/EXT/expected-json-1.0.txt" "${FOUND_FILE_1}") +endif() diff --git a/Tests/RunCMake/CPack/tests/EXT/bad_major-stderr.txt b/Tests/RunCMake/CPack/tests/EXT/bad_major-stderr.txt new file mode 100644 index 0000000..372c5e4 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/bad_major-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/Internal/CPack/CPackExt\.cmake:[0-9]+ \(message\): + Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS + + +CPack Error: Error while executing CPackExt\.cmake +CPack Error: Cannot initialize the generator Ext diff --git a/Tests/RunCMake/CPack/tests/EXT/bad_minor-stderr.txt b/Tests/RunCMake/CPack/tests/EXT/bad_minor-stderr.txt new file mode 100644 index 0000000..372c5e4 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/bad_minor-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/Internal/CPack/CPackExt\.cmake:[0-9]+ \(message\): + Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS + + +CPack Error: Error while executing CPackExt\.cmake +CPack Error: Cannot initialize the generator Ext diff --git a/Tests/RunCMake/CPack/tests/EXT/expected-json-1.0.txt b/Tests/RunCMake/CPack/tests/EXT/expected-json-1.0.txt new file mode 100644 index 0000000..b96cf0b --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/expected-json-1.0.txt @@ -0,0 +1,176 @@ +^\{ + "componentGroups" :[ ] + \{ + "f12" :[ ] + \{ + "components" :[ ] + \[ + "f1", + "f2" + \], + "description" : "Component group for files 1 and 2", + "displayName" : "Files 1 and 2", + "isBold" : false, + "isExpandedByDefault" : false, + "name" : "f12", + "parentGroup" : "f1234", + "subgroups" : \[\] + \}, + "f1234" :[ ] + \{ + "components" : \[\], + "description" : "Component group for all files", + "displayName" : "Files 1-4", + "isBold" : false, + "isExpandedByDefault" : false, + "name" : "f1234", + "subgroups" :[ ] + \[ + "f12", + "f34" + \] + \}, + "f34" :[ ] + \{ + "components" :[ ] + \[ + "f3", + "f4" + \], + "description" : "Component group for files 3 and 4", + "displayName" : "Files 3 and 4", + "isBold" : false, + "isExpandedByDefault" : false, + "name" : "f34", + "parentGroup" : "f1234", + "subgroups" : \[\] + \} + \}, + "components" :[ ] + \{ + "f1" :[ ] + \{ + "archiveFile" : "", + "dependencies" : \[\], + "description" : "Component for file 1", + "displayName" : "File 1", + "group" : "f12", + "installationTypes" :[ ] + \[ + "full", + "f12" + \], + "isDisabledByDefault" : false, + "isDownloaded" : false, + "isHidden" : false, + "isRequired" : false, + "name" : "f1" + \}, + "f2" :[ ] + \{ + "archiveFile" : "", + "dependencies" :[ ] + \[ + "f1" + \], + "description" : "Component for file 2", + "displayName" : "File 2", + "group" : "f12", + "installationTypes" :[ ] + \[ + "full", + "f12" + \], + "isDisabledByDefault" : false, + "isDownloaded" : false, + "isHidden" : false, + "isRequired" : false, + "name" : "f2" + \}, + "f3" :[ ] + \{ + "archiveFile" : "", + "dependencies" :[ ] + \[ + "f1", + "f2" + \], + "description" : "Component for file 3", + "displayName" : "File 3", + "group" : "f34", + "installationTypes" :[ ] + \[ + "full" + \], + "isDisabledByDefault" : false, + "isDownloaded" : false, + "isHidden" : false, + "isRequired" : false, + "name" : "f3" + \}, + "f4" :[ ] + \{ + "archiveFile" : "", + "dependencies" :[ ] + \[ + "f2", + "f3", + "f1" + \], + "description" : "Component for file 4", + "displayName" : "File 4", + "group" : "f34", + "installationTypes" :[ ] + \[ + "full" + \], + "isDisabledByDefault" : false, + "isDownloaded" : false, + "isHidden" : false, + "isRequired" : false, + "name" : "f4" + \} + \}, + "errorOnAbsoluteInstallDestination" : false, + "formatVersionMajor" : 1, + "formatVersionMinor" : 0, + "installationTypes" :[ ] + \{ + "f12" :[ ] + \{ + "displayName" : "Only files 1 and 2", + "index" : 2, + "name" : "f12" + \}, + "full" :[ ] + \{ + "displayName" : "Full installation", + "index" : 1, + "name" : "full" + \} + \}, + "packageDescriptionFile" : ".*/Templates/CPack\.GenericDescription\.txt", + "packageDescriptionSummary" : "EXT-(none|good(_multi)?|invalid_good)-subtest-(MONOLITHIC|COMPONENT)-type built using CMake", + "packageName" : "ext", + "packageVersion" : "0\.1\.1", + "projects" :[ ] + \[ + \{ + "component" : "ALL", + "components" :[ ] + \[ + "f1", + "f2", + "f3", + "f4" + \], + "directory" : ".*/Tests/RunCMake/Ext/CPack/EXT-build-(none|good(_multi)?|invalid_good)-subtest", + "installationTypes" : \[\], + "projectName" : "EXT-(none|good(_multi)?|invalid_good)-subtest-(MONOLITHIC|COMPONENT)-type", + "subDirectory" : "/" + \} + \], + "setDestdir" : false, + "stripFiles" : false, + "warnOnAbsoluteInstallDestination" : false +\}$ diff --git a/Tests/RunCMake/CPack/tests/EXT/invalid_bad-stderr.txt b/Tests/RunCMake/CPack/tests/EXT/invalid_bad-stderr.txt new file mode 100644 index 0000000..372c5e4 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/invalid_bad-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/Internal/CPack/CPackExt\.cmake:[0-9]+ \(message\): + Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS + + +CPack Error: Error while executing CPackExt\.cmake +CPack Error: Cannot initialize the generator Ext diff --git a/Tests/RunCMake/CPack/tests/EXT/test.cmake b/Tests/RunCMake/CPack/tests/EXT/test.cmake new file mode 100644 index 0000000..6bd3cb8 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/test.cmake @@ -0,0 +1,83 @@ +include(CPackComponent) + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "none") + unset(CPACK_EXT_REQUESTED_VERSIONS) +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "good") + set(CPACK_EXT_REQUESTED_VERSIONS "1.0") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "good_multi") + set(CPACK_EXT_REQUESTED_VERSIONS "1.0;2.0") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "bad_major") + set(CPACK_EXT_REQUESTED_VERSIONS "2.0") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "bad_minor") + set(CPACK_EXT_REQUESTED_VERSIONS "1.1") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_good") + set(CPACK_EXT_REQUESTED_VERSIONS "1;1.0") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_bad") + set(CPACK_EXT_REQUESTED_VERSIONS "1") +endif() + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f1.txt" test1) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f2.txt" test2) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f3.txt" test3) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f4.txt" test4) + +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f1.txt" DESTINATION share/cpack-test COMPONENT f1) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f2.txt" DESTINATION share/cpack-test COMPONENT f2) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f3.txt" DESTINATION share/cpack-test COMPONENT f3) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f4.txt" DESTINATION share/cpack-test COMPONENT f4) + +cpack_add_component(f1 + DISPLAY_NAME "File 1" + DESCRIPTION "Component for file 1" + GROUP f12 + INSTALL_TYPES full f12 +) + +cpack_add_component(f2 + DISPLAY_NAME "File 2" + DESCRIPTION "Component for file 2" + GROUP f12 + DEPENDS f1 + INSTALL_TYPES full f12 +) + +cpack_add_component(f3 + DISPLAY_NAME "File 3" + DESCRIPTION "Component for file 3" + GROUP f34 + DEPENDS f1 f2 + INSTALL_TYPES full +) + +cpack_add_component(f4 + DISPLAY_NAME "File 4" + DESCRIPTION "Component for file 4" + GROUP f34 + DEPENDS f2 f3 f1 + INSTALL_TYPES full +) + +cpack_add_component_group(f12 + DISPLAY_NAME "Files 1 and 2" + DESCRIPTION "Component group for files 1 and 2" + PARENT_GROUP f1234 +) + +cpack_add_component_group(f34 + DISPLAY_NAME "Files 3 and 4" + DESCRIPTION "Component group for files 3 and 4" + PARENT_GROUP f1234 +) + +cpack_add_component_group(f1234 + DISPLAY_NAME "Files 1-4" + DESCRIPTION "Component group for all files" +) + +cpack_add_install_type(full + DISPLAY_NAME "Full installation" +) + +cpack_add_install_type(f12 + DISPLAY_NAME "Only files 1 and 2" +) |