]> arthur.barton.de Git - bup.git/blobdiff - t/test-sparse-files.sh
test-sparse-files: use bup-python in master
[bup.git] / t / test-sparse-files.sh
index 82275ff8bc045f82e1f85b46f0f5b624740b2f59..45563a68c93730f2144aa96d34e3648ac860b730 100755 (executable)
@@ -18,7 +18,7 @@ WVPASS cd "$tmpdir"
 
 # The 3MB guess is semi-arbitrary, but we've been informed that
 # Lustre, for example, uses 1MB, so guess higher than that, at least.
-block_size=$(python -c \
+block_size=$(bup-python -c \
   "import os; print getattr(os.stat('.'), 'st_blksize', 0) or $mb * 3") \
     || exit $?
 data_size=$((block_size * 10))
@@ -120,11 +120,41 @@ else
     random_size=1M
 fi
 WVSTART "sparse file restore --sparse (random $random_size)"
-WVPASS bup random 1M > src/foo
+WVPASS bup random --seed "$RANDOM" 1M > 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 (random sparse regions)"
+WVPASS rm -rf "$BUP_DIR" src
+WVPASS bup init
+WVPASS mkdir src
+for sparse_dataset in 0 1 2 3 4 5 6 7 8 9
+do
+    WVPASS "$top/t/sparse-test-data" "src/foo-$sparse_dataset"
+done
+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 (short zero runs around boundary)"
+WVPASS bup-python > src/foo <<EOF
+from sys import stdout
+stdout.write("x" * 65535 + "\0")
+stdout.write("\0" + "x" * 65535)
+stdout.write("\0" + "x" * 65534 + "\0")
+stdout.write("x" * 65536)
+stdout.write("\0")
+EOF
+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/
+
+
 WVPASS rm -rf "$tmpdir"