]> arthur.barton.de Git - bup.git/blob - t/test-fsck.sh
cleanup-mounts-under: Don't fail when /proc/mounts isn't readable
[bup.git] / t / test-fsck.sh
1 #!/usr/bin/env bash
2 . ./wvtest-bup.sh || exit $?
3
4 set -o pipefail
5
6 top="$(WVPASS pwd)" || exit $?
7 tmpdir="$(WVPASS wvmktempdir)" || exit $?
8
9 export BUP_DIR="$tmpdir/bup"
10 export GIT_DIR="$tmpdir/bup"
11
12 bup() { "$top/bup" "$@"; }
13
14 WVPASS bup init
15 WVPASS cd "$tmpdir"
16
17 WVSTART "fsck"
18
19 WVPASS bup index "$top"
20 WVPASS bup save -n fsck-test "$top/lib"
21 WVPASS bup save -n fsck-test "$top/Documentation"
22 WVPASS bup save -n fsck-test "$top/cmd"
23 WVPASS bup fsck
24 WVPASS bup fsck --quick
25 if bup fsck --par2-ok; then
26     WVSTART "fsck (par2)"
27 else
28     WVSTART "fsck (PAR2 IS MISSING)"
29 fi
30 WVPASS bup fsck -g
31 WVPASS bup fsck -r
32 WVPASS bup damage "$BUP_DIR"/objects/pack/*.pack -n10 -s1 -S0
33 WVFAIL bup fsck --quick
34 WVFAIL bup fsck --quick --disable-par2
35 WVPASS chmod u+w "$BUP_DIR"/objects/pack/*.idx
36 WVPASS bup damage "$BUP_DIR"/objects/pack/*.idx -n10 -s1 -S0
37 WVFAIL bup fsck --quick -j4
38 WVPASS bup damage "$BUP_DIR"/objects/pack/*.pack -n10 -s1024 --percent 0.4 -S0
39 WVFAIL bup fsck --quick
40 WVFAIL bup fsck --quick -rvv -j99   # fails because repairs were needed
41 if bup fsck --par2-ok; then
42     WVPASS bup fsck -r # ok because of repairs from last time
43     WVPASS bup damage "$BUP_DIR"/objects/pack/*.pack -n202 -s1 --equal -S0
44     WVFAIL bup fsck
45     WVFAIL bup fsck -rvv   # too many errors to be repairable
46     WVFAIL bup fsck -r   # too many errors to be repairable
47 else
48     WVFAIL bup fsck --quick -r # still fails because par2 was missing
49 fi
50
51
52 WVPASS rm -rf "$tmpdir"