]> arthur.barton.de Git - bup.git/blob - t/test-xdev.sh
Change incorrect unknown-owners references
[bup.git] / t / test-xdev.sh
1 #!/usr/bin/env bash
2 . ./wvtest-bup.sh
3
4 set -o pipefail
5
6 if [ $(t/root-status) != root ]; then
7     echo 'Not root: skipping xdev tests.'
8     exit 0 # FIXME: add WVSKIP.
9 fi
10
11 # These tests are only likely to work under Linux for now
12 # (patches welcome).
13 if ! [[ $(uname) =~ Linux ]]; then
14     echo 'Not Linux: skipping xdev tests.'
15     exit 0 # FIXME: add WVSKIP.
16 fi
17
18 top="$(WVPASS pwd)" || exit $?
19 tmpdir="$(WVPASS wvmktempdir)" || exit $?
20
21 export BUP_DIR="$tmpdir/bup"
22 export GIT_DIR="$tmpdir/bup"
23
24 bup() { "$top/bup" "$@"; }
25
26 WVPASS bup init
27 WVPASS pushd "$tmpdir"
28
29 WVSTART 'drecurse'
30
31 WVPASS dd if=/dev/zero of=testfs.img bs=1M count=32
32 WVPASS mkfs -F testfs.img # Don't care what type.
33 WVPASS mkdir -p src/mnt/{a,b,c}
34 WVPASS mount -o loop testfs.img src/mnt
35 WVPASS mkdir -p src/mnt/x
36 WVPASS touch src/1 src/mnt/2 src/mnt/x/3
37
38 WVPASSEQ "$(bup drecurse src | grep -vF lost+found)" "src/mnt/x/3
39 src/mnt/x/
40 src/mnt/2
41 src/mnt/
42 src/1
43 src/"
44
45 WVPASSEQ "$(bup drecurse -x src)" "src/mnt/
46 src/1
47 src/"
48
49 WVSTART 'index/save/restore'
50
51 WVPASS bup index src
52 WVPASS bup save -n src src
53 WVPASS mkdir src-restore
54 WVPASS bup restore -C src-restore "/src/latest$(pwd)/"
55 WVPASS test -d src-restore/src
56 WVPASS "$top/t/compare-trees" -c src/ src-restore/src/
57
58 WVPASS rm -r "$BUP_DIR" src-restore
59 WVPASS bup init
60 WVPASS bup index -x src
61 WVPASS bup save -n src src
62 WVPASS mkdir src-restore
63 WVPASS bup restore -C src-restore "/src/latest$(pwd)/"
64 WVPASS test -d src-restore/src
65 WVPASSEQ "$(cd src-restore/src && find . -not -name lost+found | sort)" ".
66 ./1
67 ./mnt"
68
69 WVPASS popd
70 WVPASS umount "$tmpdir/src/mnt"
71 WVPASS rm -r "$tmpdir"