From 2cc479bdac84843d0284573cf801ee526e798c54 Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Sun, 27 Nov 2016 16:02:53 +0100 Subject: Tests: remove generator prefix from CPack test name --- Tests/RunCMake/CPack/RunCMakeTest.cmake | 10 +++--- .../CPack/tests/DEB_EXTRA/ExpectedFiles.cmake | 8 ----- .../CPack/tests/DEB_EXTRA/VerifyResult.cmake | 18 ---------- Tests/RunCMake/CPack/tests/DEB_EXTRA/test.cmake | 38 ---------------------- .../DEB_GENERATE_SHLIBS/DEB-Prerequirements.cmake | 7 ---- .../tests/DEB_GENERATE_SHLIBS/ExpectedFiles.cmake | 6 ---- .../tests/DEB_GENERATE_SHLIBS/VerifyResult.cmake | 4 --- .../CPack/tests/DEB_GENERATE_SHLIBS/test.cmake | 16 --------- .../DEB-Prerequirements.cmake | 7 ---- .../ExpectedFiles.cmake | 6 ---- .../VerifyResult.cmake | 8 ----- .../tests/DEB_GENERATE_SHLIBS_LDCONFIG/test.cmake | 17 ---------- .../RunCMake/CPack/tests/DIST/ExpectedFiles.cmake | 2 ++ Tests/RunCMake/CPack/tests/DIST/VerifyResult.cmake | 11 +++++++ Tests/RunCMake/CPack/tests/DIST/test.cmake | 3 ++ .../RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake | 8 +++++ .../RunCMake/CPack/tests/EXTRA/VerifyResult.cmake | 18 ++++++++++ Tests/RunCMake/CPack/tests/EXTRA/test.cmake | 38 ++++++++++++++++++++++ .../GENERATE_SHLIBS/DEB-Prerequirements.cmake | 7 ++++ .../tests/GENERATE_SHLIBS/ExpectedFiles.cmake | 6 ++++ .../CPack/tests/GENERATE_SHLIBS/VerifyResult.cmake | 4 +++ .../CPack/tests/GENERATE_SHLIBS/test.cmake | 16 +++++++++ .../DEB-Prerequirements.cmake | 7 ++++ .../GENERATE_SHLIBS_LDCONFIG/ExpectedFiles.cmake | 6 ++++ .../GENERATE_SHLIBS_LDCONFIG/VerifyResult.cmake | 8 +++++ .../tests/GENERATE_SHLIBS_LDCONFIG/test.cmake | 17 ++++++++++ .../CPack/tests/RPM_DIST/ExpectedFiles.cmake | 2 -- .../CPack/tests/RPM_DIST/VerifyResult.cmake | 11 ------- Tests/RunCMake/CPack/tests/RPM_DIST/test.cmake | 3 -- .../CPack/tests/RPM_SUGGESTS/ExpectedFiles.cmake | 2 -- .../CPack/tests/RPM_SUGGESTS/RPM-stderr.txt | 1 - .../CPack/tests/RPM_SUGGESTS/VerifyResult.cmake | 31 ------------------ Tests/RunCMake/CPack/tests/RPM_SUGGESTS/test.cmake | 3 -- .../CPack/tests/SUGGESTS/ExpectedFiles.cmake | 2 ++ Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt | 1 + .../CPack/tests/SUGGESTS/VerifyResult.cmake | 31 ++++++++++++++++++ Tests/RunCMake/CPack/tests/SUGGESTS/test.cmake | 3 ++ 37 files changed, 193 insertions(+), 193 deletions(-) delete mode 100644 Tests/RunCMake/CPack/tests/DEB_EXTRA/ExpectedFiles.cmake delete mode 100644 Tests/RunCMake/CPack/tests/DEB_EXTRA/VerifyResult.cmake delete mode 100644 Tests/RunCMake/CPack/tests/DEB_EXTRA/test.cmake delete mode 100644 Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/DEB-Prerequirements.cmake delete mode 100644 Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/ExpectedFiles.cmake delete mode 100644 Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/VerifyResult.cmake delete mode 100644 Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/test.cmake delete mode 100644 Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake delete mode 100644 Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/ExpectedFiles.cmake delete mode 100644 Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/VerifyResult.cmake delete mode 100644 Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake create mode 100644 Tests/RunCMake/CPack/tests/DIST/VerifyResult.cmake create mode 100644 Tests/RunCMake/CPack/tests/DIST/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake create mode 100644 Tests/RunCMake/CPack/tests/EXTRA/VerifyResult.cmake create mode 100644 Tests/RunCMake/CPack/tests/EXTRA/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake create mode 100644 Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/ExpectedFiles.cmake create mode 100644 Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/VerifyResult.cmake create mode 100644 Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake create mode 100644 Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/ExpectedFiles.cmake create mode 100644 Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/VerifyResult.cmake create mode 100644 Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/test.cmake delete mode 100644 Tests/RunCMake/CPack/tests/RPM_DIST/ExpectedFiles.cmake delete mode 100644 Tests/RunCMake/CPack/tests/RPM_DIST/VerifyResult.cmake delete mode 100644 Tests/RunCMake/CPack/tests/RPM_DIST/test.cmake delete mode 100644 Tests/RunCMake/CPack/tests/RPM_SUGGESTS/ExpectedFiles.cmake delete mode 100644 Tests/RunCMake/CPack/tests/RPM_SUGGESTS/RPM-stderr.txt delete mode 100644 Tests/RunCMake/CPack/tests/RPM_SUGGESTS/VerifyResult.cmake delete mode 100644 Tests/RunCMake/CPack/tests/RPM_SUGGESTS/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake create mode 100644 Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt create mode 100644 Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake create mode 100644 Tests/RunCMake/CPack/tests/SUGGESTS/test.cmake diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 61d4332..39896ba 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -7,18 +7,18 @@ include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake") run_cpack_test(MINIMAL "RPM;DEB;TGZ" false) run_cpack_source_test(SOURCE_PACKAGE "RPM" true) run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false) -run_cpack_test(DEB_EXTRA "DEB" false) +run_cpack_test(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(CUSTOM_NAMES "RPM;DEB" true) run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM" false) run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false) -run_cpack_test(RPM_DIST "RPM" false) -run_cpack_test(RPM_SUGGESTS "RPM" false) +run_cpack_test(DIST "RPM" false) +run_cpack_test(SUGGESTS "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) +run_cpack_test(GENERATE_SHLIBS "DEB" true) +run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB" true) run_cpack_test(DEBUGINFO "RPM" true) 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) run_cpack_test(LONG_FILENAMES "DEB" false) diff --git a/Tests/RunCMake/CPack/tests/DEB_EXTRA/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEB_EXTRA/ExpectedFiles.cmake deleted file mode 100644 index ded2923..0000000 --- a/Tests/RunCMake/CPack/tests/DEB_EXTRA/ExpectedFiles.cmake +++ /dev/null @@ -1,8 +0,0 @@ -set(EXPECTED_FILES_COUNT "3") -set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) -set(EXPECTED_FILE_1_COMPONENT "foo") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") -set(EXPECTED_FILE_2_COMPONENT "bar") -set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") -set(EXPECTED_FILE_3_COMPONENT "bas") -set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bas;/usr/bas/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/DEB_EXTRA/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DEB_EXTRA/VerifyResult.cmake deleted file mode 100644 index 85e137f..0000000 --- a/Tests/RunCMake/CPack/tests/DEB_EXTRA/VerifyResult.cmake +++ /dev/null @@ -1,18 +0,0 @@ -set(foo_preinst "^echo default_preinst$") -# NOTE: optional dot at the end of permissions regex is for SELinux enabled systems -set(foo_preinst_permissions_regex "-rwxr-xr-x\.? .*") -set(foo_prerm "^echo default_prerm$") -set(foo_prerm_permissions_regex "-rwxr-xr-x\.? .*") -verifyDebControl("${FOUND_FILE_1}" "foo" "preinst;prerm") - -set(bar_preinst "^echo bar_preinst$") -set(bar_preinst_permissions_regex "-rwx------\.? .*") -set(bar_prerm "^echo bar_prerm$") -set(bar_prerm_permissions_regex "-rwx------\.? .*") -verifyDebControl("${FOUND_FILE_2}" "bar" "preinst;prerm") - -set(bas_preinst "^echo default_preinst$") -set(bas_preinst_permissions_regex "-rwxr-xr-x\.? .*") -set(bas_prerm "^echo default_prerm$") -set(bas_prerm_permissions_regex "-rwxr-xr-x\.? .*") -verifyDebControl("${FOUND_FILE_3}" "bas" "preinst;prerm") diff --git a/Tests/RunCMake/CPack/tests/DEB_EXTRA/test.cmake b/Tests/RunCMake/CPack/tests/DEB_EXTRA/test.cmake deleted file mode 100644 index 754561d..0000000 --- a/Tests/RunCMake/CPack/tests/DEB_EXTRA/test.cmake +++ /dev/null @@ -1,38 +0,0 @@ -install(FILES CMakeLists.txt DESTINATION foo COMPONENT foo) -install(FILES CMakeLists.txt DESTINATION bar COMPONENT bar) -install(FILES CMakeLists.txt DESTINATION bas COMPONENT bas) - -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp/preinst "echo default_preinst") -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp/prerm "echo default_prerm") - -foreach(file_ preinst prerm) - file(COPY ${CMAKE_CURRENT_BINARY_DIR}/tmp/${file_} - DESTINATION ${CMAKE_CURRENT_BINARY_DIR} - FILE_PERMISSIONS - OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE - WORLD_READ WORLD_EXECUTE) -endforeach() - -set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA - "${CMAKE_CURRENT_BINARY_DIR}/preinst;${CMAKE_CURRENT_BINARY_DIR}/prerm;${CMAKE_CURRENT_BINARY_DIR}/conffiles") - -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar_tmp/preinst "echo bar_preinst") -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar_tmp/prerm "echo bar_prerm") - -foreach(file_ preinst prerm) - # not acceptable permissions for lintian but we need to check that - # permissions are preserved - file(COPY ${CMAKE_CURRENT_BINARY_DIR}/bar_tmp/${file_} - DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bar - FILE_PERMISSIONS - OWNER_READ OWNER_WRITE OWNER_EXECUTE) -endforeach() - -set(CPACK_DEBIAN_BAR_PACKAGE_CONTROL_EXTRA - "${CMAKE_CURRENT_BINARY_DIR}/bar/preinst;${CMAKE_CURRENT_BINARY_DIR}/bar/prerm") - -set(CPACK_PACKAGE_CONTACT "someone") -set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") - -set(CPACK_DEB_COMPONENT_INSTALL ON) diff --git a/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/DEB-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/DEB-Prerequirements.cmake deleted file mode 100644 index b98065a..0000000 --- a/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/DEB-Prerequirements.cmake +++ /dev/null @@ -1,7 +0,0 @@ -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/tests/DEB_GENERATE_SHLIBS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/ExpectedFiles.cmake deleted file mode 100644 index ccb5ef0..0000000 --- a/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/ExpectedFiles.cmake +++ /dev/null @@ -1,6 +0,0 @@ -set(whitespaces_ "[\t\n\r ]*") - -set(EXPECTED_FILES_COUNT "1") -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/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/VerifyResult.cmake deleted file mode 100644 index f5d97db..0000000 --- a/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/VerifyResult.cmake +++ /dev/null @@ -1,4 +0,0 @@ -set(shlibs_shlibs "^libtest_lib 0\\.8 deb_generate_shlibs \\(\\= 0\\.1\\.1\\)\n$") -# optional dot at the end of permissions regex is for SELinux enabled systems -set(shlibs_shlibs_permissions_regex "-rw-r--r--\.? .*") -verifyDebControl("${FOUND_FILE_1}" "shlibs" "shlibs") diff --git a/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/test.cmake b/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/test.cmake deleted file mode 100644 index fa0bc35..0000000 --- a/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/test.cmake +++ /dev/null @@ -1,16 +0,0 @@ -set(CPACK_PACKAGE_CONTACT "someone") -set(CPACK_DEB_COMPONENT_INSTALL "ON") -set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") - -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) diff --git a/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake deleted file mode 100644 index b98065a..0000000 --- a/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake +++ /dev/null @@ -1,7 +0,0 @@ -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/tests/DEB_GENERATE_SHLIBS_LDCONFIG/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/ExpectedFiles.cmake deleted file mode 100644 index d66c044..0000000 --- a/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/ExpectedFiles.cmake +++ /dev/null @@ -1,6 +0,0 @@ -set(whitespaces_ "[\t\n\r ]*") - -set(EXPECTED_FILES_COUNT "1") -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/DEB_GENERATE_SHLIBS_LDCONFIG/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/VerifyResult.cmake deleted file mode 100644 index 320732b..0000000 --- a/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/VerifyResult.cmake +++ /dev/null @@ -1,8 +0,0 @@ -set(shlibs_shlibs "^libtest_lib 0\\.8 deb_generate_shlibs_ldconfig \\(>\\= 0\\.1\\.1\\)\n$") -# NOTE: optional dot at the end of permissions regex is for SELinux enabled systems -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/tests/DEB_GENERATE_SHLIBS_LDCONFIG/test.cmake b/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/test.cmake deleted file mode 100644 index 2fc9e23..0000000 --- a/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/test.cmake +++ /dev/null @@ -1,17 +0,0 @@ -set(CPACK_PACKAGE_CONTACT "someone") -set(CPACK_DEB_COMPONENT_INSTALL "ON") -set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") - -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) diff --git a/Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake new file mode 100644 index 0000000..6142eb3 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake @@ -0,0 +1,2 @@ +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/DIST/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DIST/VerifyResult.cmake new file mode 100644 index 0000000..7375ecc --- /dev/null +++ b/Tests/RunCMake/CPack/tests/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/tests/DIST/test.cmake b/Tests/RunCMake/CPack/tests/DIST/test.cmake new file mode 100644 index 0000000..6bdd2c0 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DIST/test.cmake @@ -0,0 +1,3 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) + +set(CPACK_RPM_PACKAGE_RELEASE_DIST ON) diff --git a/Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake new file mode 100644 index 0000000..ded2923 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake @@ -0,0 +1,8 @@ +set(EXPECTED_FILES_COUNT "3") +set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) +set(EXPECTED_FILE_1_COMPONENT "foo") +set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_2_COMPONENT "bar") +set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") +set(EXPECTED_FILE_3_COMPONENT "bas") +set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bas;/usr/bas/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/EXTRA/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/EXTRA/VerifyResult.cmake new file mode 100644 index 0000000..85e137f --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXTRA/VerifyResult.cmake @@ -0,0 +1,18 @@ +set(foo_preinst "^echo default_preinst$") +# NOTE: optional dot at the end of permissions regex is for SELinux enabled systems +set(foo_preinst_permissions_regex "-rwxr-xr-x\.? .*") +set(foo_prerm "^echo default_prerm$") +set(foo_prerm_permissions_regex "-rwxr-xr-x\.? .*") +verifyDebControl("${FOUND_FILE_1}" "foo" "preinst;prerm") + +set(bar_preinst "^echo bar_preinst$") +set(bar_preinst_permissions_regex "-rwx------\.? .*") +set(bar_prerm "^echo bar_prerm$") +set(bar_prerm_permissions_regex "-rwx------\.? .*") +verifyDebControl("${FOUND_FILE_2}" "bar" "preinst;prerm") + +set(bas_preinst "^echo default_preinst$") +set(bas_preinst_permissions_regex "-rwxr-xr-x\.? .*") +set(bas_prerm "^echo default_prerm$") +set(bas_prerm_permissions_regex "-rwxr-xr-x\.? .*") +verifyDebControl("${FOUND_FILE_3}" "bas" "preinst;prerm") diff --git a/Tests/RunCMake/CPack/tests/EXTRA/test.cmake b/Tests/RunCMake/CPack/tests/EXTRA/test.cmake new file mode 100644 index 0000000..754561d --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXTRA/test.cmake @@ -0,0 +1,38 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT foo) +install(FILES CMakeLists.txt DESTINATION bar COMPONENT bar) +install(FILES CMakeLists.txt DESTINATION bas COMPONENT bas) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp/preinst "echo default_preinst") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp/prerm "echo default_prerm") + +foreach(file_ preinst prerm) + file(COPY ${CMAKE_CURRENT_BINARY_DIR}/tmp/${file_} + DESTINATION ${CMAKE_CURRENT_BINARY_DIR} + FILE_PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE + GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE) +endforeach() + +set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA + "${CMAKE_CURRENT_BINARY_DIR}/preinst;${CMAKE_CURRENT_BINARY_DIR}/prerm;${CMAKE_CURRENT_BINARY_DIR}/conffiles") + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar_tmp/preinst "echo bar_preinst") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar_tmp/prerm "echo bar_prerm") + +foreach(file_ preinst prerm) + # not acceptable permissions for lintian but we need to check that + # permissions are preserved + file(COPY ${CMAKE_CURRENT_BINARY_DIR}/bar_tmp/${file_} + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bar + FILE_PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE) +endforeach() + +set(CPACK_DEBIAN_BAR_PACKAGE_CONTROL_EXTRA + "${CMAKE_CURRENT_BINARY_DIR}/bar/preinst;${CMAKE_CURRENT_BINARY_DIR}/bar/prerm") + +set(CPACK_PACKAGE_CONTACT "someone") +set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") + +set(CPACK_DEB_COMPONENT_INSTALL ON) diff --git a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake new file mode 100644 index 0000000..b98065a --- /dev/null +++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-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/tests/GENERATE_SHLIBS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/ExpectedFiles.cmake new file mode 100644 index 0000000..ccb5ef0 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/ExpectedFiles.cmake @@ -0,0 +1,6 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +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/GENERATE_SHLIBS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/VerifyResult.cmake new file mode 100644 index 0000000..b1952ef --- /dev/null +++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/VerifyResult.cmake @@ -0,0 +1,4 @@ +set(shlibs_shlibs "^libtest_lib 0\\.8 generate_shlibs \\(\\= 0\\.1\\.1\\)\n$") +# optional dot at the end of permissions regex is for SELinux enabled systems +set(shlibs_shlibs_permissions_regex "-rw-r--r--\.? .*") +verifyDebControl("${FOUND_FILE_1}" "shlibs" "shlibs") diff --git a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/test.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/test.cmake new file mode 100644 index 0000000..fa0bc35 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/test.cmake @@ -0,0 +1,16 @@ +set(CPACK_PACKAGE_CONTACT "someone") +set(CPACK_DEB_COMPONENT_INSTALL "ON") +set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") + +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) diff --git a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake new file mode 100644 index 0000000..b98065a --- /dev/null +++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-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/tests/GENERATE_SHLIBS_LDCONFIG/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/ExpectedFiles.cmake new file mode 100644 index 0000000..d66c044 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/ExpectedFiles.cmake @@ -0,0 +1,6 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +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/GENERATE_SHLIBS_LDCONFIG/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/VerifyResult.cmake new file mode 100644 index 0000000..422cfbe --- /dev/null +++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/VerifyResult.cmake @@ -0,0 +1,8 @@ +set(shlibs_shlibs "^libtest_lib 0\\.8 generate_shlibs_ldconfig \\(>\\= 0\\.1\\.1\\)\n$") +# NOTE: optional dot at the end of permissions regex is for SELinux enabled systems +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/tests/GENERATE_SHLIBS_LDCONFIG/test.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/test.cmake new file mode 100644 index 0000000..2fc9e23 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/test.cmake @@ -0,0 +1,17 @@ +set(CPACK_PACKAGE_CONTACT "someone") +set(CPACK_DEB_COMPONENT_INSTALL "ON") +set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") + +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) diff --git a/Tests/RunCMake/CPack/tests/RPM_DIST/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/RPM_DIST/ExpectedFiles.cmake deleted file mode 100644 index 6142eb3..0000000 --- a/Tests/RunCMake/CPack/tests/RPM_DIST/ExpectedFiles.cmake +++ /dev/null @@ -1,2 +0,0 @@ -set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/RPM_DIST/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/RPM_DIST/VerifyResult.cmake deleted file mode 100644 index 7375ecc..0000000 --- a/Tests/RunCMake/CPack/tests/RPM_DIST/VerifyResult.cmake +++ /dev/null @@ -1,11 +0,0 @@ -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/tests/RPM_DIST/test.cmake b/Tests/RunCMake/CPack/tests/RPM_DIST/test.cmake deleted file mode 100644 index 6bdd2c0..0000000 --- a/Tests/RunCMake/CPack/tests/RPM_DIST/test.cmake +++ /dev/null @@ -1,3 +0,0 @@ -install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) - -set(CPACK_RPM_PACKAGE_RELEASE_DIST ON) diff --git a/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/ExpectedFiles.cmake deleted file mode 100644 index 6142eb3..0000000 --- a/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/ExpectedFiles.cmake +++ /dev/null @@ -1,2 +0,0 @@ -set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/RPM-stderr.txt b/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/RPM-stderr.txt deleted file mode 100644 index feb296c..0000000 --- a/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/RPM-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^(.*CPackRPM:Warning: SUGGESTS not supported in provided rpmbuild.*)?CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*-build/_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec$ diff --git a/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/VerifyResult.cmake deleted file mode 100644 index 32cc6d1..0000000 --- a/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/VerifyResult.cmake +++ /dev/null @@ -1,31 +0,0 @@ -execute_process(COMMAND ${RPMBUILD_EXECUTABLE} --querytags - OUTPUT_VARIABLE RPMBUILD_CAPS - RESULT_VARIABLE RPMBUILD_CAPS_RESULT) - -if(NOT RPMBUILD_CAPS_RESULT) - string(REPLACE "\n" ";" RPMBUILD_CAPS "${RPMBUILD_CAPS}") - cmake_policy(PUSH) - cmake_policy(SET CMP0057 NEW) - if(SUGGESTS IN_LIST RPMBUILD_CAPS) - set(should_contain_suggests_tag_ true) - endif() - cmake_policy(POP) -endif() - -# Only verify that suggests tag is present only if that tag is supported. -# If it is not supported the rpm package was corretly generated by ignoring -# that tag and that was already checked by expected files test. -if(should_contain_suggests_tag_) - execute_process(COMMAND ${RPM_EXECUTABLE} -q --suggests -p "${FOUND_FILE_1}" - WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" - RESULT_VARIABLE rpm_result_ - OUTPUT_VARIABLE rpm_output_ - ERROR_VARIABLE error_variable_ - OUTPUT_STRIP_TRAILING_WHITESPACE) - - if(rpm_result_ OR NOT rpm_output_ STREQUAL "libsuggested") - message(FATAL_ERROR "RPM_SUGGESTED package error: no suggested packages" - " (result: '${rpm_result_}'; output: '${rpm_output_}';" - " error: '${error_variable_}')") - endif() -endif() diff --git a/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/test.cmake b/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/test.cmake deleted file mode 100644 index dc90ae8..0000000 --- a/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/test.cmake +++ /dev/null @@ -1,3 +0,0 @@ -install(FILES CMakeLists.txt DESTINATION foo) - -set(CPACK_RPM_PACKAGE_SUGGESTS "libsuggested") diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake new file mode 100644 index 0000000..6142eb3 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake @@ -0,0 +1,2 @@ +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt b/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt new file mode 100644 index 0000000..feb296c --- /dev/null +++ b/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt @@ -0,0 +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$ diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake new file mode 100644 index 0000000..32cc6d1 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake @@ -0,0 +1,31 @@ +execute_process(COMMAND ${RPMBUILD_EXECUTABLE} --querytags + OUTPUT_VARIABLE RPMBUILD_CAPS + RESULT_VARIABLE RPMBUILD_CAPS_RESULT) + +if(NOT RPMBUILD_CAPS_RESULT) + string(REPLACE "\n" ";" RPMBUILD_CAPS "${RPMBUILD_CAPS}") + cmake_policy(PUSH) + cmake_policy(SET CMP0057 NEW) + if(SUGGESTS IN_LIST RPMBUILD_CAPS) + set(should_contain_suggests_tag_ true) + endif() + cmake_policy(POP) +endif() + +# Only verify that suggests tag is present only if that tag is supported. +# If it is not supported the rpm package was corretly generated by ignoring +# that tag and that was already checked by expected files test. +if(should_contain_suggests_tag_) + execute_process(COMMAND ${RPM_EXECUTABLE} -q --suggests -p "${FOUND_FILE_1}" + WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" + RESULT_VARIABLE rpm_result_ + OUTPUT_VARIABLE rpm_output_ + ERROR_VARIABLE error_variable_ + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(rpm_result_ OR NOT rpm_output_ STREQUAL "libsuggested") + message(FATAL_ERROR "RPM_SUGGESTED package error: no suggested packages" + " (result: '${rpm_result_}'; output: '${rpm_output_}';" + " error: '${error_variable_}')") + endif() +endif() diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/test.cmake b/Tests/RunCMake/CPack/tests/SUGGESTS/test.cmake new file mode 100644 index 0000000..dc90ae8 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/SUGGESTS/test.cmake @@ -0,0 +1,3 @@ +install(FILES CMakeLists.txt DESTINATION foo) + +set(CPACK_RPM_PACKAGE_SUGGESTS "libsuggested") -- cgit v0.12