summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake2
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/CPack/STGZ/Helpers.cmake2
-rw-r--r--Tests/RunCMake/CPack/VerifyResult.cmake6
-rw-r--r--Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake13
-rw-r--r--Tests/RunCMake/CPack/tests/SYMLINKS/TGZ-Prerequirements.cmake5
-rw-r--r--Tests/RunCMake/CPack/tests/SYMLINKS/VerifyResult.cmake26
-rw-r--r--Tests/RunCMake/CPack/tests/SYMLINKS/test.cmake14
8 files changed, 65 insertions, 4 deletions
diff --git a/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake b/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake
index ce039f5..99d3155 100644
--- a/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake
+++ b/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake
@@ -33,7 +33,7 @@ function(getPackageContentList FILE RESULT_VAR)
endfunction()
function(toExpectedContentList FILE_NO CONTENT_VAR)
- findExpectedFile("${FILE_NO}" "file_")
+ findExpectedFile("${FILE_NO}" "file_" "glob_expr_")
# component and monolithic packages differ for some reason by either having
# package filename prefix in path or not
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index 8ca7126..752ce8a 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -24,5 +24,6 @@ run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component;one_component;one_co
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(USER_FILELIST "RPM" false "MONOLITHIC")
run_cpack_test(MD5SUMS "DEB" false "MONOLITHIC;COMPONENT")
diff --git a/Tests/RunCMake/CPack/STGZ/Helpers.cmake b/Tests/RunCMake/CPack/STGZ/Helpers.cmake
index 08224d3..68b1eab 100644
--- a/Tests/RunCMake/CPack/STGZ/Helpers.cmake
+++ b/Tests/RunCMake/CPack/STGZ/Helpers.cmake
@@ -35,7 +35,7 @@ function(getPackageContentList FILE RESULT_VAR)
endfunction()
function(toExpectedContentList FILE_NO CONTENT_VAR)
- findExpectedFile("${FILE_NO}" "file_")
+ findExpectedFile("${FILE_NO}" "file_" "glob_expr_")
get_filename_component(prefix_ "${file_}" NAME)
# NAME_WE removes everything after the dot and dot is in version so replace instead
diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake
index 59751a7..470ebf7 100644
--- a/Tests/RunCMake/CPack/VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/VerifyResult.cmake
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION ${CMAKE_VERSION} FATAL_ERROR)
-function(findExpectedFile FILE_NO RESULT_VAR)
+function(findExpectedFile FILE_NO RESULT_VAR GLOBING_EXPR_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)
@@ -21,6 +21,7 @@ function(findExpectedFile FILE_NO RESULT_VAR)
file(GLOB found_file_ RELATIVE "${bin_dir}" "${EXPECTED_FILE_${FILE_NO}}")
set(${RESULT_VAR} "${found_file_}" PARENT_SCOPE)
+ set(${GLOBING_EXPR_VAR} "${EXPECTED_FILE_${FILE_NO}}" PARENT_SCOPE)
endfunction()
include("${config_file}")
@@ -39,7 +40,8 @@ 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})
- findExpectedFile("${file_no_}" "FOUND_FILE_${file_no_}")
+ findExpectedFile("${file_no_}" "FOUND_FILE_${file_no_}"
+ "EXPECTED_FILE_${file_no_}")
list(APPEND foundFiles_ "${FOUND_FILE_${file_no_}}")
list(LENGTH FOUND_FILE_${file_no_} foundFilesCount_)
diff --git a/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake
new file mode 100644
index 0000000..05be748
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake
@@ -0,0 +1,13 @@
+set(EXPECTED_FILES_COUNT "1")
+
+set(EXPECTED_FILE_CONTENT_1_LIST
+ "/usr"
+ "/usr/empty_dir"
+ "/usr/non_empty_dir"
+ "/usr/non_empty_dir/CMakeLists.txt"
+ "/usr/symlink_to_empty_dir"
+ "/usr/symlink_to_non_empty_dir")
+
+if(PACKAGING_TYPE STREQUAL "COMPONENT")
+ set(EXPECTED_FILE_1_COMPONENT "links")
+endif()
diff --git a/Tests/RunCMake/CPack/tests/SYMLINKS/TGZ-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/SYMLINKS/TGZ-Prerequirements.cmake
new file mode 100644
index 0000000..f3df46b
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/SYMLINKS/TGZ-Prerequirements.cmake
@@ -0,0 +1,5 @@
+function(get_test_prerequirements found_var config_file)
+ if(UNIX) # limit test to platforms that support symlinks
+ set(${found_var} true PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/CPack/tests/SYMLINKS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/SYMLINKS/VerifyResult.cmake
new file mode 100644
index 0000000..0632319
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/SYMLINKS/VerifyResult.cmake
@@ -0,0 +1,26 @@
+set(whitespaces "[\\t\\n\\r ]*")
+
+#######################
+# verify generated symbolic links
+#######################
+file(GLOB_RECURSE symlink_files RELATIVE "${bin_dir}" "${bin_dir}/*/symlink_*")
+
+foreach(check_symlink IN LISTS symlink_files)
+ get_filename_component(symlink_name "${check_symlink}" NAME)
+ execute_process(COMMAND ls -la "${check_symlink}"
+ WORKING_DIRECTORY "${bin_dir}"
+ OUTPUT_VARIABLE SYMLINK_POINT_
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ if("${symlink_name}" STREQUAL "symlink_to_empty_dir")
+ string(REGEX MATCH "^.*${whitespaces}->${whitespaces}empty_dir$" check_symlink "${SYMLINK_POINT_}")
+ elseif("${symlink_name}" STREQUAL "symlink_to_non_empty_dir")
+ string(REGEX MATCH "^.*${whitespaces}->${whitespaces}non_empty_dir$" check_symlink "${SYMLINK_POINT_}")
+ else()
+ message(FATAL_ERROR "error: unexpected rpm symbolic link '${check_symlink}'")
+ endif()
+
+ if(NOT check_symlink)
+ message(FATAL_ERROR "symlink points to unexpected location '${SYMLINK_POINT_}'")
+ endif()
+endforeach()
diff --git a/Tests/RunCMake/CPack/tests/SYMLINKS/test.cmake b/Tests/RunCMake/CPack/tests/SYMLINKS/test.cmake
new file mode 100644
index 0000000..fef765c
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/SYMLINKS/test.cmake
@@ -0,0 +1,14 @@
+install(DIRECTORY DESTINATION empty_dir COMPONENT links)
+install(FILES CMakeLists.txt DESTINATION non_empty_dir COMPONENT links)
+
+# test symbolic link to an empty dir
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink empty_dir symlink_to_empty_dir)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_to_empty_dir DESTINATION "." COMPONENT links)
+
+# test symbolic link to a non empty dir
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink non_empty_dir symlink_to_non_empty_dir)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_to_non_empty_dir DESTINATION "." COMPONENT links)
+
+if(PACKAGING_TYPE STREQUAL "COMPONENT")
+ set(CPACK_COMPONENTS_ALL links)
+endif()