diff options
author | Brad King <brad.king@kitware.com> | 2017-01-24 19:45:35 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2017-01-24 19:45:35 (GMT) |
commit | c59d381065b14076f47246f21ecd730cfdbae7a1 (patch) | |
tree | 4cf4d1286af0021411e32c1aa91ba0f5a2a5195d /Tests/RunCMake | |
parent | 38bb96386cdc331d6fd080166318ff8272fc19eb (diff) | |
parent | 624709c824a2d7a75a36dc23551377bdc2aee648 (diff) | |
download | CMake-c59d381065b14076f47246f21ecd730cfdbae7a1.zip CMake-c59d381065b14076f47246f21ecd730cfdbae7a1.tar.gz CMake-c59d381065b14076f47246f21ecd730cfdbae7a1.tar.bz2 |
Merge topic 'cpack-stgz-minimal-test'
624709c8 CPack/STGZ: minimalistic packages test
1c93eb68 CPack/STGZ prefer pax for extraction
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/RunCMakeTest.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/STGZ/Helpers.cmake | 64 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/STGZ/Prerequirements.cmake | 11 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/STGZ/packaging_COMPONENT_default.cmake | 1 |
5 files changed, 78 insertions, 2 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index d2465c4..a43e47b 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -345,7 +345,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") add_RunCMake_test(CompilerLauncher) endif() -add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP") +add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ") # add a test to make sure symbols are exported from a shared library # for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used add_RunCMake_test(AutoExportDll) diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index ebaf792..65399db 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -16,7 +16,7 @@ run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB" true "COMPONENT") run_cpack_test(INSTALL_SCRIPTS "RPM" false "COMPONENT") run_cpack_test(LONG_FILENAMES "DEB" false "MONOLITHIC") run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM" false "COMPONENT") -run_cpack_test(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP" false "MONOLITHIC;COMPONENT") +run_cpack_test(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512" "TGZ" false "MONOLITHIC") run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false "COMPONENT") run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false "COMPONENT") diff --git a/Tests/RunCMake/CPack/STGZ/Helpers.cmake b/Tests/RunCMake/CPack/STGZ/Helpers.cmake new file mode 100644 index 0000000..08224d3 --- /dev/null +++ b/Tests/RunCMake/CPack/STGZ/Helpers.cmake @@ -0,0 +1,64 @@ +set(ALL_FILES_GLOB "*.sh") + +function(getPackageContent FILE RESULT_VAR) + get_filename_component(path_ "${FILE}" DIRECTORY) + file(REMOVE_RECURSE "${path_}/content") + file(MAKE_DIRECTORY "${path_}/content") + execute_process(COMMAND ${FILE} --prefix=${path_}/content --include-subdir + RESULT_VARIABLE extract_result_ + ERROR_VARIABLE extract_error_ + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(extract_result_) + message(FATAL_ERROR "Extracting STGZ archive failed: '${extract_result_}';" + " '${extract_error_}'.") + endif() + + file(GLOB_RECURSE package_content_ LIST_DIRECTORIES true RELATIVE + "${path_}/content" "${path_}/content/*") + + set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) +endfunction() + +function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_VAR) + if(COMPONENT) + set(COMPONENT "-${COMPONENT}") + endif() + + set(${RESULT_VAR} "${NAME}-${VERSION}-*${COMPONENT}.sh" PARENT_SCOPE) +endfunction() + +function(getPackageContentList FILE RESULT_VAR) + getPackageContent("${FILE}" package_content_) + + set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) +endfunction() + +function(toExpectedContentList FILE_NO CONTENT_VAR) + findExpectedFile("${FILE_NO}" "file_") + + get_filename_component(prefix_ "${file_}" NAME) + # NAME_WE removes everything after the dot and dot is in version so replace instead + string(REPLACE ".sh" "" prefix_ "${prefix_}") + + if(NOT PACKAGING_TYPE STREQUAL "MONOLITHIC") + # STGZ packages don't have component dir prefix in subdir + string(FIND "${prefix_}" "-" pos_ REVERSE) + string(SUBSTRING "${prefix_}" 0 ${pos_} prefix_) + endif() + + if(NOT DEFINED TEST_MAIN_INSTALL_PREFIX_PATH) + set(TEST_MAIN_INSTALL_PREFIX_PATH "/usr") + endif() + + set(filtered_ "${prefix_}") + foreach(part_ IN LISTS ${CONTENT_VAR}) + string(REGEX REPLACE "^${TEST_MAIN_INSTALL_PREFIX_PATH}(/|$)" "" part_ "${part_}") + + if(part_) + list(APPEND filtered_ "${prefix_}/${part_}") + endif() + endforeach() + + set(${CONTENT_VAR} "${filtered_}" PARENT_SCOPE) +endfunction() diff --git a/Tests/RunCMake/CPack/STGZ/Prerequirements.cmake b/Tests/RunCMake/CPack/STGZ/Prerequirements.cmake new file mode 100644 index 0000000..3b015ca --- /dev/null +++ b/Tests/RunCMake/CPack/STGZ/Prerequirements.cmake @@ -0,0 +1,11 @@ +function(get_test_prerequirements found_var config_file) + if(EXISTS "/bin/sh") + #gunzip is not part of posix so we should not rely on it being installed + find_program(GUNZIP_EXECUTABLE gunzip) + + if(GUNZIP_EXECUTABLE) + file(WRITE "${config_file}" "") + set(${found_var} true PARENT_SCOPE) + endif() + endif() +endfunction() diff --git a/Tests/RunCMake/CPack/STGZ/packaging_COMPONENT_default.cmake b/Tests/RunCMake/CPack/STGZ/packaging_COMPONENT_default.cmake new file mode 100644 index 0000000..81a5035 --- /dev/null +++ b/Tests/RunCMake/CPack/STGZ/packaging_COMPONENT_default.cmake @@ -0,0 +1 @@ +set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON") |