mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-21 22:50:26 -06:00
Tests: Add test for 'cmake -E tar --mtime' option
Add a test for ensuring the `--mtime` option works as expected.
This commit is contained in:
@@ -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
Normal file
9
Tests/RunCMake/CommandLineTar/mtime-tests.cmake
Normal file
@@ -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
Normal file
11
Tests/RunCMake/CommandLineTar/set-mtime.cmake
Normal file
@@ -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()
|
||||
Reference in New Issue
Block a user