aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-09-16 15:21:08 -0700
committerRob Landley <rob@landley.net>2019-09-17 04:56:36 -0500
commitf921a00032aa3baba92a034104b2a538097cda73 (patch)
tree5b347a18f5cdb7e054c2ca838994ad0bba1d3abc /tests
parente0e35aaf3f84c544416dd0b23ecc22e07a4f921b (diff)
downloadtoybox-f921a00032aa3baba92a034104b2a538097cda73.tar.gz
tar.test: add a test for a sparse file with a hole at the end.
Diffstat (limited to 'tests')
-rw-r--r--tests/tar.test14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/tar.test b/tests/tar.test
index aacf2466..235c3160 100644
--- a/tests/tar.test
+++ b/tests/tar.test
@@ -222,19 +222,29 @@ rm fweep
for i in $(seq 8 3 200)
do
dd if=/dev/zero of=fweep bs=65536 seek=$i count=1 2>/dev/null
+ dd if=/dev/zero of=fweep2 bs=65536 seek=$i count=1 2>/dev/null
done
+truncate -s 20m fweep2
testing "sparse double overflow" "$TAR --sparse fweep | SUM 7" \
"f1fe57f8313a9d682ec9013a80f3798910b6ff51\n" "" ""
tar c --sparse fweep > fweep.tar
-FWEEP=$(du fweep)
+FWEEP=$(stat -c "%b %s" fweep)
rm fweep
-testing "sparse extract" "tar xf fweep.tar && du fweep" "$FWEEP\n" "" ""
+testing "sparse extract" "tar xf fweep.tar && stat -c '%b %s' fweep" \
+ "$FWEEP\n" "" ""
testing "sparse tvf" "tar tvf fweep.tar | grep -wq 13172736 && echo right size"\
"right size\n" "" ""
rm fweep fweep.tar
+tar c --sparse fweep2 > fweep2.tar
+FWEEP=$(stat -c "%b %s" fweep2)
+rm fweep2
+testing "sparse extract hole at end" \
+ "tar xf fweep2.tar && stat -c '%b %s' fweep2" "$FWEEP\n" "" ""
+rm fweep2 fweep2.tar
+
if false
then