]> arthur.barton.de Git - bup.git/commitdiff
Test sparse restore of short in-buffer zero run
authorRob Browning <rlb@defaultvalue.org>
Sun, 15 Mar 2015 21:38:34 +0000 (16:38 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sat, 28 Mar 2015 15:55:14 +0000 (10:55 -0500)
Test that sparse --restore handles the case where within one call to
write_sparsely() (one buffer) we have non-zero bytes, followed by a run
of zero bytes that's longer than the minimum sparse run
length (currently 512), followed by non-zero bytes.

Currently, the initial non-zero bytes will be lost, and this test will
fail.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
t/test-sparse-files.sh

index 97aef020b24c48ecc3f9962a4fc269b9e5c93f43..d57b5913d8cfc78c231306a2797619d604bc7cc2 100755 (executable)
@@ -69,6 +69,16 @@ restore_size=$(WVPASS du -k -s restore | WVPASS cut -f1) || exit $?
 WVPASS [ "$restore_size" -lt 100 ]
 WVPASS "$top/t/compare-trees" -c src/ restore/src/
 
+WVSTART "sparse file restore --sparse (bracketed zero run in buf)"
+WVPASS echo 'x' > src/foo
+WVPASS dd if=/dev/zero bs=1 count=512 >> src/foo
+WVPASS echo 'y' >> src/foo
+WVPASS bup index src
+WVPASS bup save -n src src
+WVPASS rm -r restore
+WVPASS bup restore --sparse -C restore "src/latest/$(pwd)/"
+WVPASS "$top/t/compare-trees" -c src/ restore/src/
+
 WVSTART "sparse file restore --sparse (sparse start)"
 WVPASS dd if=/dev/zero of=src/foo seek=$mb bs=1 count=1
 WVPASS echo "end" >> src/foo