2 . ./wvtest-bup.sh || exit $?
6 if [ $(t/root-status) != root ]; then
7 WVSTART 'not root: skipping tests'
8 exit 0 # FIXME: add WVSKIP.
11 if ! modprobe loop; then
12 WVSTART 'unable to load loopback module; skipping tests' 1>&2
16 # These tests are only likely to work under Linux for now
18 if ! [[ $(uname) =~ Linux ]]; then
19 WVSTART 'not Linux: skipping tests'
20 exit 0 # FIXME: add WVSKIP.
23 top="$(WVPASS pwd)" || exit $?
24 tmpdir="$(WVPASS wvmktempdir)" || exit $?
26 export BUP_DIR="$tmpdir/bup"
27 export GIT_DIR="$tmpdir/bup"
29 bup() { "$top/bup" "$@"; }
32 WVPASS pushd "$tmpdir"
36 WVPASS dd if=/dev/zero of=testfs.img bs=1M count=32
37 WVPASS mkfs -F testfs.img # Don't care what type.
38 WVPASS mkdir -p src/mnt/{a,b,c}
39 WVPASS mount -o loop testfs.img src/mnt
40 WVPASS mkdir -p src/mnt/x
41 WVPASS touch src/1 src/mnt/2 src/mnt/x/3
43 WVPASSEQ "$(bup drecurse src | grep -vF lost+found)" "src/mnt/x/3
50 WVPASSEQ "$(bup drecurse -x src)" "src/mnt/
54 WVSTART 'index/save/restore'
57 WVPASS bup save -n src src
58 WVPASS mkdir src-restore
59 WVPASS bup restore -C src-restore "/src/latest$(pwd)/"
60 WVPASS test -d src-restore/src
61 WVPASS "$top/t/compare-trees" -c src/ src-restore/src/
63 WVPASS rm -r "$BUP_DIR" src-restore
65 WVPASS bup index -x src
66 WVPASS bup save -n src src
67 WVPASS mkdir src-restore
68 WVPASS bup restore -C src-restore "/src/latest$(pwd)/"
69 WVPASS test -d src-restore/src
70 WVPASSEQ "$(cd src-restore/src && find . -not -name lost+found | LC_ALL=C sort)" \
76 WVPASS umount "$tmpdir/src/mnt"
77 WVPASS rm -r "$tmpdir"