2 . ./wvtest-bup.sh || exit $?
3 . dev/lib.sh || exit $?
7 unset BLOCKSIZE BLOCK_SIZE DF_BLOCK_SIZE
9 top="$(WVPASS pwd)" || exit $?
10 bup() { "$top/bup" "$@"; }
12 # Note: this relies on the import checks happening first
13 # before the command-line is evaluated, and us doing an
14 # exit with status 2 on failures
15 bup fuse -h 2>/dev/null
17 WSKIP 'unable to import fuse/check version; skipping test'
21 if test -n "$(type -p modprobe)" && ! modprobe fuse; then
22 WVSKIP 'Unable to load fuse module; skipping dependent tests.'
26 if ! fusermount -V; then
27 WVSKIP 'skipping FUSE tests: fusermount does not appear to work'
31 if ! test -w /dev/fuse; then
32 WVSKIP 'skipping FUSE tests; no access to /dev/fuse'
37 clean_up() { fusermount -uz mnt || true; }
41 top="$(WVPASS pwd)" || exit $?
42 tmpdir="$(WVPASS wvmktempdir)" || exit $?
44 export BUP_DIR="$tmpdir/bup"
45 export GIT_DIR="$tmpdir/bup"
47 # Some versions of bash's printf don't support the relevant date expansion.
51 WVPASS bup-cfg-py -c "from time import strftime, localtime; \
52 print(strftime('%Y-%m-%d-%H%M%S', localtime($secs)))"
60 savestamp1=$(WVPASS bup-cfg-py -c 'import time; print(int(time.time()))') || exit $?
61 savestamp2=$(($savestamp1 + 1))
63 savename1="$(savename "$savestamp1")" || exit $?
64 savename2="$(savename "$savestamp2")" || exit $?
67 WVPASS echo content > src/foo
68 WVPASS chmod 644 src/foo
69 WVPASS touch -t 201111111111 src/foo
70 # FUSE, python-fuse, something, can't handle negative epoch times.
71 # Use pre-epoch to make sure bup properly "bottoms out" at 0 for now.
72 WVPASS echo content > src/pre-epoch
73 WVPASS chmod 644 src/pre-epoch
74 WVPASS touch -t 196907202018 src/pre-epoch
76 WVPASS bup save -n src -d "$savestamp1" --strip src
83 while ! test -d mnt/src; do
87 result=$(WVPASS ls mnt) || exit $?
88 WVPASSEQ src "$result"
90 result=$(WVPASS ls mnt/src) || exit $?
91 WVPASSEQ "$result" "$savename1
94 result=$(WVPASS ls mnt/src/latest) || exit $?
95 WVPASSEQ "$result" "foo
98 result=$(WVPASS cat mnt/src/latest/foo) || exit $?
99 WVPASSEQ "$result" "content"
101 # Right now we don't detect new saves.
102 WVPASS bup save -n src -d "$savestamp2" --strip src
103 result=$(WVPASS ls mnt/src) || exit $?
104 WVPASSEQ "$result" "$savename1
107 WVPASS fusermount -uz mnt
108 WVPASS wait "$fuse_pid"
111 WVSTART "extended metadata"
113 bup fuse -f --meta mnt &
115 while ! test -d mnt/src; do
119 readonly user=$(WVPASS id -un) || $?
120 readonly group=$(WVPASS id -gn) || $?
121 result="$(stat --format='%A %U %G %x' mnt/src/latest/foo)"
122 WVPASSEQ "$result" "-rw-r--r-- $user $group 2011-11-11 11:11:00.000000000 +0000"
123 result="$(stat --format='%A %U %G %x' mnt/src/latest/pre-epoch)"
124 WVPASSEQ "$result" "-rw-r--r-- $user $group 1970-01-01 00:00:00.000000000 +0000"
126 WVPASS fusermount -uz mnt
127 WVPASS rm -rf "$tmpdir"