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