diff options
author | Domen Vrankar <domen.vrankar@gmail.com> | 2016-11-27 13:00:29 (GMT) |
---|---|---|
committer | Domen Vrankar <domen.vrankar@gmail.com> | 2016-11-27 22:20:35 (GMT) |
commit | ed8858edb7c5100e1928c5a94f85485f0e322aa7 (patch) | |
tree | c0dee147388fa9dc2c0c57d666d0ada9ee041a85 | |
parent | 8575affa4c72e1c0d07f964d2f28eb6ddbadb291 (diff) | |
download | CMake-ed8858edb7c5100e1928c5a94f85485f0e322aa7.zip CMake-ed8858edb7c5100e1928c5a94f85485f0e322aa7.tar.gz CMake-ed8858edb7c5100e1928c5a94f85485f0e322aa7.tar.bz2 |
Tests: CPack test unify expected file naming
Each generator generates its own file
format with different extensions but
they all create those file names by
a certain pattern and all of them
require the same pieces for that pattern
to work. Now we can only provide pieces
once and and each generator will use those
pieces to generate an expected file name.
27 files changed, 122 insertions, 54 deletions
diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake index 9b1be22..e5cda08 100644 --- a/Tests/RunCMake/CPack/DEB/Helpers.cmake +++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake @@ -9,6 +9,26 @@ function(getPackageContent FILE RESULT_VAR) set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) endfunction() +function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_VAR) + if(COMPONENT) + set(COMPONENT "-${COMPONENT}") + endif() + + if(DEFINED EXPECTED_FILE_${FILE_NO}_FILENAME_GENERATOR_SPECIFIC_FORMAT) + set(GENERATOR_SPECIFIC_FORMAT "${EXPECTED_FILE_${FILE_NO}_FILENAME_GENERATOR_SPECIFIC_FORMAT}") + elseif(DEFINED EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT) + set(GENERATOR_SPECIFIC_FORMAT "${EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT}") + else() + set(GENERATOR_SPECIFIC_FORMAT FALSE) + endif() + + if(GENERATOR_SPECIFIC_FORMAT) + set(${RESULT_VAR} "${NAME}${COMPONENT}_${VERSION}-${REVISION}_*.deb" PARENT_SCOPE) + else() + set(${RESULT_VAR} "${NAME}-${VERSION}-*${COMPONENT}.deb" PARENT_SCOPE) + endif() +endfunction() + function(getMissingShlibsErrorExtra FILE RESULT_VAR) execute_process(COMMAND ${DPKG_EXECUTABLE} -x "${FILE}" data_${PREFIX} ERROR_VARIABLE err_) diff --git a/Tests/RunCMake/CPack/RPM/Helpers.cmake b/Tests/RunCMake/CPack/RPM/Helpers.cmake index ba77a4a..9ed03e2 100644 --- a/Tests/RunCMake/CPack/RPM/Helpers.cmake +++ b/Tests/RunCMake/CPack/RPM/Helpers.cmake @@ -9,6 +9,26 @@ function(getPackageContent FILE RESULT_VAR) set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) endfunction() +function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_VAR) + if(COMPONENT) + set(COMPONENT "-${COMPONENT}") + endif() + + if(DEFINED EXPECTED_FILE_${FILE_NO}_FILENAME_GENERATOR_SPECIFIC_FORMAT) + set(GENERATOR_SPECIFIC_FORMAT "${EXPECTED_FILE_${FILE_NO}_FILENAME_GENERATOR_SPECIFIC_FORMAT}") + elseif(DEFINED EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT) + set(GENERATOR_SPECIFIC_FORMAT "${EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT}") + else() + set(GENERATOR_SPECIFIC_FORMAT FALSE) + endif() + + if(GENERATOR_SPECIFIC_FORMAT) + set(${RESULT_VAR} "${NAME}${COMPONENT}-${VERSION}-${REVISION}.*.rpm" PARENT_SCOPE) + else() + set(${RESULT_VAR} "${NAME}-${VERSION}-*${COMPONENT}.rpm" PARENT_SCOPE) + endif() +endfunction() + function(getPackageInfo FILE RESULT_VAR) execute_process(COMMAND ${RPM_EXECUTABLE} -pqi ${FILE} OUTPUT_VARIABLE info_content diff --git a/Tests/RunCMake/CPack/TGZ/Helpers.cmake b/Tests/RunCMake/CPack/TGZ/Helpers.cmake index f14d532..50fda9e 100644 --- a/Tests/RunCMake/CPack/TGZ/Helpers.cmake +++ b/Tests/RunCMake/CPack/TGZ/Helpers.cmake @@ -8,3 +8,11 @@ function(getPackageContent FILE RESULT_VAR) 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() diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake index 9ab6f11..835f654 100644 --- a/Tests/RunCMake/CPack/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/VerifyResult.cmake @@ -1,5 +1,28 @@ cmake_minimum_required(VERSION ${CMAKE_VERSION} FATAL_ERROR) +function(findExpectedFile FILE_NO RESULT_VAR) + if(NOT DEFINED EXPECTED_FILE_${FILE_NO}) # explicit file name regex was not provided - construct one from other data + # set defaults if parameters are not provided + if(NOT DEFINED EXPECTED_FILE_${FILE_NO}_NAME) + string(TOLOWER "${RunCMake_TEST_FILE_PREFIX}" EXPECTED_FILE_${FILE_NO}_NAME) + endif() + if(NOT DEFINED EXPECTED_FILE_${FILE_NO}_VERSION) + set(EXPECTED_FILE_${FILE_NO}_VERSION "0.1.1") + endif() + if(NOT DEFINED EXPECTED_FILE_${FILE_NO}_REVISION) + set(EXPECTED_FILE_${FILE_NO}_REVISION "1") + endif() + + getPackageNameGlobexpr("${EXPECTED_FILE_${FILE_NO}_NAME}" + "${EXPECTED_FILE_${FILE_NO}_COMPONENT}" "${EXPECTED_FILE_${FILE_NO}_VERSION}" + "${EXPECTED_FILE_${FILE_NO}_REVISION}" "${FILE_NO}" "EXPECTED_FILE_${FILE_NO}") + endif() + + file(GLOB found_file_ RELATIVE "${bin_dir}" "${EXPECTED_FILE_${FILE_NO}}") + + set(${RESULT_VAR} "${found_file_}" PARENT_SCOPE) +endfunction() + include("${config_file}") include("${src_dir}/${GENERATOR_TYPE}/Helpers.cmake") @@ -10,12 +33,13 @@ file(READ "${config_file}" config_file_content) set(output_error_message "\nCPack output: '${output}'\nCPack error: '${error}';\nCPack result: '${PACKAGING_RESULT}';\nconfig file: '${config_file_content}'") -# check that expected generated files exist and contain expected content +# generate default expected files data include("${src_dir}/tests/${RunCMake_TEST_FILE_PREFIX}/ExpectedFiles.cmake") +# check that expected generated files exist and contain expected content if(NOT EXPECTED_FILES_COUNT EQUAL 0) foreach(file_no_ RANGE 1 ${EXPECTED_FILES_COUNT}) - file(GLOB FOUND_FILE_${file_no_} RELATIVE "${bin_dir}" "${EXPECTED_FILE_${file_no_}}") + findExpectedFile("${file_no_}" "FOUND_FILE_${file_no_}") list(APPEND foundFiles_ "${FOUND_FILE_${file_no_}}") list(LENGTH FOUND_FILE_${file_no_} foundFilesCount_) @@ -40,6 +64,7 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0) "Found more than one file for file No. '${file_no_}'!" " Found files count '${foundFilesCount_}'." " Files: '${FOUND_FILE_${file_no_}}'" + " Globbing expression: '${EXPECTED_FILE_${file_no_}}'" "${output_error_message}") endif() endforeach() diff --git a/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/ExpectedFiles.cmake index f42d8b1..700f72c 100644 --- a/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/ExpectedFiles.cmake @@ -1,14 +1,13 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) +set(EXPECTED_FILE_1_COMPONENT "test") if(GENERATOR_TYPE STREQUAL "DEB") - set(EXPECTED_FILE_1 "components_empty_dir-test_0.1.1-1_*.deb") set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/empty/$") elseif(GENERATOR_TYPE STREQUAL "RPM") - set(EXPECTED_FILE_1 "components_empty_dir*.rpm") set(EXPECTED_FILE_CONTENT_1 "^/usr/empty$") elseif(GENERATOR_TYPE STREQUAL "TGZ") - set(EXPECTED_FILE_1 "components_empty_dir*.tar.gz") set(EXPECTED_FILE_CONTENT_1 "^[^\n]*empty/$") endif() diff --git a/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/test.cmake b/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/test.cmake index 1ad01c1..1f35b80 100644 --- a/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/test.cmake +++ b/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/test.cmake @@ -4,6 +4,7 @@ if(GENERATOR_TYPE STREQUAL "DEB") set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") elseif(GENERATOR_TYPE STREQUAL "RPM") set(CPACK_RPM_COMPONENT_INSTALL "ON") + set(CPACK_RPM_FILE_NAME "RPM-DEFAULT") elseif(GENERATOR_TYPE STREQUAL "TGZ") set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON") endif() diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake index c0389ba..01ae2d9 100644 --- a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake @@ -1,19 +1,21 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "3") +set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) +set(EXPECTED_FILE_1_COMPONENT "pkg_1") +set(EXPECTED_FILE_2_NAME "second") if(GENERATOR_TYPE STREQUAL "DEB") - set(EXPECTED_FILE_1 "custom_names-pkg_1_0.1.1-1_*.deb") set(EXPECTED_FILE_CONTENT_1 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$") - set(EXPECTED_FILE_2 "second*.deb") set(EXPECTED_FILE_CONTENT_2 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$") - set(EXPECTED_FILE_3 "pkg_3_abc.deb") set(EXPECTED_FILE_CONTENT_3 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$") elseif(GENERATOR_TYPE STREQUAL "RPM") - 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$") endif() + +if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM") + string(TOLOWER "${GENERATOR_TYPE}" file_extension_) + set(EXPECTED_FILE_3 "pkg_3_abc.${file_extension_}") +endif() diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake index a583e32..044744b 100644 --- a/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake @@ -1,14 +1,15 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "5") -set(EXPECTED_FILE_1 "debuginfo-applications-0*.rpm") +set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) +set(EXPECTED_FILE_1_COMPONENT "applications") set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/test_prog$") set(EXPECTED_FILE_2 "debuginfo*-headers.rpm") set(EXPECTED_FILE_CONTENT_2 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$") set(EXPECTED_FILE_3 "debuginfo*-libs.rpm") set(EXPECTED_FILE_CONTENT_3 "^/usr/bas${whitespaces_}/usr/bas/libtest_lib.so$") -set(EXPECTED_FILE_4 "debuginfo-applications-debuginfo*.rpm") +set(EXPECTED_FILE_4_COMPONENT "applications-debuginfo") set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*") -set(EXPECTED_FILE_5 "debuginfo-libs-debuginfo*.rpm") +set(EXPECTED_FILE_5_COMPONENT "libs-debuginfo") set(EXPECTED_FILE_CONTENT_5 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/test_lib.cpp.*") diff --git a/Tests/RunCMake/CPack/tests/DEB_EXTRA/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEB_EXTRA/ExpectedFiles.cmake index 4531a34..97b7c0b 100644 --- a/Tests/RunCMake/CPack/tests/DEB_EXTRA/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DEB_EXTRA/ExpectedFiles.cmake @@ -1,9 +1,10 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "3") -set(EXPECTED_FILE_1 "deb_extra-foo_0.1.1-1_*.deb") +set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) +set(EXPECTED_FILE_1_COMPONENT "foo") set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/foo/${whitespaces_}.*/usr/foo/CMakeLists.txt$") -set(EXPECTED_FILE_2 "deb_extra-bar_0.1.1-1_*.deb") +set(EXPECTED_FILE_2_COMPONENT "bar") set(EXPECTED_FILE_CONTENT_2 "^.*/usr/${whitespaces_}.*/usr/bar/${whitespaces_}.*/usr/bar/CMakeLists.txt$") -set(EXPECTED_FILE_3 "deb_extra-bas_0.1.1-1_*.deb") +set(EXPECTED_FILE_3_COMPONENT "bas") set(EXPECTED_FILE_CONTENT_3 "^.*/usr/${whitespaces_}.*/usr/bas/${whitespaces_}.*/usr/bas/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/ExpectedFiles.cmake index 32a2327..ccb5ef0 100644 --- a/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/ExpectedFiles.cmake @@ -1,6 +1,6 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_1 "deb_generate_shlibs_0.1.1-1_*.deb") +set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) # 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/tests/DEB_GENERATE_SHLIBS_LDCONFIG/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/ExpectedFiles.cmake index 4966818..d66c044 100644 --- a/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/ExpectedFiles.cmake @@ -1,6 +1,6 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_1 "deb_generate_shlibs_ldconfig_0.1.1-1_*.deb") +set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) # 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/tests/DEPENDENCIES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEPENDENCIES/ExpectedFiles.cmake index 8459dd3..7ab2961 100644 --- a/Tests/RunCMake/CPack/tests/DEPENDENCIES/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DEPENDENCIES/ExpectedFiles.cmake @@ -1,28 +1,23 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "5") +set(EXPECTED_FILE_1_COMPONENT "applications") +set(EXPECTED_FILE_2_COMPONENT "applications_auto") +set(EXPECTED_FILE_3_COMPONENT "headers") +set(EXPECTED_FILE_4_COMPONENT "libs") +set(EXPECTED_FILE_5_COMPONENT "libs_auto") if(GENERATOR_TYPE STREQUAL "DEB") - set(EXPECTED_FILE_1 "dependencies-0.1.1-*-applications.deb") set(EXPECTED_FILE_CONTENT_1 "^.*/usr/foo${whitespaces_}.*/usr/foo/test_prog$") - set(EXPECTED_FILE_2 "dependencies-0.1.1-*-applications_auto.deb") set(EXPECTED_FILE_CONTENT_2 "^.*/usr/foo_auto${whitespaces_}.*/usr/foo_auto/test_prog$") - set(EXPECTED_FILE_3 "dependencies-0.1.1-*-headers.deb") set(EXPECTED_FILE_CONTENT_3 "^.*/usr/bar${whitespaces_}.*/usr/bar/CMakeLists.txt$") - set(EXPECTED_FILE_4 "dependencies-0.1.1-*-libs.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-0.1.1-*-libs_auto.deb") set(EXPECTED_FILE_CONTENT_5 "^.*/usr/bas_auto${whitespaces_}.*/usr/bas_auto/libtest_lib\\..*$") elseif(GENERATOR_TYPE STREQUAL "RPM") - set(EXPECTED_FILE_1 "dependencies*-applications.rpm") set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/test_prog$") - set(EXPECTED_FILE_2 "dependencies*-applications_auto.rpm") set(EXPECTED_FILE_CONTENT_2 "^/usr/foo_auto${whitespaces_}/usr/foo_auto/test_prog$") - set(EXPECTED_FILE_3 "dependencies*-headers.rpm") set(EXPECTED_FILE_CONTENT_3 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$") - set(EXPECTED_FILE_4 "dependencies*-libs.rpm") set(EXPECTED_FILE_CONTENT_4 "^/usr/bas${whitespaces_}/usr/bas/libtest_lib.so$") - set(EXPECTED_FILE_5 "dependencies*-libs_auto.rpm") set(EXPECTED_FILE_CONTENT_5 "^/usr/bas_auto${whitespaces_}/usr/bas_auto/libtest_lib.so$") endif() diff --git a/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake index 5924f1f..bdeae28 100644 --- a/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake @@ -1,14 +1,12 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) if(GENERATOR_TYPE STREQUAL "DEB") - set(EXPECTED_FILE_1 "empty_dir_0.1.1-1_*.deb") set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/empty/$") elseif(GENERATOR_TYPE STREQUAL "RPM") - set(EXPECTED_FILE_1 "empty_dir*.rpm") set(EXPECTED_FILE_CONTENT_1 "^/usr/empty$") elseif(GENERATOR_TYPE STREQUAL "TGZ") - set(EXPECTED_FILE_1 "empty_dir*.tar.gz") set(EXPECTED_FILE_CONTENT_1 "^[^\n]*empty_dir-0.1.1-[^\n]*/empty/$") endif() diff --git a/Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake b/Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake index e435ced..049c4a4 100644 --- a/Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake +++ b/Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake @@ -1,6 +1,13 @@ if(GENERATOR_TYPE STREQUAL "DEB") set(CPACK_PACKAGE_CONTACT "someone") - set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") +endif() + +if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM") + if(GENERATOR_TYPE STREQUAL "DEB") + set(generator_type_suffix_ "IAN") # not entirely compatible... + endif() + + set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_FILE_NAME "${GENERATOR_TYPE}-DEFAULT") endif() install(DIRECTORY DESTINATION empty diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake index 033a45d..36a7014 100644 --- a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake @@ -1,7 +1,7 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "2") -set(EXPECTED_FILE_1 "install_scripts*-foo.rpm") +set(EXPECTED_FILE_1_COMPONENT "foo") set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") -set(EXPECTED_FILE_2 "install_scripts*-bar.rpm") +set(EXPECTED_FILE_2_COMPONENT "bar") set(EXPECTED_FILE_CONTENT_2 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake index dd72cf7..6733228 100644 --- a/Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake @@ -1,5 +1,5 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_1 "long_filenames_0.1.1-1_*.deb") +set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/foo/${whitespaces_}.*/usr/foo/llllllllll_oooooooooo_nnnnnnnnnn_gggggggggg_ffffffffff_iiiiiiiiii_llllllllll_eeeeeeeeee_nnnnnnnnnn_aaaaaaaaaa_mmmmmmmmmm_eeeeeeeeee.txt$") diff --git a/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake index 69603dd..84a1510 100644 --- a/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake @@ -6,8 +6,8 @@ if(NOT RunCMake_SUBTEST_SUFFIX STREQUAL "invalid") set(EXPECTED_FILES_COUNT "3") set(EXPECTED_FILE_1 "main_component-0.1.1-1.*.rpm") set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") - set(EXPECTED_FILE_2 "main_component*-headers.rpm") + set(EXPECTED_FILE_2_COMPONENT "headers") set(EXPECTED_FILE_CONTENT_2 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$") - set(EXPECTED_FILE_3 "main_component*-libs.rpm") + set(EXPECTED_FILE_3_COMPONENT "libs") set(EXPECTED_FILE_CONTENT_3 "^/usr/bas${whitespaces_}/usr/bas/CMakeLists.txt$") endif() diff --git a/Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake index 546b891..b707464 100644 --- a/Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake @@ -3,12 +3,9 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "1") if(GENERATOR_TYPE STREQUAL "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$") elseif(GENERATOR_TYPE STREQUAL "RPM") - set(EXPECTED_FILE_1 "minimal*.rpm") set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") elseif(GENERATOR_TYPE STREQUAL "TGZ") - set(EXPECTED_FILE_1 "minimal*.tar.gz") set(EXPECTED_FILE_CONTENT_1 "^[^\n]*minimal-0.1.1-[^\n]*/foo/\n[^\n]*minimal-0.1.1-[^\n]*/foo/CMakeLists.txt$") endif() diff --git a/Tests/RunCMake/CPack/tests/MINIMAL/test.cmake b/Tests/RunCMake/CPack/tests/MINIMAL/test.cmake index 2182f46..4441c8e 100644 --- a/Tests/RunCMake/CPack/tests/MINIMAL/test.cmake +++ b/Tests/RunCMake/CPack/tests/MINIMAL/test.cmake @@ -1,6 +1,5 @@ if(GENERATOR_TYPE STREQUAL "DEB") set(CPACK_PACKAGE_CONTACT "someone") - set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") endif() install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) diff --git a/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake index 205dcd8..6a300e9 100644 --- a/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake @@ -4,6 +4,5 @@ set(EXPECTED_FILES_COUNT "0") if (NOT ${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid") set(EXPECTED_FILES_COUNT "1") - set(EXPECTED_FILE_1 "package_checksum*.tar.gz") set(EXPECTED_FILE_CONTENT_1 "^[^\n]*package_checksum*-[^\n]*/foo/\n[^\n]*package_checksum-[^\n]*/foo/CMakeLists.txt$") endif() diff --git a/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake index ddaa9db..5c824d4 100644 --- a/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake @@ -1,5 +1,4 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_1 "partially_relocatable_warning-0.1.1-*.rpm") set(EXPECTED_FILE_CONTENT_1 "^/not_relocatable${whitespaces_}/not_relocatable/CMakeLists.txt${whitespaces_}/opt$") diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake index 8ff725c..c2ed511 100644 --- a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake @@ -1,19 +1,17 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "3") +set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) +set(EXPECTED_FILE_1_COMPONENT "pkg_1") +set(EXPECTED_FILE_2_NAME "second") +set(EXPECTED_FILE_3_COMPONENT "pkg_3") if(GENERATOR_TYPE STREQUAL "DEB") - set(EXPECTED_FILE_1 "per_component_fields-pkg_1_0.1.1-1_*.deb") set(EXPECTED_FILE_CONTENT_1 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$") - 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_fields-pkg_3_0.1.1-1_*.deb") set(EXPECTED_FILE_CONTENT_3 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$") elseif(GENERATOR_TYPE STREQUAL "RPM") - set(EXPECTED_FILE_1 "per_component_fields*-pkg_1.rpm") set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") - set(EXPECTED_FILE_2 "per_component_fields*-pkg_2.rpm") set(EXPECTED_FILE_CONTENT_2 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") - set(EXPECTED_FILE_3 "per_component_fields*-pkg_3.rpm") set(EXPECTED_FILE_CONTENT_3 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") endif() diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake index b042092..3fca2e2 100644 --- a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake +++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake @@ -8,6 +8,7 @@ if(GENERATOR_TYPE STREQUAL "DEB") set(CPACK_DEBIAN_PKG_2_PACKAGE_SECTION "second_group") elseif(GENERATOR_TYPE STREQUAL "RPM") set(CPACK_RPM_COMPONENT_INSTALL "ON") + set(CPACK_RPM_FILE_NAME "RPM-DEFAULT") set(CPACK_RPM_PACKAGE_GROUP "default") set(CPACK_RPM_PKG_2_PACKAGE_NAME "second") diff --git a/Tests/RunCMake/CPack/tests/RPM_DIST/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/RPM_DIST/ExpectedFiles.cmake index 3b5a347..f227e1f 100644 --- a/Tests/RunCMake/CPack/tests/RPM_DIST/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/RPM_DIST/ExpectedFiles.cmake @@ -1,5 +1,4 @@ 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/tests/RPM_SUGGESTS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/ExpectedFiles.cmake index 02ebb44..f227e1f 100644 --- a/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/ExpectedFiles.cmake @@ -1,5 +1,4 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_1 "rpm_suggests*.rpm") set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake index dc49343..9c0dea4 100644 --- a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake @@ -1,6 +1,7 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "0") +set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo") set(EXPECTED_FILES_COUNT "4") @@ -11,7 +12,7 @@ if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" OR RunCMake_SUBTEST_SUFFIX STREQUAL set(EXPECTED_FILE_3 "single_debuginfo*-libs.rpm") set(EXPECTED_FILE_CONTENT_3 "^/usr/bas${whitespaces_}/usr/bas/libtest_lib.so$") - set(EXPECTED_FILE_4 "single_debuginfo-debuginfo*.rpm") + set(EXPECTED_FILE_4_COMPONENT "debuginfo") set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp${whitespaces_}/src/src_1/test_lib.cpp.*") elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component" OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_no_debuginfo") set(EXPECTED_FILES_COUNT "2") diff --git a/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake index d6811eb..05ea102 100644 --- a/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake @@ -1,5 +1,4 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_1 "source_package*.src.rpm") set(EXPECTED_FILE_CONTENT_1 "^source_package-0.1.1.tar.gz${whitespaces_}source_package.spec$") |