diff options
author | Petr Orlov <zfmeze@gmail.com> | 2016-08-31 15:05:15 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-09-19 14:22:50 (GMT) |
commit | 1c63aa4d43f101a0d58b5b88d3119c72cadf5517 (patch) | |
tree | 0c347a5de4650e490bb47183e3d39563b1c42113 /Tests | |
parent | 4682b42bdb5a9b7ca9f6ef5f65c019eec4f92a62 (diff) | |
download | CMake-1c63aa4d43f101a0d58b5b88d3119c72cadf5517.zip CMake-1c63aa4d43f101a0d58b5b88d3119c72cadf5517.tar.gz CMake-1c63aa4d43f101a0d58b5b88d3119c72cadf5517.tar.bz2 |
CPack: Add option to generate a checksum file next to each package file
Add variable CPACK_PACKAGE_CHECKSUM to activate it.
Diffstat (limited to 'Tests')
5 files changed, 30 insertions, 0 deletions
diff --git a/Tests/RunCMake/CPack/PACKAGE_CHECKSUM.cmake b/Tests/RunCMake/CPack/PACKAGE_CHECKSUM.cmake new file mode 100644 index 0000000..5ca288c --- /dev/null +++ b/Tests/RunCMake/CPack/PACKAGE_CHECKSUM.cmake @@ -0,0 +1,4 @@ +install(FILES CMakeLists.txt DESTINATION foo) + +set(CPACK_PACKAGE_NAME "package_checksum") +set(CPACK_PACKAGE_CHECKSUM ${RunCMake_SUBTEST_SUFFIX}) diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index a3029cf..abad58b 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -18,3 +18,4 @@ run_cpack_test(DEB_GENERATE_SHLIBS "DEB" true) run_cpack_test(DEB_GENERATE_SHLIBS_LDCONFIG "DEB" true) run_cpack_test(DEBUGINFO "RPM" true) run_cpack_test(LONG_FILENAMES "DEB" false) +run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512" "TGZ" false) diff --git a/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-ExpectedFiles.cmake b/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-ExpectedFiles.cmake new file mode 100644 index 0000000..205dcd8 --- /dev/null +++ b/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-ExpectedFiles.cmake @@ -0,0 +1,9 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "0") + +if (NOT ${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid") + set(EXPECTED_FILES_COUNT "1") + set(EXPECTED_FILE_1 "package_checksum*.tar.gz") + set(EXPECTED_FILE_CONTENT_1 "^[^\n]*package_checksum*-[^\n]*/foo/\n[^\n]*package_checksum-[^\n]*/foo/CMakeLists.txt$") +endif() diff --git a/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-VerifyResult.cmake b/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-VerifyResult.cmake new file mode 100644 index 0000000..e9e65d6 --- /dev/null +++ b/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-VerifyResult.cmake @@ -0,0 +1,14 @@ +if(NOT ${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid") + string(TOLOWER ${RunCMake_SUBTEST_SUFFIX} EXTENSION) + file(GLOB PACKAGE RELATIVE ${bin_dir} "*.tar.gz") + file(GLOB CSUMFILE RELATIVE ${bin_dir} "*.${EXTENSION}") + file(STRINGS ${CSUMFILE} CHSUM_VALUE) + file(${RunCMake_SUBTEST_SUFFIX} ${PACKAGE} expected_value ) + set(expected_value "${expected_value} ${PACKAGE}") + + if(NOT expected_value STREQUAL CHSUM_VALUE) + message(FATAL_ERROR "Generated checksum is not valid! Expected [${expected_value}] Got [${CHSUM_VALUE}]") + endif() +else() + message(${error}) +endif() diff --git a/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-invalid-stderr.txt b/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-invalid-stderr.txt new file mode 100644 index 0000000..abf6d8c --- /dev/null +++ b/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-invalid-stderr.txt @@ -0,0 +1,2 @@ +^CPack Error: Cannot recognize algorithm: invalid +CPack Error: Error when generating package: package_checksum$ |