zstd/backport-zstd-1.5.0-patch-2-add-tests-set-mtime-on-output-files.patch
2021-11-03 16:37:39 +08:00

36 lines
1.1 KiB
Diff

diff -Nur zstd-1.5.0/tests/playTests.sh new-zstd-1.5.0/tests/playTests.sh
--- zstd-1.5.0/tests/playTests.sh 2021-05-14 22:59:34.000000000 +0800
+++ new-zstd-1.5.0/tests/playTests.sh 2021-11-03 11:22:19.974962223 +0800
@@ -124,6 +124,13 @@
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" ;;
@@ -583,6 +590,17 @@
rm -f tmp.img tmp.img.zst tmp.img.copy
fi
+println "\n==> zstd created file timestamp tests"
+datagen > tmp
+touch -m -t 200001010000.00 tmp
+println "test: copy mtime in file -> file compression"
+zstd -f tmp -o tmp.zst
+assertSameMTime tmp tmp.zst
+println "test: copy mtime in file -> file decopmresssion"
+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