summaryrefslogtreecommitdiff
path: root/Tests/RunCMake/CommandLineTar
diff options
context:
space:
mode:
authorNils Gladitz <nilsgladitz@gmail.com>2015-04-07 19:40:33 +0200
committerBrad King <brad.king@kitware.com>2015-04-10 08:32:32 -0400
commit6c4781baa9ea4cfb7b4de9ef91e58888286fab44 (patch)
tree992b9334ad833f69543702c50d1166ff1b2c06e4 /Tests/RunCMake/CommandLineTar
parentfd04d87323749c15969982d9aa9b72059f33463b (diff)
downloadcmake-6c4781baa9ea4cfb7b4de9ef91e58888286fab44.tar.gz
Tests: Consolidate, refactor and extend -E tar tests
Diffstat (limited to 'Tests/RunCMake/CommandLineTar')
-rw-r--r--Tests/RunCMake/CommandLineTar/7zip-gz-result.txt1
-rw-r--r--Tests/RunCMake/CommandLineTar/7zip-gz-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLineTar/7zip.cmake10
-rw-r--r--Tests/RunCMake/CommandLineTar/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake28
-rw-r--r--Tests/RunCMake/CommandLineTar/bad-format-result.txt1
-rw-r--r--Tests/RunCMake/CommandLineTar/bad-format-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLineTar/bad-from1-result.txt1
-rw-r--r--Tests/RunCMake/CommandLineTar/bad-from1-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLineTar/bad-from2-result.txt1
-rw-r--r--Tests/RunCMake/CommandLineTar/bad-from2-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLineTar/bad-from3-result.txt1
-rw-r--r--Tests/RunCMake/CommandLineTar/bad-from3-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLineTar/bad-from3.txt1
-rw-r--r--Tests/RunCMake/CommandLineTar/bad-from4-result.txt1
-rw-r--r--Tests/RunCMake/CommandLineTar/bad-from4-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLineTar/bad-from4.txt2
-rw-r--r--Tests/RunCMake/CommandLineTar/bad-from5-result.txt1
-rw-r--r--Tests/RunCMake/CommandLineTar/bad-from5-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLineTar/bad-from5.txt2
-rw-r--r--Tests/RunCMake/CommandLineTar/bad-mtime1-result.txt1
-rw-r--r--Tests/RunCMake/CommandLineTar/bad-mtime1-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLineTar/bad-opt1-result.txt1
-rw-r--r--Tests/RunCMake/CommandLineTar/bad-opt1-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLineTar/end-opt1-result.txt1
-rw-r--r--Tests/RunCMake/CommandLineTar/end-opt1-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLineTar/gnutar-gz.cmake10
-rw-r--r--Tests/RunCMake/CommandLineTar/gnutar.cmake10
-rw-r--r--Tests/RunCMake/CommandLineTar/pax-xz.cmake10
-rw-r--r--Tests/RunCMake/CommandLineTar/pax.cmake10
-rw-r--r--Tests/RunCMake/CommandLineTar/paxr-bz2.cmake10
-rw-r--r--Tests/RunCMake/CommandLineTar/paxr.cmake10
-rw-r--r--Tests/RunCMake/CommandLineTar/roundtrip.cmake81
-rw-r--r--Tests/RunCMake/CommandLineTar/zip-bz2-result.txt1
-rw-r--r--Tests/RunCMake/CommandLineTar/zip-bz2-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLineTar/zip.cmake10
36 files changed, 224 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLineTar/7zip-gz-result.txt b/Tests/RunCMake/CommandLineTar/7zip-gz-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/7zip-gz-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLineTar/7zip-gz-stderr.txt b/Tests/RunCMake/CommandLineTar/7zip-gz-stderr.txt
new file mode 100644
index 0000000000..2fad3266db
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/7zip-gz-stderr.txt
@@ -0,0 +1 @@
+CMake Error: Can not use compression flags with format: 7zip
diff --git a/Tests/RunCMake/CommandLineTar/7zip.cmake b/Tests/RunCMake/CommandLineTar/7zip.cmake
new file mode 100644
index 0000000000..4bc654846e
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/7zip.cmake
@@ -0,0 +1,10 @@
+set(OUTPUT_NAME "test.7z")
+
+set(COMPRESSION_FLAGS cvf)
+set(COMPRESSION_OPTIONS --format=7zip)
+
+set(DECOMPRESSION_FLAGS xvf)
+
+include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake)
+
+check_magic("377abcaf271c" LIMIT 6 HEX)
diff --git a/Tests/RunCMake/CommandLineTar/CMakeLists.txt b/Tests/RunCMake/CommandLineTar/CMakeLists.txt
new file mode 100644
index 0000000000..2897109554
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.0)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake b/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake
new file mode 100644
index 0000000000..12635dbfb0
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake
@@ -0,0 +1,28 @@
+include(RunCMake)
+
+function(external_command_test NAME)
+ run_cmake_command(${NAME} ${CMAKE_COMMAND} -E ${ARGN})
+endfunction()
+
+external_command_test(bad-opt1 tar cvf bad.tar --bad)
+external_command_test(bad-mtime1 tar cvf bad.tar --mtime=bad .)
+external_command_test(bad-from1 tar cvf bad.tar --files-from=bad)
+external_command_test(bad-from2 tar cvf bad.tar --files-from=.)
+external_command_test(bad-from3 tar cvf bad.tar --files-from=${CMAKE_CURRENT_LIST_DIR}/bad-from3.txt)
+external_command_test(bad-from4 tar cvf bad.tar --files-from=${CMAKE_CURRENT_LIST_DIR}/bad-from4.txt)
+external_command_test(bad-from5 tar cvf bad.tar --files-from=${CMAKE_CURRENT_LIST_DIR}/bad-from5.txt)
+external_command_test(end-opt1 tar cvf bad.tar -- --bad)
+external_command_test(end-opt2 tar cvf bad.tar --)
+external_command_test(mtime tar cvf bad.tar "--mtime=1970-01-01 00:00:00 UTC")
+external_command_test(bad-format tar cvf bad.tar "--format=bad-format")
+external_command_test(zip-bz2 tar cvjf bad.tar "--format=zip")
+external_command_test(7zip-gz tar cvzf bad.tar "--format=7zip")
+
+run_cmake(7zip)
+run_cmake(gnutar)
+run_cmake(gnutar-gz)
+run_cmake(pax)
+run_cmake(pax-xz)
+run_cmake(paxr)
+run_cmake(paxr-bz2)
+run_cmake(zip)
diff --git a/Tests/RunCMake/CommandLineTar/bad-format-result.txt b/Tests/RunCMake/CommandLineTar/bad-format-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/bad-format-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLineTar/bad-format-stderr.txt b/Tests/RunCMake/CommandLineTar/bad-format-stderr.txt
new file mode 100644
index 0000000000..fe9e2dccf3
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/bad-format-stderr.txt
@@ -0,0 +1 @@
+CMake Error: Unknown -E tar --format= argument: bad-format
diff --git a/Tests/RunCMake/CommandLineTar/bad-from1-result.txt b/Tests/RunCMake/CommandLineTar/bad-from1-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/bad-from1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLineTar/bad-from1-stderr.txt b/Tests/RunCMake/CommandLineTar/bad-from1-stderr.txt
new file mode 100644
index 0000000000..d67431d408
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/bad-from1-stderr.txt
@@ -0,0 +1 @@
+^CMake Error: -E tar --files-from= file 'bad' not found$
diff --git a/Tests/RunCMake/CommandLineTar/bad-from2-result.txt b/Tests/RunCMake/CommandLineTar/bad-from2-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/bad-from2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLineTar/bad-from2-stderr.txt b/Tests/RunCMake/CommandLineTar/bad-from2-stderr.txt
new file mode 100644
index 0000000000..d1d278c73b
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/bad-from2-stderr.txt
@@ -0,0 +1 @@
+^CMake Error: -E tar --files-from= file '\.' is a directory$
diff --git a/Tests/RunCMake/CommandLineTar/bad-from3-result.txt b/Tests/RunCMake/CommandLineTar/bad-from3-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/bad-from3-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLineTar/bad-from3-stderr.txt b/Tests/RunCMake/CommandLineTar/bad-from3-stderr.txt
new file mode 100644
index 0000000000..da32ad917e
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/bad-from3-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: -E tar --files-from='.*/Tests/RunCMake/CommandLineTar/bad-from3.txt' file invalid line:
+-add-file=option-typo$
diff --git a/Tests/RunCMake/CommandLineTar/bad-from3.txt b/Tests/RunCMake/CommandLineTar/bad-from3.txt
new file mode 100644
index 0000000000..5bad1c3f35
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/bad-from3.txt
@@ -0,0 +1 @@
+-add-file=option-typo
diff --git a/Tests/RunCMake/CommandLineTar/bad-from4-result.txt b/Tests/RunCMake/CommandLineTar/bad-from4-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/bad-from4-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLineTar/bad-from4-stderr.txt b/Tests/RunCMake/CommandLineTar/bad-from4-stderr.txt
new file mode 100644
index 0000000000..1417d4d32a
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/bad-from4-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: archive_read_disk_entry_from_file 'does-not-exist':.*
+CMake Error: Problem creating tar: bad.tar$
diff --git a/Tests/RunCMake/CommandLineTar/bad-from4.txt b/Tests/RunCMake/CommandLineTar/bad-from4.txt
new file mode 100644
index 0000000000..4b97f796ce
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/bad-from4.txt
@@ -0,0 +1,2 @@
+
+does-not-exist
diff --git a/Tests/RunCMake/CommandLineTar/bad-from5-result.txt b/Tests/RunCMake/CommandLineTar/bad-from5-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/bad-from5-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLineTar/bad-from5-stderr.txt b/Tests/RunCMake/CommandLineTar/bad-from5-stderr.txt
new file mode 100644
index 0000000000..1417d4d32a
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/bad-from5-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: archive_read_disk_entry_from_file 'does-not-exist':.*
+CMake Error: Problem creating tar: bad.tar$
diff --git a/Tests/RunCMake/CommandLineTar/bad-from5.txt b/Tests/RunCMake/CommandLineTar/bad-from5.txt
new file mode 100644
index 0000000000..9ea755b260
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/bad-from5.txt
@@ -0,0 +1,2 @@
+
+--add-file=does-not-exist
diff --git a/Tests/RunCMake/CommandLineTar/bad-mtime1-result.txt b/Tests/RunCMake/CommandLineTar/bad-mtime1-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/bad-mtime1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLineTar/bad-mtime1-stderr.txt b/Tests/RunCMake/CommandLineTar/bad-mtime1-stderr.txt
new file mode 100644
index 0000000000..ca925f1608
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/bad-mtime1-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: unable to parse mtime 'bad'
+CMake Error: Problem creating tar: bad.tar$
diff --git a/Tests/RunCMake/CommandLineTar/bad-opt1-result.txt b/Tests/RunCMake/CommandLineTar/bad-opt1-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/bad-opt1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLineTar/bad-opt1-stderr.txt b/Tests/RunCMake/CommandLineTar/bad-opt1-stderr.txt
new file mode 100644
index 0000000000..35133c80d6
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/bad-opt1-stderr.txt
@@ -0,0 +1 @@
+^CMake Error: Unknown option to -E tar: --bad$
diff --git a/Tests/RunCMake/CommandLineTar/end-opt1-result.txt b/Tests/RunCMake/CommandLineTar/end-opt1-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/end-opt1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLineTar/end-opt1-stderr.txt b/Tests/RunCMake/CommandLineTar/end-opt1-stderr.txt
new file mode 100644
index 0000000000..1fddf6d2d7
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/end-opt1-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: archive_read_disk_entry_from_file '--bad':.*
+CMake Error: Problem creating tar: bad.tar$
diff --git a/Tests/RunCMake/CommandLineTar/gnutar-gz.cmake b/Tests/RunCMake/CommandLineTar/gnutar-gz.cmake
new file mode 100644
index 0000000000..5f2674a8fb
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/gnutar-gz.cmake
@@ -0,0 +1,10 @@
+set(OUTPUT_NAME "test.tar.gz")
+
+set(COMPRESSION_FLAGS cvzf)
+set(COMPRESSION_OPTIONS --format=gnutar)
+
+set(DECOMPRESSION_FLAGS xvzf)
+
+include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake)
+
+check_magic("1f8b" LIMIT 2 HEX)
diff --git a/Tests/RunCMake/CommandLineTar/gnutar.cmake b/Tests/RunCMake/CommandLineTar/gnutar.cmake
new file mode 100644
index 0000000000..aaca596f51
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/gnutar.cmake
@@ -0,0 +1,10 @@
+set(OUTPUT_NAME "test.tar")
+
+set(COMPRESSION_FLAGS cvf)
+set(COMPRESSION_OPTIONS --format=gnutar)
+
+set(DECOMPRESSION_FLAGS xvf)
+
+include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake)
+
+check_magic("7573746172202000" OFFSET 257 LIMIT 8 HEX)
diff --git a/Tests/RunCMake/CommandLineTar/pax-xz.cmake b/Tests/RunCMake/CommandLineTar/pax-xz.cmake
new file mode 100644
index 0000000000..baf63d5c8a
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/pax-xz.cmake
@@ -0,0 +1,10 @@
+set(OUTPUT_NAME "test.tar.xz")
+
+set(COMPRESSION_FLAGS cvJf)
+set(COMPRESSION_OPTIONS --format=pax)
+
+set(DECOMPRESSION_FLAGS xvJf)
+
+include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake)
+
+check_magic("fd377a585a00" LIMIT 6 HEX)
diff --git a/Tests/RunCMake/CommandLineTar/pax.cmake b/Tests/RunCMake/CommandLineTar/pax.cmake
new file mode 100644
index 0000000000..60ed2385c7
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/pax.cmake
@@ -0,0 +1,10 @@
+set(OUTPUT_NAME "test.tar")
+
+set(COMPRESSION_FLAGS cvf)
+set(COMPRESSION_OPTIONS --format=pax)
+
+set(DECOMPRESSION_FLAGS xvf)
+
+include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake)
+
+check_magic("7573746172003030" OFFSET 257 LIMIT 8 HEX)
diff --git a/Tests/RunCMake/CommandLineTar/paxr-bz2.cmake b/Tests/RunCMake/CommandLineTar/paxr-bz2.cmake
new file mode 100644
index 0000000000..881a0af3bb
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/paxr-bz2.cmake
@@ -0,0 +1,10 @@
+set(OUTPUT_NAME "test.tar.bz2")
+
+set(COMPRESSION_FLAGS cvjf)
+set(COMPRESSION_OPTIONS --format=paxr)
+
+set(DECOMPRESSION_FLAGS xvjf)
+
+include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake)
+
+check_magic("425a68" LIMIT 3 HEX)
diff --git a/Tests/RunCMake/CommandLineTar/paxr.cmake b/Tests/RunCMake/CommandLineTar/paxr.cmake
new file mode 100644
index 0000000000..968a103cad
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/paxr.cmake
@@ -0,0 +1,10 @@
+set(OUTPUT_NAME "test.tar")
+
+set(COMPRESSION_FLAGS cvf)
+set(COMPRESSION_OPTIONS --format=paxr)
+
+set(DECOMPRESSION_FLAGS xvf)
+
+include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake)
+
+check_magic("7573746172003030" OFFSET 257 LIMIT 8 HEX)
diff --git a/Tests/RunCMake/CommandLineTar/roundtrip.cmake b/Tests/RunCMake/CommandLineTar/roundtrip.cmake
new file mode 100644
index 0000000000..dc1c885280
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/roundtrip.cmake
@@ -0,0 +1,81 @@
+foreach(parameter OUTPUT_NAME COMPRESSION_FLAGS DECOMPRESSION_FLAGS)
+ if(NOT DEFINED ${parameter})
+ message(FATAL_ERROR "missing required parameter ${parameter}")
+ endif()
+endforeach()
+
+function(run_tar WORKING_DIRECTORY)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E tar ${ARGN}
+ WORKING_DIRECTORY ${WORKING_DIRECTORY}
+ RESULT_VARIABLE result
+ )
+
+ if(NOT result STREQUAL "0")
+ message(FATAL_ERROR "tar failed with arguments [${ARGN}] result [${result}]")
+ endif()
+endfunction()
+
+set(COMPRESS_DIR compress_dir)
+set(FULL_COMPRESS_DIR ${CMAKE_CURRENT_BINARY_DIR}/${COMPRESS_DIR})
+
+set(DECOMPRESS_DIR decompress_dir)
+set(FULL_DECOMPRESS_DIR ${CMAKE_CURRENT_BINARY_DIR}/${DECOMPRESS_DIR})
+
+set(FULL_OUTPUT_NAME ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_NAME})
+
+set(CHECK_FILES
+ "f1.txt"
+ "d1/f1.txt"
+ "d 2/f1.txt"
+ "d + 3/f1.txt"
+ "d_4/f1.txt"
+ "d-4/f1.txt"
+ "My Special Directory/f1.txt"
+)
+
+foreach(file ${CHECK_FILES})
+ configure_file(${CMAKE_CURRENT_LIST_FILE} ${FULL_COMPRESS_DIR}/${file} COPYONLY)
+endforeach()
+
+if(UNIX)
+ execute_process(COMMAND ln -sf f1.txt ${FULL_COMPRESS_DIR}/d1/f2.txt)
+ list(APPEND CHECK_FILES "d1/f2.txt")
+endif()
+
+file(REMOVE ${FULL_OUTPUT_NAME})
+file(REMOVE_RECURSE ${FULL_DECOMPRESS_DIR})
+file(MAKE_DIRECTORY ${FULL_DECOMPRESS_DIR})
+
+run_tar(${CMAKE_CURRENT_BINARY_DIR} ${COMPRESSION_FLAGS} ${FULL_OUTPUT_NAME} ${COMPRESSION_OPTIONS} ${COMPRESS_DIR})
+run_tar(${FULL_DECOMPRESS_DIR} ${DECOMPRESSION_FLAGS} ${FULL_OUTPUT_NAME} ${DECOMPRESSION_OPTIONS})
+
+foreach(file ${CHECK_FILES})
+ set(input ${FULL_COMPRESS_DIR}/${file})
+ set(output ${FULL_DECOMPRESS_DIR}/${COMPRESS_DIR}/${file})
+
+ if(NOT EXISTS ${input})
+ message(SEND_ERROR "Cannot find input file ${output}")
+ endif()
+
+ if(NOT EXISTS ${output})
+ message(SEND_ERROR "Cannot find output file ${output}")
+ endif()
+
+ file(MD5 ${input} input_md5)
+ file(MD5 ${output} output_md5)
+
+ if(NOT input_md5 STREQUAL output_md5)
+ message(SEND_ERROR "Files \"${input}\" and \"${output}\" are different")
+ endif()
+endforeach()
+
+function(check_magic EXPECTED)
+ file(READ ${FULL_OUTPUT_NAME} ACTUAL
+ ${ARGN}
+ )
+
+ if(NOT ACTUAL STREQUAL EXPECTED)
+ message(FATAL_ERROR
+ "Actual [${ACTUAL}] does not match expected [${EXPECTED}]")
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/CommandLineTar/zip-bz2-result.txt b/Tests/RunCMake/CommandLineTar/zip-bz2-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/zip-bz2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLineTar/zip-bz2-stderr.txt b/Tests/RunCMake/CommandLineTar/zip-bz2-stderr.txt
new file mode 100644
index 0000000000..1134b4fd4e
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/zip-bz2-stderr.txt
@@ -0,0 +1 @@
+CMake Error: Can not use compression flags with format: zip
diff --git a/Tests/RunCMake/CommandLineTar/zip.cmake b/Tests/RunCMake/CommandLineTar/zip.cmake
new file mode 100644
index 0000000000..08e2fdb9cc
--- /dev/null
+++ b/Tests/RunCMake/CommandLineTar/zip.cmake
@@ -0,0 +1,10 @@
+set(OUTPUT_NAME "test.zip")
+
+set(COMPRESSION_FLAGS cvf)
+set(COMPRESSION_OPTIONS --format=zip)
+
+set(DECOMPRESSION_FLAGS xvf)
+
+include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake)
+
+check_magic("504b0304" LIMIT 4 HEX)