]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Add test for overwriting read-only
authorSean Purcell <me@seanp.xyz>
Thu, 6 Apr 2017 19:58:49 +0000 (12:58 -0700)
committerSean Purcell <me@seanp.xyz>
Thu, 6 Apr 2017 19:58:49 +0000 (12:58 -0700)
tests/playTests.sh

index 5abbb14e3bc269bea71e8e0f3b85878e45b4c4b8..5409d9aa1ef9617432d18963280814c6566304a8 100755 (executable)
@@ -109,6 +109,13 @@ $ZSTD -q tmp && die "overwrite check failed!"
 $ECHO "test : force overwrite"
 $ZSTD -q -f tmp
 $ZSTD -q --force tmp
+$ECHO "test : overwrite readonly file"
+$ECHO foo > tmpro.zst
+$ECHO foo > tmpro
+chmod 400 tmpro.zst
+$ZSTD -q --force tmpro || die "failed to overwrite read-only file"
+chmod 600 tmpro.zst
+rm tmpro tmpro.zst
 $ECHO "test : file removal"
 $ZSTD -f --rm tmp
 ls tmp && die "tmp should no longer be present"