summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-05-16 14:11:30 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-05-16 14:11:30 (GMT)
commit2b25174da6d99143eae7c47329d9d0bc7a3ede5d (patch)
tree0935e29ead26fba96aac499246ae357997c80154 /Tests/RunCMake
parentcd1c3d80d09396f8f2caf280098be798df16827f (diff)
parent4461e8bb55e502d6b7ecaf01d5397d239a984896 (diff)
downloadCMake-2b25174da6d99143eae7c47329d9d0bc7a3ede5d.zip
CMake-2b25174da6d99143eae7c47329d9d0bc7a3ede5d.tar.gz
CMake-2b25174da6d99143eae7c47329d9d0bc7a3ede5d.tar.bz2
Merge topic 'cpack-deb-improvements'
4461e8bb CPack/Deb cpack-deb-improvements release notes 7e940bf7 CPack/Deb test changes due to breaking changes 3b648894 CPack/Deb package release number in file name 316dd613 CPack/Deb proper package file naming 271e03f0 CPack/Deb per-component package architecture 23baaf8d CPack/Deb inter package dependencies 3a55a0e7 CPack/Deb proper component packages file naming c7f388e7 CPack/Deb generation of postinst and postrm ldconfig files 2d589653 CPack/Deb generation of DEBIAN/shlibs control file
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CPack/CPackTestHelpers.cmake14
-rw-r--r--Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake2
-rw-r--r--Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake6
-rw-r--r--Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-ExpectedFiles.cmake6
-rw-r--r--Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-Prerequirements.cmake7
-rw-r--r--Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-VerifyResult.cmake3
-rw-r--r--Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-ExpectedFiles.cmake6
-rw-r--r--Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-Prerequirements.cmake7
-rw-r--r--Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-VerifyResult.cmake7
-rw-r--r--Tests/RunCMake/CPack/DEB/DEPENDENCIES-ExpectedFiles.cmake10
-rw-r--r--Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake2
-rw-r--r--Tests/RunCMake/CPack/DEB/Helpers.cmake77
-rw-r--r--Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake2
-rw-r--r--Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-ExpectedFiles.cmake6
-rw-r--r--Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS.cmake17
-rw-r--r--Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS_LDCONFIG.cmake18
-rw-r--r--Tests/RunCMake/CPack/README.txt22
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake2
18 files changed, 198 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/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index ee4112d..2e358f0 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -12,3 +12,5 @@ run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true)
run_cpack_test(COMPONENTS_EMPTY_DIR "RPM;DEB;TGZ" true)
run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" 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)