Browse Source

Tests: Add test for 'cmake -E tar --mtime' option

Add a test for ensuring the `--mtime` option works as expected.
pull/349/head
Kasper Laudrup 3 years ago
parent
commit
f692cba34b
  1. 3
      Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake
  2. 9
      Tests/RunCMake/CommandLineTar/mtime-tests.cmake
  3. 11
      Tests/RunCMake/CommandLineTar/set-mtime.cmake

3
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)

9
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)

11
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()
Loading…
Cancel
Save