summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CPack/DEB
diff options
context:
space:
mode:
authorDomen Vrankar <domen.vrankar@gmail.com>2015-06-05 19:03:26 (GMT)
committerBrad King <brad.king@kitware.com>2015-06-15 19:09:07 (GMT)
commite726fc025a3543c0be8a4eb217b0a80f9c16051c (patch)
tree2ed4f4114caff68ff16d06fc2e0e518ff6f5a771 /Tests/RunCMake/CPack/DEB
parent092f1539af99e031c99a74d5a0f24731f58bf10a (diff)
downloadCMake-e726fc025a3543c0be8a4eb217b0a80f9c16051c.zip
CMake-e726fc025a3543c0be8a4eb217b0a80f9c16051c.tar.gz
CMake-e726fc025a3543c0be8a4eb217b0a80f9c16051c.tar.bz2
Tests: Add RunCMake tests for CPack{Deb,RPM}
Add script structure for easier addition of new CPack related tests.
Diffstat (limited to 'Tests/RunCMake/CPack/DEB')
-rw-r--r--Tests/RunCMake/CPack/DEB/Helpers.cmake10
-rw-r--r--Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake5
-rw-r--r--Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake1
-rw-r--r--Tests/RunCMake/CPack/DEB/Prerequirements.cmake8
4 files changed, 24 insertions, 0 deletions
diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake
new file mode 100644
index 0000000..4ed3fbd
--- /dev/null
+++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake
@@ -0,0 +1,10 @@
+set(ALL_FILES_GLOB "*.deb")
+
+function(getPackageContent FILE RESULT_VAR)
+ execute_process(COMMAND ${DPKG_EXECUTABLE} -c ${FILE}
+ OUTPUT_VARIABLE package_content_
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE)
+endfunction()
diff --git a/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake
new file mode 100644
index 0000000..9e4aa7c
--- /dev/null
+++ b/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake
@@ -0,0 +1,5 @@
+set(whitespaces_ "[\t\n\r ]*")
+
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_1 "minimal*.deb")
+set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/foo/${whitespaces_}.*/usr/foo/CMakeLists.txt$")
diff --git a/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake b/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake
new file mode 100644
index 0000000..8821ab9
--- /dev/null
+++ b/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake
@@ -0,0 +1 @@
+set(CPACK_PACKAGE_CONTACT "someone")
diff --git a/Tests/RunCMake/CPack/DEB/Prerequirements.cmake b/Tests/RunCMake/CPack/DEB/Prerequirements.cmake
new file mode 100644
index 0000000..197b99d
--- /dev/null
+++ b/Tests/RunCMake/CPack/DEB/Prerequirements.cmake
@@ -0,0 +1,8 @@
+function(get_test_prerequirements found_var config_file)
+ find_program(DPKG_EXECUTABLE dpkg)
+
+ if(DPKG_EXECUTABLE)
+ file(WRITE "${config_file}" "set(DPKG_EXECUTABLE \"${DPKG_EXECUTABLE}\")")
+ set(${found_var} true PARENT_SCOPE)
+ endif()
+endfunction()