diff options
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 55 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/CPackTestHelpers.cmake | 35 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/RPM/default_expected_stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/RunCMakeTest.cmake | 54 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/RPM-COMPONENT-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt | 2 |
6 files changed, 101 insertions, 49 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index e222376..875ebfc 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -42,7 +42,12 @@ function(add_RunCMake_test_group test types) # much system information so it is easier to set programs and environment # values here unset(${test}_${type}_FOUND_PREREQUIREMENTS) - include("${CMAKE_CURRENT_SOURCE_DIR}/${test}/${type}/Prerequirements.cmake") + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${test}/${type}/Prerequirements.cmake") + include("${CMAKE_CURRENT_SOURCE_DIR}/${test}/${type}/Prerequirements.cmake") + else() + string(REGEX MATCH "^[^.]*" main_type "${type}") + include("${CMAKE_CURRENT_SOURCE_DIR}/${test}/${main_type}/Prerequirements.cmake") + endif() get_test_prerequirements("${test}_${type}_FOUND_PREREQUIREMENTS" "${TEST_CONFIG_DIR}/${type}_config.cmake") @@ -456,7 +461,53 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") add_RunCMake_test(ctest_labels_for_subprojects) endif() -add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External") +set(cpack_tests + DEB.CUSTOM_NAMES + DEB.DEBUGINFO + DEB.DEFAULT_PERMISSIONS + DEB.DEPENDENCIES + DEB.EMPTY_DIR + DEB.VERSION + DEB.EXTRA + DEB.GENERATE_SHLIBS + DEB.GENERATE_SHLIBS_LDCONFIG + DEB.LONG_FILENAMES + DEB.MINIMAL + DEB.PER_COMPONENT_FIELDS + DEB.TIMESTAMPS + DEB.MD5SUMS + DEB.DEB_PACKAGE_VERSION_BACK_COMPATIBILITY + + RPM.CUSTOM_BINARY_SPEC_FILE + RPM.CUSTOM_NAMES + RPM.DEBUGINFO + RPM.DEFAULT_PERMISSIONS + RPM.DEPENDENCIES + RPM.DIST + RPM.EMPTY_DIR + RPM.VERSION + RPM.INSTALL_SCRIPTS + RPM.MAIN_COMPONENT + RPM.MINIMAL + RPM.PARTIALLY_RELOCATABLE_WARNING + RPM.PER_COMPONENT_FIELDS + RPM.SINGLE_DEBUGINFO + RPM.EXTRA_SLASH_IN_PATH + RPM.SOURCE_PACKAGE + RPM.SUGGESTS + RPM.SYMLINKS + RPM.USER_FILELIST + + 7Z + TBZ2 + TGZ + TXZ + TZ + ZIP + STGZ + External + ) +add_RunCMake_test_group(CPack "${cpack_tests}") # 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/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake index d00ef3b..f65cb9d 100644 --- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -2,6 +2,7 @@ cmake_policy(SET CMP0057 NEW) function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE package_target) if(TEST_TYPE IN_LIST types) + string(REGEX MATCH "^[^.]*" GENERATOR_TYPE "${TEST_TYPE}") set(RunCMake_TEST_NO_CLEAN TRUE) if(package_target) set(full_test_name_ "${TEST_NAME}-package-target") @@ -21,8 +22,8 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - if(EXISTS "${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-Prerequirements.cmake") - include("${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-Prerequirements.cmake") + if(EXISTS "${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-Prerequirements.cmake") + include("${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-Prerequirements.cmake") set(FOUND_PREREQUIREMENTS false) get_test_prerequirements("FOUND_PREREQUIREMENTS" "${config_file}") @@ -35,7 +36,7 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK endif() # execute cmake - set(RunCMake_TEST_OPTIONS "-DGENERATOR_TYPE=${TEST_TYPE}" + set(RunCMake_TEST_OPTIONS "-DGENERATOR_TYPE=${GENERATOR_TYPE}" "-DRunCMake_TEST_FILE_PREFIX=${TEST_NAME}" "-DRunCMake_SUBTEST_SUFFIX=${SUBTEST_SUFFIX}" "-DPACKAGING_TYPE=${PACKAGING_TYPE}") @@ -64,9 +65,9 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK endif() if(source) - set(pack_params_ -G ${TEST_TYPE} --config ./CPackSourceConfig.cmake) + set(pack_params_ -G ${GENERATOR_TYPE} --config ./CPackSourceConfig.cmake) FILE(APPEND ${RunCMake_TEST_BINARY_DIR}/CPackSourceConfig.cmake - "\nset(CPACK_RPM_SOURCE_PKG_BUILD_PARAMS \"-DRunCMake_TEST:STRING=${full_test_name_} -DRunCMake_TEST_FILE_PREFIX:STRING=${TEST_NAME} -DGENERATOR_TYPE:STRING=${TEST_TYPE}\")") + "\nset(CPACK_RPM_SOURCE_PKG_BUILD_PARAMS \"-DRunCMake_TEST:STRING=${full_test_name_} -DRunCMake_TEST_FILE_PREFIX:STRING=${TEST_NAME} -DGENERATOR_TYPE:STRING=${GENERATOR_TYPE}\")") else() unset(pack_params_) endif() @@ -91,18 +92,18 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK ) foreach(o out err) - if(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt) - set(RunCMake-std${o}-file "tests/${TEST_NAME}/${TEST_TYPE}-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt") - elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-${PACKAGING_TYPE}-std${o}.txt) - set(RunCMake-std${o}-file "tests/${TEST_NAME}/${TEST_TYPE}-${PACKAGING_TYPE}-std${o}.txt") - elseif(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt) - set(RunCMake-std${o}-file "tests/${TEST_NAME}/${TEST_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt") - elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-std${o}.txt) - set(RunCMake-std${o}-file "tests/${TEST_NAME}/${TEST_TYPE}-std${o}.txt") + if(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/${GENERATOR_TYPE}-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt") + elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-${PACKAGING_TYPE}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/${GENERATOR_TYPE}-${PACKAGING_TYPE}-std${o}.txt") + elseif(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/${GENERATOR_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt") + elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/${GENERATOR_TYPE}-std${o}.txt") elseif(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${SUBTEST_SUFFIX}-std${o}.txt) set(RunCMake-std${o}-file "tests/${TEST_NAME}/${SUBTEST_SUFFIX}-std${o}.txt") - elseif(EXISTS ${RunCMake_SOURCE_DIR}/${TEST_TYPE}/default_expected_std${o}.txt) - set(RunCMake-std${o}-file "${TEST_TYPE}/default_expected_std${o}.txt") + elseif(EXISTS ${RunCMake_SOURCE_DIR}/${GENERATOR_TYPE}/default_expected_std${o}.txt) + set(RunCMake-std${o}-file "${GENERATOR_TYPE}/default_expected_std${o}.txt") else() unset(RunCMake-std${o}-file) endif() @@ -110,12 +111,12 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK # verify result run_cmake_command( - ${TEST_TYPE}/${full_test_name_} + ${GENERATOR_TYPE}/${full_test_name_} "${CMAKE_COMMAND}" -DRunCMake_TEST=${full_test_name_} -DRunCMake_TEST_FILE_PREFIX=${TEST_NAME} -DRunCMake_SUBTEST_SUFFIX=${SUBTEST_SUFFIX} - -DGENERATOR_TYPE=${TEST_TYPE} + -DGENERATOR_TYPE=${GENERATOR_TYPE} -DPACKAGING_TYPE=${PACKAGING_TYPE} "-Dsrc_dir=${RunCMake_SOURCE_DIR}" "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}" diff --git a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt index f02f9d6..6c87ca0 100644 --- a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt +++ b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt @@ -1 +1 @@ -^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*(-package-target)?-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$ +^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM\.[^/]*/CPack/[^-]*(-package-target)?-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$ diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 33ddb72..37df57c 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -4,35 +4,35 @@ include(RunCMake) include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake") # run_cpack_test args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP "PACKAGING_TYPES" -run_cpack_test(CUSTOM_BINARY_SPEC_FILE "RPM" false "MONOLITHIC;COMPONENT") -run_cpack_test(CUSTOM_NAMES "RPM;DEB;TGZ" true "COMPONENT") -run_cpack_test(DEBUGINFO "RPM;DEB" true "COMPONENT") -run_cpack_test_subtests(DEFAULT_PERMISSIONS "CMAKE_var_set;CPACK_var_set;both_set;invalid_CMAKE_var;invalid_CPACK_var" "RPM;DEB" false "MONOLITHIC;COMPONENT") -run_cpack_test(DEPENDENCIES "RPM;DEB" true "COMPONENT") -run_cpack_test(DIST "RPM" false "MONOLITHIC") -run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true "MONOLITHIC;COMPONENT") -run_cpack_test(VERSION "RPM;DEB" false "MONOLITHIC;COMPONENT") -run_cpack_test(EXTRA "DEB" false "COMPONENT") -run_cpack_test_subtests(GENERATE_SHLIBS "soversion_not_zero;soversion_zero" "DEB" true "COMPONENT") -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;STGZ;External" false "MONOLITHIC;COMPONENT") -run_cpack_test_package_target(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External" false "MONOLITHIC;COMPONENT") +run_cpack_test(CUSTOM_BINARY_SPEC_FILE "RPM.CUSTOM_BINARY_SPEC_FILE" false "MONOLITHIC;COMPONENT") +run_cpack_test(CUSTOM_NAMES "RPM.CUSTOM_NAMES;DEB.CUSTOM_NAMES;TGZ" true "COMPONENT") +run_cpack_test(DEBUGINFO "RPM.DEBUGINFO;DEB.DEBUGINFO" true "COMPONENT") +run_cpack_test_subtests(DEFAULT_PERMISSIONS "CMAKE_var_set;CPACK_var_set;both_set;invalid_CMAKE_var;invalid_CPACK_var" "RPM.DEFAULT_PERMISSIONS;DEB.DEFAULT_PERMISSIONS" false "MONOLITHIC;COMPONENT") +run_cpack_test(DEPENDENCIES "RPM.DEPENDENCIES;DEB.DEPENDENCIES" true "COMPONENT") +run_cpack_test(DIST "RPM.DIST" false "MONOLITHIC") +run_cpack_test(EMPTY_DIR "RPM.EMPTY_DIR;DEB.EMPTY_DIR;TGZ" true "MONOLITHIC;COMPONENT") +run_cpack_test(VERSION "RPM.VERSION;DEB.VERSION" false "MONOLITHIC;COMPONENT") +run_cpack_test(EXTRA "DEB.EXTRA" false "COMPONENT") +run_cpack_test_subtests(GENERATE_SHLIBS "soversion_not_zero;soversion_zero" "DEB.GENERATE_SHLIBS" true "COMPONENT") +run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB.GENERATE_SHLIBS_LDCONFIG" true "COMPONENT") +run_cpack_test(INSTALL_SCRIPTS "RPM.INSTALL_SCRIPTS" false "COMPONENT") +run_cpack_test(LONG_FILENAMES "DEB.LONG_FILENAMES" false "MONOLITHIC") +run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM.MAIN_COMPONENT" false "COMPONENT") +run_cpack_test(MINIMAL "RPM.MINIMAL;DEB.MINIMAL;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External" false "MONOLITHIC;COMPONENT") +run_cpack_test_package_target(MINIMAL "RPM.MINIMAL;DEB.MINIMAL;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External" 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") -run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component;one_component;one_component_main;no_debuginfo;one_component_no_debuginfo;no_components;valid" "RPM" true "CUSTOM") -run_cpack_test(EXTRA_SLASH_IN_PATH "RPM" true "COMPONENT") -run_cpack_source_test(SOURCE_PACKAGE "RPM") -run_cpack_test(SUGGESTS "RPM" false "MONOLITHIC") -run_cpack_test(SYMLINKS "RPM;TGZ" false "MONOLITHIC;COMPONENT") +run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM.PARTIALLY_RELOCATABLE_WARNING" false "COMPONENT") +run_cpack_test(PER_COMPONENT_FIELDS "RPM.PER_COMPONENT_FIELDS;DEB.PER_COMPONENT_FIELDS" false "COMPONENT") +run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component;one_component;one_component_main;no_debuginfo;one_component_no_debuginfo;no_components;valid" "RPM.SINGLE_DEBUGINFO" true "CUSTOM") +run_cpack_test(EXTRA_SLASH_IN_PATH "RPM.EXTRA_SLASH_IN_PATH" true "COMPONENT") +run_cpack_source_test(SOURCE_PACKAGE "RPM.SOURCE_PACKAGE") +run_cpack_test(SUGGESTS "RPM.SUGGESTS" false "MONOLITHIC") +run_cpack_test(SYMLINKS "RPM.SYMLINKS;TGZ" false "MONOLITHIC;COMPONENT") set(ENVIRONMENT "SOURCE_DATE_EPOCH=123456789") -run_cpack_test(TIMESTAMPS "DEB;TGZ" false "COMPONENT") +run_cpack_test(TIMESTAMPS "DEB.TIMESTAMPS;TGZ" false "COMPONENT") unset(ENVIRONMENT) -run_cpack_test(USER_FILELIST "RPM" false "MONOLITHIC") -run_cpack_test(MD5SUMS "DEB" false "MONOLITHIC;COMPONENT") +run_cpack_test(USER_FILELIST "RPM.USER_FILELIST" false "MONOLITHIC") +run_cpack_test(MD5SUMS "DEB.MD5SUMS" false "MONOLITHIC;COMPONENT") run_cpack_test(CPACK_INSTALL_SCRIPT "ZIP" false "MONOLITHIC") -run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB" false "MONOLITHIC;COMPONENT") +run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB.DEB_PACKAGE_VERSION_BACK_COMPATIBILITY" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests(EXTERNAL "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad;stage_and_package" "External" false "MONOLITHIC;COMPONENT") diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/RPM-COMPONENT-stderr.txt b/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/RPM-COMPONENT-stderr.txt index e6d86d0..b050262 100644 --- a/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/RPM-COMPONENT-stderr.txt +++ b/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/RPM-COMPONENT-stderr.txt @@ -1,2 +1,2 @@ ^CPackRPM: Will use USER specified spec file: (/[^/]*)*/CUSTOM_BINARY_SPEC_FILE/custom\.spec\.in -CPackRPM: Will use GENERATED spec file:.*/Tests/RunCMake/RPM/CPack/CUSTOM_BINARY_SPEC_FILE-build/_CPack_Packages/.*/RPM/SPECS/custom_binary_spec_file-test2\.spec$ +CPackRPM: Will use GENERATED spec file:.*/Tests/RunCMake/RPM\.CUSTOM_BINARY_SPEC_FILE/CPack/CUSTOM_BINARY_SPEC_FILE-build/_CPack_Packages/.*/RPM/SPECS/custom_binary_spec_file-test2\.spec$ diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt b/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt index feb296c..53d71d9 100644 --- a/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt +++ b/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt @@ -1 +1 @@ -^(.*CPackRPM:Warning: SUGGESTS not supported in provided rpmbuild.*)?CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*-build/_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec$ +^(.*CPackRPM:Warning: SUGGESTS not supported in provided rpmbuild.*)?CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM\.SUGGESTS/CPack/[^-]*-build/_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec$ |