summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CPack/RPM
diff options
context:
space:
mode:
authorDomen Vrankar <domen.vrankar@gmail.com>2015-12-07 19:13:09 (GMT)
committerDomen Vrankar <domen.vrankar@gmail.com>2015-12-07 19:15:49 (GMT)
commit27e6f74f29084fbdee35eb5a8d309d99d39e66d8 (patch)
treef3e5b472c3819b37c5b35d1805b6ec716e6aaed3 /Tests/RunCMake/CPack/RPM
parentc926efa1398aa2c4ff273dee173d84d0031bcdf6 (diff)
downloadCMake-27e6f74f29084fbdee35eb5a8d309d99d39e66d8.zip
CMake-27e6f74f29084fbdee35eb5a8d309d99d39e66d8.tar.gz
CMake-27e6f74f29084fbdee35eb5a8d309d99d39e66d8.tar.bz2
CPack: Added tests for package name and group controll fields
Diffstat (limited to 'Tests/RunCMake/CPack/RPM')
-rw-r--r--Tests/RunCMake/CPack/RPM/Helpers.cmake9
-rw-r--r--Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-ExpectedFiles.cmake9
-rw-r--r--Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-VerifyResult.cmake18
-rw-r--r--Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake5
4 files changed, 41 insertions, 0 deletions
diff --git a/Tests/RunCMake/CPack/RPM/Helpers.cmake b/Tests/RunCMake/CPack/RPM/Helpers.cmake
index 98cdad8..ba77a4a 100644
--- a/Tests/RunCMake/CPack/RPM/Helpers.cmake
+++ b/Tests/RunCMake/CPack/RPM/Helpers.cmake
@@ -8,3 +8,12 @@ function(getPackageContent FILE RESULT_VAR)
set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE)
endfunction()
+
+function(getPackageInfo FILE RESULT_VAR)
+ execute_process(COMMAND ${RPM_EXECUTABLE} -pqi ${FILE}
+ OUTPUT_VARIABLE info_content
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ set(${RESULT_VAR} "${info_content}" PARENT_SCOPE)
+endfunction()
diff --git a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-ExpectedFiles.cmake
new file mode 100644
index 0000000..3d28d41
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-ExpectedFiles.cmake
@@ -0,0 +1,9 @@
+set(whitespaces_ "[\t\n\r ]*")
+
+set(EXPECTED_FILES_COUNT "3")
+set(EXPECTED_FILE_1 "per_component*-pkg_1.rpm")
+set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
+set(EXPECTED_FILE_2 "per_component*-pkg_2.rpm")
+set(EXPECTED_FILE_CONTENT_2 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
+set(EXPECTED_FILE_3 "per_component*-pkg_3.rpm")
+set(EXPECTED_FILE_CONTENT_3 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
diff --git a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-VerifyResult.cmake b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-VerifyResult.cmake
new file mode 100644
index 0000000..d7d4f9d
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-VerifyResult.cmake
@@ -0,0 +1,18 @@
+function(checkPackageInfo_ TYPE FILE REGEX)
+ set(whitespaces_ "[\t\n\r ]*")
+
+ getPackageInfo("${FILE}" "FILE_INFO_")
+ if(NOT FILE_INFO_ MATCHES "${REGEX}")
+ message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}'; file info: '${FILE_INFO_}'")
+ endif()
+endfunction()
+
+# check package name
+checkPackageInfo_("name" "${FOUND_FILE_1}" ".*Name${whitespaces_}:${whitespaces_}per_component-pkg_1")
+checkPackageInfo_("name" "${FOUND_FILE_2}" ".*Name${whitespaces_}:${whitespaces_}second")
+checkPackageInfo_("name" "${FOUND_FILE_3}" ".*Name${whitespaces_}:${whitespaces_}per_component-pkg_3")
+
+# check package group
+checkPackageInfo_("group" "${FOUND_FILE_1}" ".*Group${whitespaces_}:${whitespaces_}default")
+checkPackageInfo_("group" "${FOUND_FILE_2}" ".*Group${whitespaces_}:${whitespaces_}second_group")
+checkPackageInfo_("group" "${FOUND_FILE_3}" ".*Group${whitespaces_}:${whitespaces_}default")
diff --git a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake
new file mode 100644
index 0000000..d398168
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake
@@ -0,0 +1,5 @@
+set(CPACK_RPM_COMPONENT_INSTALL "ON")
+
+set(CPACK_RPM_PACKAGE_GROUP "default")
+set(CPACK_RPM_pkg_2_PACKAGE_NAME "second")
+set(CPACK_RPM_pkg_2_PACKAGE_GROUP "second_group")