diff options
Diffstat (limited to 'Tests/RunCMake/CPack')
24 files changed, 243 insertions, 16 deletions
diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake index aef1086..7bf42f9 100644 --- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -9,6 +9,20 @@ function(run_cpack_test TEST_NAME types build) file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + if(EXISTS "${RunCMake_SOURCE_DIR}/${TEST_TYPE}/${TEST_NAME}-Prerequirements.cmake") + include("${RunCMake_SOURCE_DIR}/${TEST_TYPE}/${TEST_NAME}-Prerequirements.cmake") + + set(FOUND_PREREQUIREMENTS false) + get_test_prerequirements("FOUND_PREREQUIREMENTS" + "${TEST_CONFIG_DIR}/${type}_config.cmake") + + # skip the test if prerequirements are not met + if(NOT FOUND_PREREQUIREMENTS) + message(STATUS "${TEST_NAME} - SKIPPED") + return() + endif() + endif() + # execute cmake set(RunCMake_TEST_OPTIONS "-DGENERATOR_TYPE=${TEST_TYPE}") run_cmake(${TEST_NAME}) diff --git a/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake index 5adca68..62f2f9c 100644 --- a/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake @@ -1,5 +1,5 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_1 "components_empty_dir*.deb") +set(EXPECTED_FILE_1 "components_empty_dir-test_0.1.1-1_*.deb") set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/empty/$") diff --git a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake index 2ff679a..4531a34 100644 --- a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake @@ -1,9 +1,9 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "3") -set(EXPECTED_FILE_1 "deb_extra-*-foo.deb") +set(EXPECTED_FILE_1 "deb_extra-foo_0.1.1-1_*.deb") set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/foo/${whitespaces_}.*/usr/foo/CMakeLists.txt$") -set(EXPECTED_FILE_2 "deb_extra-*-bar.deb") +set(EXPECTED_FILE_2 "deb_extra-bar_0.1.1-1_*.deb") set(EXPECTED_FILE_CONTENT_2 "^.*/usr/${whitespaces_}.*/usr/bar/${whitespaces_}.*/usr/bar/CMakeLists.txt$") -set(EXPECTED_FILE_3 "deb_extra-*-bas.deb") +set(EXPECTED_FILE_3 "deb_extra-bas_0.1.1-1_*.deb") set(EXPECTED_FILE_CONTENT_3 "^.*/usr/${whitespaces_}.*/usr/bas/${whitespaces_}.*/usr/bas/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-ExpectedFiles.cmake new file mode 100644 index 0000000..a8efb61 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-ExpectedFiles.cmake @@ -0,0 +1,6 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "generate_shlibs_0.1.1-1_*.deb") +# dynamic lib extension is .so on Linux and .dylib on Mac so we will use a wildcard .* for it +set(EXPECTED_FILE_CONTENT_1 "^.*/usr/foo${whitespaces_}.*/usr/foo/libtest_lib\\..*$") diff --git a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-Prerequirements.cmake b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-Prerequirements.cmake new file mode 100644 index 0000000..b98065a --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-Prerequirements.cmake @@ -0,0 +1,7 @@ +function(get_test_prerequirements found_var) + find_program(READELF_EXECUTABLE NAMES readelf) + + if(READELF_EXECUTABLE) + set(${found_var} true PARENT_SCOPE) + endif() +endfunction() diff --git a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-VerifyResult.cmake b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-VerifyResult.cmake new file mode 100644 index 0000000..8ccb628 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-VerifyResult.cmake @@ -0,0 +1,3 @@ +set(shlibs_shlibs "^libtest_lib 0\\.8 generate_shlibs \\(\\= 0\\.1\\.1\\)\n$") +set(shlibs_shlibs_permissions_regex "-rw-r--r-- .*") +verifyDebControl("${FOUND_FILE_1}" "shlibs" "shlibs") diff --git a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-ExpectedFiles.cmake new file mode 100644 index 0000000..9a9dee3 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-ExpectedFiles.cmake @@ -0,0 +1,6 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "generate_shlibs_ldconfig_0.1.1-1_*.deb") +# dynamic lib extension is .so on Linux and .dylib on Mac so we will use a wildcard .* for it +set(EXPECTED_FILE_CONTENT_1 "^.*/usr/lib${whitespaces_}.*/usr/lib/libtest_lib\\..*$") diff --git a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-Prerequirements.cmake b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-Prerequirements.cmake new file mode 100644 index 0000000..b98065a --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-Prerequirements.cmake @@ -0,0 +1,7 @@ +function(get_test_prerequirements found_var) + find_program(READELF_EXECUTABLE NAMES readelf) + + if(READELF_EXECUTABLE) + set(${found_var} true PARENT_SCOPE) + endif() +endfunction() diff --git a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-VerifyResult.cmake b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-VerifyResult.cmake new file mode 100644 index 0000000..d04c641 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-VerifyResult.cmake @@ -0,0 +1,7 @@ +set(shlibs_shlibs "^libtest_lib 0\\.8 generate_shlibs_ldconfig \\(>\\= 0\\.1\\.1\\)\n$") +set(shlibs_shlibs_permissions_regex "-rw-r--r-- .*") +set(shlibs_postinst ".*ldconfig.*") +set(shlibs_postinst_permissions_regex "-rwxr-xr-x .*") +set(shlibs_postrm ".*ldconfig.*") +set(shlibs_postrm_permissions_regex "-rwxr-xr-x .*") +verifyDebControl("${FOUND_FILE_1}" "shlibs" "shlibs;postinst;postrm") diff --git a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/DEPENDENCIES-ExpectedFiles.cmake index c56c670..c182e30 100644 --- a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/DEB/DEPENDENCIES-ExpectedFiles.cmake @@ -1,14 +1,14 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "5") -set(EXPECTED_FILE_1 "dependencies*-applications.deb") +set(EXPECTED_FILE_1 "dependencies-applications_0.1.1-1_*.deb") set(EXPECTED_FILE_CONTENT_1 "^.*/usr/foo${whitespaces_}.*/usr/foo/test_prog$") -set(EXPECTED_FILE_2 "dependencies*-applications_auto.deb") +set(EXPECTED_FILE_2 "dependencies-applications_auto_0.1.1-1_*.deb") set(EXPECTED_FILE_CONTENT_2 "^.*/usr/foo_auto${whitespaces_}.*/usr/foo_auto/test_prog$") -set(EXPECTED_FILE_3 "dependencies*-headers.deb") +set(EXPECTED_FILE_3 "dependencies-headers_0.1.1-1_*.deb") set(EXPECTED_FILE_CONTENT_3 "^.*/usr/bar${whitespaces_}.*/usr/bar/CMakeLists.txt$") -set(EXPECTED_FILE_4 "dependencies*-libs.deb") +set(EXPECTED_FILE_4 "dependencies-libs_0.1.1-1_*.deb") # dynamic lib extension is .so on Linux and .dylib on Mac so we will use a wildcard .* for it set(EXPECTED_FILE_CONTENT_4 "^.*/usr/bas${whitespaces_}.*/usr/bas/libtest_lib\\..*$") -set(EXPECTED_FILE_5 "dependencies*-libs_auto.deb") +set(EXPECTED_FILE_5 "dependencies-libs_auto_0.1.1-1_*.deb") set(EXPECTED_FILE_CONTENT_5 "^.*/usr/bas_auto${whitespaces_}.*/usr/bas_auto/libtest_lib\\..*$") diff --git a/Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake index 1552a36..6dc5906 100644 --- a/Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake @@ -1,5 +1,5 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_1 "empty_dir*.deb") +set(EXPECTED_FILE_1 "empty_dir_0.1.1-1_*.deb") set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/empty/$") diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake index f490130..d05f115 100644 --- a/Tests/RunCMake/CPack/DEB/Helpers.cmake +++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake @@ -1,7 +1,7 @@ set(ALL_FILES_GLOB "*.deb") function(getPackageContent FILE RESULT_VAR) - execute_process(COMMAND ${DPKG_EXECUTABLE} -c ${FILE} + execute_process(COMMAND ${DPKG_EXECUTABLE} -c "${FILE}" OUTPUT_VARIABLE package_content_ ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) @@ -9,8 +9,73 @@ function(getPackageContent FILE RESULT_VAR) set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) endfunction() +function(getMissingShlibsErrorExtra FILE RESULT_VAR) + execute_process(COMMAND ${DPKG_EXECUTABLE} -x "${FILE}" data_${PREFIX} + ERROR_VARIABLE err_) + + if(err_) + set(error_extra " Extra: Could not unpack package content: '${err}'") + else() + cmake_policy(PUSH) + # Tell file(GLOB_RECURSE) not to follow directory symlinks + # even if the project does not set this policy to NEW. + cmake_policy(SET CMP0009 NEW) + file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/data_${PREFIX}/*") + cmake_policy(POP) + + # get file info so that we can determine if file is executable or not + foreach(FILE_ IN LISTS FILE_PATHS_) + execute_process(COMMAND file "${FILE_}" + WORKING_DIRECTORY "${WDIR}" + OUTPUT_VARIABLE INSTALL_FILE_ + ERROR_VARIABLE err_) + + if(NOT err_) + list(APPEND deb_install_files "${INSTALL_FILE_}") + else() + list(APPEND deb_install_files_errors "'${FILE_}': '${err_}'\n") + endif() + endforeach() + + set(error_extra " Extra: install files '${deb_install_files}'") + + if(deb_install_files_errors) + set(error_extra "${error_extra}; errors \"${deb_install_files_errors}\"") + endif() + + find_program(READELF_EXECUTABLE NAMES readelf) + + if(READELF_EXECUTABLE) + set(error_extra "${error_extra}; readelf \"\n") + + # Only dynamically linked ELF files are included + # Extract only file name infront of ":" + foreach(_FILE IN LISTS deb_install_files) + if(_FILE MATCHES "ELF.*shared object") + string(REGEX MATCH "(^.*):" _FILE_NAME "${_FILE}") + + execute_process(COMMAND ${READELF_EXECUTABLE} -d "${CMAKE_MATCH_1}" + WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE err_ + OUTPUT_STRIP_TRAILING_WHITESPACE) + + set(error_extra "${error_extra} name '${CMAKE_MATCH_1}'\n result '${result}'\n output '${output}'\n error '${err_}'\n") + endif() + endforeach() + + set(error_extra "${error_extra}\"") + else() + set(error_extra "${error_extra}; error readelf missing") + endif() + endif() + + set(${RESULT_VAR} "${error_extra}" PARENT_SCOPE) +endfunction() + function(verifyDebControl FILE PREFIX VERIFY_FILES) - execute_process(COMMAND ${DPKG_EXECUTABLE} --control ${FILE} control_${PREFIX} + execute_process(COMMAND ${DPKG_EXECUTABLE} --control "${FILE}" control_${PREFIX} ERROR_VARIABLE err_) if(err_) @@ -19,6 +84,14 @@ function(verifyDebControl FILE PREFIX VERIFY_FILES) endif() foreach(FILE_ IN LISTS VERIFY_FILES) + if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/control_${PREFIX}/${FILE_}") + if(FILE_ STREQUAL "shlibs") + getMissingShlibsErrorExtra("${FILE}" error_extra) + endif() + + message(FATAL_ERROR "Expected Debian control file does not exist: '${FILE_}'${error_extra}") + endif() + file(READ "${CMAKE_CURRENT_BINARY_DIR}/control_${PREFIX}/${FILE_}" content_) if(NOT content_ MATCHES "${${PREFIX}_${FILE_}}") message(FATAL_ERROR "Unexpected content in for '${PREFIX}_${FILE_}'!" diff --git a/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake index 9e4aa7c..648c866 100644 --- a/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake @@ -1,5 +1,5 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_1 "minimal*.deb") +set(EXPECTED_FILE_1 "minimal_0.1.1-1_*.deb") set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/foo/${whitespaces_}.*/usr/foo/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-ExpectedFiles.cmake index 1f6c11b..40f6730 100644 --- a/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-ExpectedFiles.cmake @@ -1,9 +1,9 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "3") -set(EXPECTED_FILE_1 "per_component*-pkg_1.deb") +set(EXPECTED_FILE_1 "per_component-pkg_1_0.1.1-1_*.deb") set(EXPECTED_FILE_CONTENT_1 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$") -set(EXPECTED_FILE_2 "per_component*-pkg_2.deb") +set(EXPECTED_FILE_2 "second_0.1.1-1_*.deb") set(EXPECTED_FILE_CONTENT_2 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$") -set(EXPECTED_FILE_3 "per_component*-pkg_3.deb") +set(EXPECTED_FILE_3 "per_component-pkg_3_0.1.1-1_*.deb") set(EXPECTED_FILE_CONTENT_3 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS.cmake b/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS.cmake new file mode 100644 index 0000000..efb0211 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS.cmake @@ -0,0 +1,17 @@ +set(CPACK_PACKAGE_CONTACT "someone") +set(CPACK_DEB_COMPONENT_INSTALL "ON") + +set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS "ON") + +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" + "int test_lib();\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" + "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n") +add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp") +set_target_properties(test_lib PROPERTIES SOVERSION "0.8") + +install(TARGETS test_lib DESTINATION foo COMPONENT libs) + +set(CPACK_PACKAGE_NAME "generate_shlibs") diff --git a/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS_LDCONFIG.cmake b/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS_LDCONFIG.cmake new file mode 100644 index 0000000..1f70386 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS_LDCONFIG.cmake @@ -0,0 +1,18 @@ +set(CPACK_PACKAGE_CONTACT "someone") +set(CPACK_DEB_COMPONENT_INSTALL "ON") + +set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS "ON") +set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY ">=") + +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" + "int test_lib();\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" + "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n") +add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp") +set_target_properties(test_lib PROPERTIES SOVERSION "0.8") + +install(TARGETS test_lib LIBRARY DESTINATION lib COMPONENT libs NAMELINK_SKIP) + +set(CPACK_PACKAGE_NAME "generate_shlibs_ldconfig") diff --git a/Tests/RunCMake/CPack/README.txt b/Tests/RunCMake/CPack/README.txt index ea68304..5c86880 100644 --- a/Tests/RunCMake/CPack/README.txt +++ b/Tests/RunCMake/CPack/README.txt @@ -1,6 +1,9 @@ RunCMake.CPack is a test module that is intended for testing of package generators that can be validated from command line. +TODO: all tests should cover all packaging types (single package, grouped and + component packaging) + ------------- Adding a test ------------- @@ -19,10 +22,29 @@ run_cpack_test(<test_name> "<generator_name>") will be run for all listed generators. Test consists of +- test prerequirements phase (optional) - CMake execution phase - CPack execution phase - verification of generated files +test prerequirements phase (optional): +-------------------------------------- + +In some cases individual tests for certain generator need additional +prerequirements met. + +In such cases '<generator_name>/<test_name>-Prerequirements.cmake' file +containing 'function(get_test_prerequirements found_var)' should be created. +Function should return true if all prerequirements are met. + +If prerequirements are not met test will be skipped outputting +'<test_name> - SKIPPED' string. Note that this doesn't fail the entire test +group. + +TODO: skipped tests should provide expected error string so test should fail + if error string is not found in the output of run test (this would add + 'EXPECTED FAIL' string on success and 'ERROR' on failure). + CMake execution phase: ---------------------- diff --git a/Tests/RunCMake/CPack/RPM/RPM_CUSTOM_NAMES-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/RPM_CUSTOM_NAMES-ExpectedFiles.cmake new file mode 100644 index 0000000..780e57e --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/RPM_CUSTOM_NAMES-ExpectedFiles.cmake @@ -0,0 +1,9 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "3") +set(EXPECTED_FILE_1 "custom_names-pkg_1*.rpm") +set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") +set(EXPECTED_FILE_2 "second*.rpm") +set(EXPECTED_FILE_CONTENT_2 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") +set(EXPECTED_FILE_3 "pkg_3_abc.rpm") +set(EXPECTED_FILE_CONTENT_3 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/RPM/RPM_CUSTOM_NAMES-stderr.txt b/Tests/RunCMake/CPack/RPM/RPM_CUSTOM_NAMES-stderr.txt new file mode 100644 index 0000000..d3ba7b0 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/RPM_CUSTOM_NAMES-stderr.txt @@ -0,0 +1,3 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/RPM_CUSTOM_NAMES-build/_CPack_Packages/.*/RPM/SPECS/custom_names-pkg_1.spec +CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/RPM_CUSTOM_NAMES-build/_CPack_Packages/.*/RPM/SPECS/second.spec +CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/RPM_CUSTOM_NAMES-build/_CPack_Packages/.*/RPM/SPECS/custom_names-pkg_3.spec$ diff --git a/Tests/RunCMake/CPack/RPM/RPM_DIST-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/RPM_DIST-ExpectedFiles.cmake new file mode 100644 index 0000000..3b5a347 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/RPM_DIST-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "rpm_dist*.rpm") +set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/RPM/RPM_DIST-VerifyResult.cmake b/Tests/RunCMake/CPack/RPM/RPM_DIST-VerifyResult.cmake new file mode 100644 index 0000000..7375ecc --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/RPM_DIST-VerifyResult.cmake @@ -0,0 +1,11 @@ +execute_process(COMMAND ${RPMBUILD_EXECUTABLE} -E %{?dist} + OUTPUT_VARIABLE DIST_TAG + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + +set(whitespaces_ "[\t\n\r ]*") + +getPackageInfo("${FOUND_FILE_1}" "FILE_INFO_") +if(NOT FILE_INFO_ MATCHES ".*Release${whitespaces_}:${whitespaces_}1${DIST_TAG}") + message(FATAL_ERROR "Unexpected Release in '${FOUND_FILE_1}'; file info: '${FILE_INFO_}'") +endif() diff --git a/Tests/RunCMake/CPack/RPM_CUSTOM_NAMES.cmake b/Tests/RunCMake/CPack/RPM_CUSTOM_NAMES.cmake new file mode 100644 index 0000000..ba53a87 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM_CUSTOM_NAMES.cmake @@ -0,0 +1,11 @@ +set(CPACK_RPM_COMPONENT_INSTALL "ON") + +set(CPACK_RPM_FILE_NAME "RPM-DEFAULT") +set(CPACK_RPM_PKG_2_PACKAGE_NAME "second") +set(CPACK_RPM_PKG_3_FILE_NAME "pkg_3_abc.rpm") + +install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1) +install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_2) +install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_3) + +set(CPACK_PACKAGE_NAME "custom_names") diff --git a/Tests/RunCMake/CPack/RPM_DIST.cmake b/Tests/RunCMake/CPack/RPM_DIST.cmake new file mode 100644 index 0000000..eb2a123 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM_DIST.cmake @@ -0,0 +1,4 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) + +set(CPACK_RPM_PACKAGE_RELEASE_DIST ON) +set(CPACK_PACKAGE_NAME "rpm_dist") diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index ee4112d..759295f 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -10,5 +10,9 @@ run_cpack_test(DEB_EXTRA "DEB" false) run_cpack_test(DEPENDENCIES "RPM;DEB" true) run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true) run_cpack_test(COMPONENTS_EMPTY_DIR "RPM;DEB;TGZ" true) +run_cpack_test(RPM_CUSTOM_NAMES "RPM" true) run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false) +run_cpack_test(RPM_DIST "RPM" false) run_cpack_test(INSTALL_SCRIPTS "RPM" false) +run_cpack_test(DEB_GENERATE_SHLIBS "DEB" true) +run_cpack_test(DEB_GENERATE_SHLIBS_LDCONFIG "DEB" true) |