2 . ./wvtest-bup.sh || exit $?
7 unset BLOCKSIZE BLOCK_SIZE DF_BLOCK_SIZE
9 root_status="$(t/root-status)" || exit $?
11 if ! bup-python -c 'import fuse' 2> /dev/null; then
12 WVSTART 'unable to import fuse; skipping test'
16 if test -n "$(type -p modprobe)" && ! modprobe fuse; then
17 echo 'Unable to load fuse module; skipping dependent tests.' 1>&2
21 if ! fusermount -V; then
22 echo 'skipping FUSE tests: fusermount does not appear to work'
26 if ! groups | grep -q fuse && test "$root_status" != root; then
27 echo 'skipping FUSE tests: you are not root and not in the fuse group'
31 top="$(WVPASS pwd)" || exit $?
32 tmpdir="$(WVPASS wvmktempdir)" || exit $?
34 export BUP_DIR="$tmpdir/bup"
35 export GIT_DIR="$tmpdir/bup"
37 bup() { "$top/bup" "$@"; }
39 # Some versions of bash's printf don't support the relevant date expansion.
43 WVPASS bup-python -c "from time import strftime, localtime; \
44 print strftime('%Y-%m-%d-%H%M%S', localtime($secs))"
50 savestamp1=$(WVPASS bup-python -c 'import time; print int(time.time())') || exit $?
51 savestamp2=$(($savestamp1 + 1))
53 savename1="$(savename "$savestamp1")" || exit $?
54 savename2="$(savename "$savestamp2")" || exit $?
57 WVPASS echo content > src/foo
58 WVPASS chmod 644 src/foo
59 WVPASS touch -t 201111111111 src/foo
60 # FUSE, python-fuse, something, can't handle negative epoch times.
61 # Use pre-epoch to make sure bup properly "bottoms out" at 0 for now.
62 WVPASS echo content > src/pre-epoch
63 WVPASS chmod 644 src/pre-epoch
64 WVPASS touch -t 196907202018 src/pre-epoch
66 WVPASS bup save -n src -d "$savestamp1" --strip src
72 result=$(WVPASS ls mnt) || exit $?
73 WVPASSEQ src "$result"
75 result=$(WVPASS ls mnt/src) || exit $?
76 WVPASSEQ "$result" "$savename1
79 result=$(WVPASS ls mnt/src/latest) || exit $?
80 WVPASSEQ "$result" "foo
83 result=$(WVPASS cat mnt/src/latest/foo) || exit $?
84 WVPASSEQ "$result" "content"
86 # Right now we don't detect new saves.
87 WVPASS bup save -n src -d "$savestamp2" --strip src
88 result=$(WVPASS ls mnt/src) || exit $?
89 WVPASSEQ "$result" "$savename1
92 WVPASS fusermount -uz mnt
94 WVSTART "extended metadata"
95 WVPASS bup fuse --meta mnt
96 result=$(TZ=UTC LC_ALL=C WVPASS ls -l mnt/src/latest/) || exit $?
97 readonly user=$(WVPASS id -un) || $?
98 readonly group=$(WVPASS id -gn) || $?
99 WVPASSEQ "$result" "total 1
100 -rw-r--r-- 1 $user $group 8 Nov 11 2011 foo
101 -rw-r--r-- 1 $user $group 8 Jan 1 1970 pre-epoch"
103 WVPASS fusermount -uz mnt
104 WVPASS rm -rf "$tmpdir"