mirror of
https://github.com/reactos/CMake.git
synced 2024-12-13 22:58:41 +00:00
CPack/Archive minimal tests for more formats
This commit is contained in:
parent
e8e9034596
commit
5b0a64ebc5
@ -345,7 +345,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
|
||||
add_RunCMake_test(CompilerLauncher)
|
||||
endif()
|
||||
|
||||
add_RunCMake_test_group(CPack "DEB;RPM;TGZ")
|
||||
add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP")
|
||||
# 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)
|
||||
|
3
Tests/RunCMake/CPack/7Z/Helpers.cmake
Normal file
3
Tests/RunCMake/CPack/7Z/Helpers.cmake
Normal file
@ -0,0 +1,3 @@
|
||||
set(cpack_archive_extension_ "7z")
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/../ArchiveCommon/common_helpers.cmake")
|
4
Tests/RunCMake/CPack/7Z/Prerequirements.cmake
Normal file
4
Tests/RunCMake/CPack/7Z/Prerequirements.cmake
Normal file
@ -0,0 +1,4 @@
|
||||
function(get_test_prerequirements found_var config_file)
|
||||
file(WRITE "${config_file}" "")
|
||||
set(${found_var} true PARENT_SCOPE)
|
||||
endfunction()
|
@ -0,0 +1 @@
|
||||
set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON")
|
62
Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake
Normal file
62
Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake
Normal file
@ -0,0 +1,62 @@
|
||||
set(ALL_FILES_GLOB "*.${cpack_archive_extension_}")
|
||||
|
||||
function(getPackageContent FILE RESULT_VAR)
|
||||
# TODO for some types this only works because libarchive handles it... (not
|
||||
# part of for e.g. gnu tar)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar -xtf ${FILE}
|
||||
OUTPUT_VARIABLE package_content_
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
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}.${cpack_archive_extension_}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(getPackageContentList FILE RESULT_VAR)
|
||||
getPackageContent("${FILE}" package_content_)
|
||||
|
||||
string(REPLACE "\n" ";" package_content_ "${package_content_}")
|
||||
foreach(i_ IN LISTS package_content_)
|
||||
string(REGEX REPLACE "/$" "" result_ "${i_}")
|
||||
list(APPEND items_ "${result_}")
|
||||
endforeach()
|
||||
|
||||
set(${RESULT_VAR} "${items_}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(toExpectedContentList FILE_NO CONTENT_VAR)
|
||||
findExpectedFile("${FILE_NO}" "file_")
|
||||
|
||||
# component and monolithic packages differ for some reason by either having
|
||||
# package filename prefix in path or not
|
||||
if(PACKAGING_TYPE STREQUAL "MONOLITHIC")
|
||||
get_filename_component(prefix_ "${file_}" NAME)
|
||||
# NAME_WE removes everything after the dot and dot is in version so replace instead
|
||||
string(REPLACE ".${cpack_archive_extension_}" "/" prefix_ "${prefix_}")
|
||||
else()
|
||||
unset(prefix_)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED TEST_MAIN_INSTALL_PREFIX_PATH)
|
||||
set(TEST_MAIN_INSTALL_PREFIX_PATH "/usr")
|
||||
endif()
|
||||
|
||||
unset(filtered_)
|
||||
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()
|
@ -15,7 +15,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;TGZ" false "MONOLITHIC")
|
||||
run_cpack_test(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP" false "MONOLITHIC")
|
||||
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")
|
||||
|
3
Tests/RunCMake/CPack/TBZ2/Helpers.cmake
Normal file
3
Tests/RunCMake/CPack/TBZ2/Helpers.cmake
Normal file
@ -0,0 +1,3 @@
|
||||
set(cpack_archive_extension_ "tar.bz2")
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/../ArchiveCommon/common_helpers.cmake")
|
4
Tests/RunCMake/CPack/TBZ2/Prerequirements.cmake
Normal file
4
Tests/RunCMake/CPack/TBZ2/Prerequirements.cmake
Normal file
@ -0,0 +1,4 @@
|
||||
function(get_test_prerequirements found_var config_file)
|
||||
file(WRITE "${config_file}" "")
|
||||
set(${found_var} true PARENT_SCOPE)
|
||||
endfunction()
|
@ -0,0 +1 @@
|
||||
set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON")
|
@ -1,62 +1,3 @@
|
||||
set(ALL_FILES_GLOB "*.tar.gz")
|
||||
set(cpack_archive_extension_ "tar.gz")
|
||||
|
||||
function(getPackageContent FILE RESULT_VAR)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar -ztvf ${FILE}
|
||||
OUTPUT_VARIABLE package_content_
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
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}.tar.gz" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(getPackageContentList FILE RESULT_VAR)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar -ztf ${FILE}
|
||||
OUTPUT_VARIABLE package_content_
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
string(REPLACE "\n" ";" package_content_ "${package_content_}")
|
||||
foreach(i_ IN LISTS package_content_)
|
||||
string(REGEX REPLACE "/$" "" result_ "${i_}")
|
||||
list(APPEND items_ "${result_}")
|
||||
endforeach()
|
||||
|
||||
set(${RESULT_VAR} "${items_}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(toExpectedContentList FILE_NO CONTENT_VAR)
|
||||
findExpectedFile("${FILE_NO}" "file_")
|
||||
|
||||
# component and monolithic packages differ for some reason by either having
|
||||
# package filename prefix in path or not
|
||||
if(PACKAGING_TYPE STREQUAL "MONOLITHIC")
|
||||
get_filename_component(prefix_ "${file_}" NAME)
|
||||
# NAME_WE removes everything after the dot and dot is in version so replace instead
|
||||
string(REPLACE ".tar.gz" "/" prefix_ "${prefix_}")
|
||||
else()
|
||||
unset(prefix_)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED TEST_MAIN_INSTALL_PREFIX_PATH)
|
||||
set(TEST_MAIN_INSTALL_PREFIX_PATH "/usr")
|
||||
endif()
|
||||
|
||||
unset(filtered_)
|
||||
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()
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/../ArchiveCommon/common_helpers.cmake")
|
||||
|
3
Tests/RunCMake/CPack/TXZ/Helpers.cmake
Normal file
3
Tests/RunCMake/CPack/TXZ/Helpers.cmake
Normal file
@ -0,0 +1,3 @@
|
||||
set(cpack_archive_extension_ "tar.xz")
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/../ArchiveCommon/common_helpers.cmake")
|
4
Tests/RunCMake/CPack/TXZ/Prerequirements.cmake
Normal file
4
Tests/RunCMake/CPack/TXZ/Prerequirements.cmake
Normal file
@ -0,0 +1,4 @@
|
||||
function(get_test_prerequirements found_var config_file)
|
||||
file(WRITE "${config_file}" "")
|
||||
set(${found_var} true PARENT_SCOPE)
|
||||
endfunction()
|
@ -0,0 +1 @@
|
||||
set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON")
|
3
Tests/RunCMake/CPack/TZ/Helpers.cmake
Normal file
3
Tests/RunCMake/CPack/TZ/Helpers.cmake
Normal file
@ -0,0 +1,3 @@
|
||||
set(cpack_archive_extension_ "tar.Z")
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/../ArchiveCommon/common_helpers.cmake")
|
4
Tests/RunCMake/CPack/TZ/Prerequirements.cmake
Normal file
4
Tests/RunCMake/CPack/TZ/Prerequirements.cmake
Normal file
@ -0,0 +1,4 @@
|
||||
function(get_test_prerequirements found_var config_file)
|
||||
file(WRITE "${config_file}" "")
|
||||
set(${found_var} true PARENT_SCOPE)
|
||||
endfunction()
|
@ -0,0 +1 @@
|
||||
set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON")
|
3
Tests/RunCMake/CPack/ZIP/Helpers.cmake
Normal file
3
Tests/RunCMake/CPack/ZIP/Helpers.cmake
Normal file
@ -0,0 +1,3 @@
|
||||
set(cpack_archive_extension_ "zip")
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/../ArchiveCommon/common_helpers.cmake")
|
4
Tests/RunCMake/CPack/ZIP/Prerequirements.cmake
Normal file
4
Tests/RunCMake/CPack/ZIP/Prerequirements.cmake
Normal file
@ -0,0 +1,4 @@
|
||||
function(get_test_prerequirements found_var config_file)
|
||||
file(WRITE "${config_file}" "")
|
||||
set(${found_var} true PARENT_SCOPE)
|
||||
endfunction()
|
@ -0,0 +1 @@
|
||||
set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON")
|
@ -1 +1,5 @@
|
||||
install(FILES CMakeLists.txt DESTINATION foo COMPONENT test)
|
||||
|
||||
if(PACKAGING_TYPE STREQUAL "COMPONENT")
|
||||
set(CPACK_COMPONENTS_ALL test)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user