From f921a00032aa3baba92a034104b2a538097cda73 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 16 Sep 2019 15:21:08 -0700 Subject: tar.test: add a test for a sparse file with a hole at the end. --- tests/tar.test | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'tests') 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 -- cgit v1.2.3