]> arthur.barton.de Git - bup.git/blob - t/test-save-smaller
save: add test for --smaller, fix DESIGN document
[bup.git] / t / test-save-smaller
1 #!/usr/bin/env bash
2 . wvtest.sh
3 . wvtest-bup.sh
4 . t/lib.sh
5
6 set -o pipefail
7
8 top="$(WVPASS pwd)" || exit $?
9 tmpdir="$(WVPASS wvmktempdir)" || exit $?
10 export BUP_DIR="$tmpdir/bup"
11
12 bup() { "$top/bup" "$@"; }
13
14 WVPASS cd "$tmpdir"
15
16 WVSTART "init"
17 WVPASS bup init
18
19 WVPASS mkdir "$tmpdir/save"
20 WVPASS echo small0 > "$tmpdir/save/small"
21 WVPASS echo bigbigbigbigbig01 > "$tmpdir/save/big1"
22 big1sha="$(sha1sum < "$tmpdir/save/big1")"
23 WVPASS bup index "$tmpdir/save"
24 WVPASS bup save -vv -n test "$tmpdir/save"
25 WVPASS mkdir "$tmpdir/restore1"
26 WVPASS bup restore -v --outdir="$tmpdir/restore1/" "/test/latest$tmpdir/save/"
27 WVPASS cmp "$tmpdir/restore1/small" "$tmpdir/save/small"
28 WVPASS cmp "$tmpdir/restore1/big1" "$tmpdir/save/big1"
29
30 WVSTART "save --smaller"
31 WVPASS echo bigbigbigbigbig02 > "$tmpdir/save/big1"
32 WVPASS echo bigbigbigbigbig03 > "$tmpdir/save/big2"
33 WVPASS bup index "$tmpdir/save"
34 WVPASS bup save -vv -n test --smaller=10 "$tmpdir/save"
35 WVPASS mkdir "$tmpdir/restore2"
36 WVPASS bup restore -v --outdir="$tmpdir/restore2/" "/test/latest$tmpdir/save/"
37 WVPASS cmp "$tmpdir/restore2/small" "$tmpdir/save/small"
38 # (per the original DESIGN document, we should've had the old version
39 # of the modified large file, but really that isn't implemented)
40 # must _not_ have this file at all
41 WVFAIL test -f "$tmpdir/restore2/big1"
42 # and not the new one either
43 WVFAIL test -f "$tmpdir/restore2/big2"
44
45 WVPASS rm -rf "$tmpdir"