diff options
author | Kasper Laudrup <you@example.com> | 2022-03-13 18:16:25 (GMT) |
---|---|---|
committer | Kasper Laudrup <you@example.com> | 2022-03-23 13:41:34 (GMT) |
commit | f692cba34b758f5c308c3fd659c438ce022a0a80 (patch) | |
tree | 2e6bf24a0b3e90e0d44366fe023d93e1add16ba7 /Tests/RunCMake/CommandLineTar | |
parent | 14d3f2a5c817683712ff78e0bebaa660c84ff0b3 (diff) | |
download | CMake-f692cba34b758f5c308c3fd659c438ce022a0a80.zip CMake-f692cba34b758f5c308c3fd659c438ce022a0a80.tar.gz CMake-f692cba34b758f5c308c3fd659c438ce022a0a80.tar.bz2 |
Tests: Add test for 'cmake -E tar --mtime' option
Add a test for ensuring the `--mtime` option works as expected.
Diffstat (limited to 'Tests/RunCMake/CommandLineTar')
-rw-r--r-- | Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLineTar/mtime-tests.cmake | 9 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLineTar/set-mtime.cmake | 11 |
3 files changed, 23 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake b/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake index a64af95..079a535 100644 --- a/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake @@ -34,3 +34,6 @@ run_cmake(zip) # Extracting only selected files or directories run_cmake(zip-filtered) + +# Use the --mtime option to set the mtime when creating archive +run_cmake(set-mtime) diff --git a/Tests/RunCMake/CommandLineTar/mtime-tests.cmake b/Tests/RunCMake/CommandLineTar/mtime-tests.cmake new file mode 100644 index 0000000..8b4f098 --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/mtime-tests.cmake @@ -0,0 +1,9 @@ +set(OUTPUT_NAME "test.tar") + +set(ARCHIVE_MTIME "1970-01-01UTC") +set(ARCHIVE_MTIME_RFC3339 "1970-01-01T00:00:00Z") + +set(COMPRESSION_FLAGS cvf) +set(COMPRESSION_OPTIONS --mtime=${ARCHIVE_MTIME}) + +set(DECOMPRESSION_FLAGS xvf) diff --git a/Tests/RunCMake/CommandLineTar/set-mtime.cmake b/Tests/RunCMake/CommandLineTar/set-mtime.cmake new file mode 100644 index 0000000..333cc88 --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/set-mtime.cmake @@ -0,0 +1,11 @@ +include(${CMAKE_CURRENT_LIST_DIR}/mtime-tests.cmake) + +include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake) + +foreach(file ${CHECK_FILES}) + file(TIMESTAMP ${FULL_DECOMPRESS_DIR}/${COMPRESS_DIR}/${file} MTIME UTC) + if(NOT MTIME STREQUAL ARCHIVE_MTIME_RFC3339) + message(FATAL_ERROR + "Extracted timestamp ${MTIME} does not match expected ${ARCHIVE_MTIME_RFC3339}") + endif() +endforeach() |