diff options
author | Domen Vrankar <domen.vrankar@gmail.com> | 2016-11-26 17:57:46 (GMT) |
---|---|---|
committer | Domen Vrankar <domen.vrankar@gmail.com> | 2016-11-27 22:20:34 (GMT) |
commit | 53a69c7dd47f693efec85e031b89251dd7bdef2f (patch) | |
tree | 53acaab2bb7329e5a1cfa5c8dc1f35ba9c8be71f /Tests/RunCMake/CPack/tests | |
parent | 70b52a7113664b8b74b231d62ff798952d29ae1f (diff) | |
download | CMake-53a69c7dd47f693efec85e031b89251dd7bdef2f.zip CMake-53a69c7dd47f693efec85e031b89251dd7bdef2f.tar.gz CMake-53a69c7dd47f693efec85e031b89251dd7bdef2f.tar.bz2 |
Tests: CPack move tests to separate dir
For greater transparency tests
are moved to a subfolder with
each test having its own dir.
Diffstat (limited to 'Tests/RunCMake/CPack/tests')
19 files changed, 255 insertions, 0 deletions
diff --git a/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/test.cmake b/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/test.cmake new file mode 100644 index 0000000..9cd91af --- /dev/null +++ b/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/test.cmake @@ -0,0 +1,3 @@ +set(CPACK_COMPONENTS_ALL test) +install(DIRECTORY DESTINATION empty + COMPONENT test) diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake new file mode 100644 index 0000000..115864f --- /dev/null +++ b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake @@ -0,0 +1,5 @@ +set(CPACK_RPM_COMPONENT_INSTALL "ON") + +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) diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake new file mode 100644 index 0000000..70b3cb3 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake @@ -0,0 +1,32 @@ +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) + +# PGI compiler doesn't add build id to binaries by default +if(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") + string(APPEND CMAKE_EXE_LINKER_FLAGS "-Wl,--build-id") + string(APPEND CMAKE_SHARED_LINKER_FLAGS "-Wl,--build-id") +endif() + +set(CPACK_RPM_COMPONENT_INSTALL "ON") + +set(CMAKE_BUILD_TYPE Debug) + +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") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "#include \"test_lib.hpp\"\nint main() {return test_lib();}\n") +add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +target_link_libraries(test_prog test_lib) + +install(TARGETS test_prog DESTINATION foo COMPONENT applications) +install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) +install(TARGETS test_lib DESTINATION bas COMPONENT libs) + +set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT") +set(CPACK_RPM_APPLICATIONS_DEBUGINFO_PACKAGE ON) +set(CPACK_RPM_LIBS_DEBUGINFO_PACKAGE ON) + +set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/src") diff --git a/Tests/RunCMake/CPack/tests/DEB_EXTRA/test.cmake b/Tests/RunCMake/CPack/tests/DEB_EXTRA/test.cmake new file mode 100644 index 0000000..754561d --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEB_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/DEB_GENERATE_SHLIBS/test.cmake b/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/test.cmake new file mode 100644 index 0000000..fa0bc35 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEB_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/DEB_GENERATE_SHLIBS_LDCONFIG/test.cmake b/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/test.cmake new file mode 100644 index 0000000..2fc9e23 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEB_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/DEPENDENCIES/test.cmake b/Tests/RunCMake/CPack/tests/DEPENDENCIES/test.cmake new file mode 100644 index 0000000..4499a7a --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEPENDENCIES/test.cmake @@ -0,0 +1,18 @@ +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") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "#include \"test_lib.hpp\"\nint main() {return test_lib();}\n") +add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +target_link_libraries(test_prog test_lib) + +install(TARGETS test_prog DESTINATION foo COMPONENT applications) +install(TARGETS test_prog DESTINATION foo_auto COMPONENT applications_auto) +install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) +install(TARGETS test_lib DESTINATION bas COMPONENT libs) +install(TARGETS test_lib DESTINATION bas_auto COMPONENT libs_auto) diff --git a/Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake b/Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake new file mode 100644 index 0000000..7bec17d --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake @@ -0,0 +1,2 @@ +install(DIRECTORY DESTINATION empty + COMPONENT test) diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake new file mode 100644 index 0000000..9b3e856 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake @@ -0,0 +1,24 @@ +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) + +# default +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_install.sh" + "echo \"pre install\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_install.sh" + "echo \"post install\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall.sh" + "echo \"pre uninstall\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall.sh" + "echo \"post uninstall\"\n") + +# specific +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_install_foo.sh" + "echo \"pre install foo\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_install_foo.sh" + "echo \"post install foo\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall_foo.sh" + "echo \"pre uninstall foo\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh" + "echo \"post uninstall foo\"\n") + +install(FILES CMakeLists.txt DESTINATION foo COMPONENT foo) +install(FILES CMakeLists.txt DESTINATION bar COMPONENT bar) diff --git a/Tests/RunCMake/CPack/tests/LONG_FILENAMES/test.cmake b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/test.cmake new file mode 100644 index 0000000..3370a50 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/test.cmake @@ -0,0 +1,8 @@ +set(LONG_FILENAME + "${CMAKE_CURRENT_BINARY_DIR}/llllllllll_oooooooooo_nnnnnnnnnn_gggggggggg_ffffffffff_iiiiiiiiii_llllllllll_eeeeeeeeee_nnnnnnnnnn_aaaaaaaaaa_mmmmmmmmmm_eeeeeeeeee.txt") + +file(WRITE + "${LONG_FILENAME}" + "long_filename_test") + +install(FILES ${LONG_FILENAME} DESTINATION foo) diff --git a/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/test.cmake b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/test.cmake new file mode 100644 index 0000000..f2c4451 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/test.cmake @@ -0,0 +1,12 @@ +set(CPACK_RPM_COMPONENT_INSTALL "ON") + +install(FILES CMakeLists.txt DESTINATION foo COMPONENT applications) +install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) +install(FILES CMakeLists.txt DESTINATION bas COMPONENT libs) + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid") + set(CPACK_RPM_MAIN_COMPONENT "") +else() + set(CPACK_RPM_MAIN_COMPONENT "applications") + set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT") +endif() diff --git a/Tests/RunCMake/CPack/tests/MINIMAL/test.cmake b/Tests/RunCMake/CPack/tests/MINIMAL/test.cmake new file mode 100644 index 0000000..83ed0f2 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/MINIMAL/test.cmake @@ -0,0 +1 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) diff --git a/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/test.cmake b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/test.cmake new file mode 100644 index 0000000..0838063 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/test.cmake @@ -0,0 +1,3 @@ +install(FILES CMakeLists.txt DESTINATION foo) + +set(CPACK_PACKAGE_CHECKSUM ${RunCMake_SUBTEST_SUFFIX}) diff --git a/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/test.cmake b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/test.cmake new file mode 100644 index 0000000..31e729b --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/test.cmake @@ -0,0 +1,6 @@ +install(FILES CMakeLists.txt DESTINATION /not_relocatable COMPONENT static) + +set(CPACK_PACKAGE_RELOCATABLE TRUE) +set(CPACK_PACKAGING_INSTALL_PREFIX "/opt") + +set(CPACK_RPM_COMPONENT_INSTALL ON) diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake new file mode 100644 index 0000000..703c1b7 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake @@ -0,0 +1,3 @@ +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) diff --git a/Tests/RunCMake/CPack/tests/RPM_DIST/test.cmake b/Tests/RunCMake/CPack/tests/RPM_DIST/test.cmake new file mode 100644 index 0000000..6bdd2c0 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/RPM_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/RPM_SUGGESTS/test.cmake b/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/test.cmake new file mode 100644 index 0000000..dc90ae8 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/test.cmake @@ -0,0 +1,3 @@ +install(FILES CMakeLists.txt DESTINATION foo) + +set(CPACK_RPM_PACKAGE_SUGGESTS "libsuggested") diff --git a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/test.cmake b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/test.cmake new file mode 100644 index 0000000..60e9038 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/test.cmake @@ -0,0 +1,54 @@ +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) + +# PGI compiler doesn't add build id to binaries by default +if(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") + string(APPEND CMAKE_EXE_LINKER_FLAGS "-Wl,--build-id") + string(APPEND CMAKE_SHARED_LINKER_FLAGS "-Wl,--build-id") +endif() + +if(NOT RunCMake_SUBTEST_SUFFIX STREQUAL "no_components") + set(CPACK_RPM_COMPONENT_INSTALL "ON") +endif() + +set(CMAKE_BUILD_TYPE Debug) + +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") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "#include \"test_lib.hpp\"\nint main() {return test_lib();}\n") +add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +target_link_libraries(test_prog test_lib) + +install(TARGETS test_prog DESTINATION foo COMPONENT applications) + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_main_component" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo") + install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) + install(TARGETS test_lib DESTINATION bas COMPONENT libs) +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_no_debuginfo") + set(CPACK_COMPONENTS_ALL applications) +endif() + +set(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE ON) + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_main" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo") + set(CPACK_RPM_MAIN_COMPONENT "applications") + set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT") +endif() + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_main_component" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component") + set(CPACK_RPM_APPLICATIONS_DEBUGINFO_PACKAGE ON) + set(CPACK_RPM_LIBS_DEBUGINFO_PACKAGE ON) +endif() + +set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/src") diff --git a/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/test.cmake b/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/test.cmake new file mode 100644 index 0000000..359b98f --- /dev/null +++ b/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/test.cmake @@ -0,0 +1,7 @@ +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "int main() {return 0;}\n") +add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") + +install(TARGETS test_prog DESTINATION foo COMPONENT applications) + +set(CPACK_RPM_FILE_NAME "RPM-DEFAULT") |