From ead41bcb4ef413f32c733846d2c1a3db0ffcd581 Mon Sep 17 00:00:00 2001 From: "W. Felix Handte" Date: Tue, 3 Aug 2021 17:20:12 -0400 Subject: [PATCH] Add Test to Verify mtime is Copied to Destination --- tests/playTests.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/playTests.sh b/tests/playTests.sh index ce585f22..d108d5d8 100755 --- a/tests/playTests.sh +++ b/tests/playTests.sh @@ -124,6 +124,13 @@ case "$UNAME" in Darwin | FreeBSD | OpenBSD | NetBSD) MTIME="stat -f %m" ;; esac +assertSameMTime() { + MT1=$($MTIME "$1") + MT2=$($MTIME "$2") + echo MTIME $MT1 $MT2 + [ "$MT1" = "$MT2" ] || die "mtime on $1 doesn't match mtime on $2 ($MT1 != $MT2)" +} + GET_PERMS="stat -c %a" case "$UNAME" in Darwin | FreeBSD | OpenBSD | NetBSD) GET_PERMS="stat -f %Lp" ;; @@ -588,6 +595,18 @@ if [ -n "$READFROMBLOCKDEVICE" ] ; then rm -f tmp.img tmp.img.zst tmp.img.copy fi +println "\n===> zstd created file timestamp tests" +datagen > tmp +sleep 1 # could also use touch -t but I don't know how portable that is. +println "test : copy mtime in file -> file compression " +zstd -f tmp -o tmp.zst +assertSameMTime tmp tmp.zst +sleep 1 # could also use touch -t but I don't know how portable that is. +println "test : copy mtime in file -> file decompression " +zstd -f -d tmp.zst -o tmp.out +assertSameMTime tmp.zst tmp.out +rm -f tmp + println "\n===> compress multiple files into an output directory, --output-dir-flat" println henlo > tmp1 mkdir tmpInputTestDir