2 . ./wvtest-bup.sh || exit $?
7 unset BLOCKSIZE BLOCK_SIZE DF_BLOCK_SIZE
9 if ! bup-python -c 'import fuse' 2> /dev/null; then
10 WVSTART 'unable to import fuse; skipping test'
14 if test -n "$(type -p modprobe)" && ! modprobe fuse; then
15 echo 'Unable to load fuse module; skipping dependent tests.' 1>&2
19 if ! fusermount -V; then
20 echo 'skipping FUSE tests: fusermount does not appear to work'
24 if ! groups | grep -q fuse && test "$(t/root-status)" != root; then
25 echo 'skipping FUSE tests: you are not root and not in the fuse group'
29 top="$(WVPASS pwd)" || exit $?
30 tmpdir="$(WVPASS wvmktempdir)" || exit $?
32 export BUP_DIR="$tmpdir/bup"
33 export GIT_DIR="$tmpdir/bup"
35 bup() { "$top/bup" "$@"; }
37 # Some versions of bash's printf don't support the relevant date expansion.
41 WVPASS bup-python -c "from time import strftime, localtime; \
42 print strftime('%Y-%m-%d-%H%M%S', localtime($secs))"
48 savestamp1=$(WVPASS bup-python -c 'import time; print int(time.time())') || exit $?
49 savestamp2=$(($savestamp1 + 1))
51 savename1="$(savename "$savestamp1")" || exit $?
52 savename2="$(savename "$savestamp2")" || exit $?
55 WVPASS echo content > src/foo
56 WVPASS chmod 644 src/foo
57 WVPASS touch -t 201111111111 src/foo
58 # FUSE, python-fuse, something, can't handle negative epoch times.
59 # Use pre-epoch to make sure bup properly "bottoms out" at 0 for now.
60 WVPASS echo content > src/pre-epoch
61 WVPASS chmod 644 src/pre-epoch
62 WVPASS touch -t 196907202018 src/pre-epoch
64 WVPASS bup save -n src -d "$savestamp1" --strip src
70 result=$(WVPASS ls mnt) || exit $?
71 WVPASSEQ src "$result"
73 result=$(WVPASS ls mnt/src) || exit $?
74 WVPASSEQ "$result" "$savename1
77 result=$(WVPASS ls mnt/src/latest) || exit $?
78 WVPASSEQ "$result" "foo
81 result=$(WVPASS cat mnt/src/latest/foo) || exit $?
82 WVPASSEQ "$result" "content"
84 # Right now we don't detect new saves.
85 WVPASS bup save -n src -d "$savestamp2" --strip src
86 result=$(WVPASS ls mnt/src) || exit $?
87 WVPASSEQ "$result" "$savename1
90 WVPASS fusermount -uz mnt
92 WVSTART "extended metadata"
93 WVPASS bup fuse --meta mnt
94 result=$(TZ=UTC LC_ALL=C WVPASS ls -l mnt/src/latest/) || exit $?
95 readonly user=$(WVPASS id -un) || $?
96 readonly group=$(WVPASS id -gn) || $?
97 WVPASSEQ "$result" "total 1
98 -rw-r--r-- 1 $user $group 8 Nov 11 2011 foo
99 -rw-r--r-- 1 $user $group 8 Jan 1 1970 pre-epoch"
101 WVPASS fusermount -uz mnt
102 WVPASS rm -rf "$tmpdir"