Merge pull request #2742 from felixhandte/set-mtime

Set mtime on Output Files
This commit is contained in:
Felix Handte
2021-08-04 16:44:46 -04:00
committed by GitHub
4 changed files with 61 additions and 19 deletions
+18
View File
@@ -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,17 @@ if [ -n "$READFROMBLOCKDEVICE" ] ; then
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 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