2 . ./wvtest-bup.sh || exit $?
3 . dev/lib.sh || exit $?
7 unset BLOCKSIZE BLOCK_SIZE DF_BLOCK_SIZE
9 root_status="$(dev/root-status)" || exit $?
11 if ! bup-python -c 'import fuse' 2> /dev/null; then
12 WVSKIP 'unable to import fuse; skipping test'
16 if test -n "$(type -p modprobe)" && ! modprobe fuse; then
17 WVSKIP 'Unable to load fuse module; skipping dependent tests.'
21 if ! fusermount -V; then
22 WVSKIP 'skipping FUSE tests: fusermount does not appear to work'
26 if ! groups | grep -q fuse && test "$root_status" != root; then
27 WVSKIP 'skipping FUSE tests: you are not root and not in the fuse group'
32 clean_up() { fusermount -uz mnt || true; }
36 top="$(WVPASS pwd)" || exit $?
37 tmpdir="$(WVPASS wvmktempdir)" || exit $?
39 export BUP_DIR="$tmpdir/bup"
40 export GIT_DIR="$tmpdir/bup"
42 bup() { "$top/bup" "$@"; }
44 # Some versions of bash's printf don't support the relevant date expansion.
48 WVPASS bup-cfg-py -c "from time import strftime, localtime; \
49 print(strftime('%Y-%m-%d-%H%M%S', localtime($secs)))"
57 savestamp1=$(WVPASS bup-cfg-py -c 'import time; print(int(time.time()))') || exit $?
58 savestamp2=$(($savestamp1 + 1))
60 savename1="$(savename "$savestamp1")" || exit $?
61 savename2="$(savename "$savestamp2")" || exit $?
64 WVPASS echo content > src/foo
65 WVPASS chmod 644 src/foo
66 WVPASS touch -t 201111111111 src/foo
67 # FUSE, python-fuse, something, can't handle negative epoch times.
68 # Use pre-epoch to make sure bup properly "bottoms out" at 0 for now.
69 WVPASS echo content > src/pre-epoch
70 WVPASS chmod 644 src/pre-epoch
71 WVPASS touch -t 196907202018 src/pre-epoch
73 WVPASS bup save -n src -d "$savestamp1" --strip src
80 while ! test -d mnt/src; do
84 result=$(WVPASS ls mnt) || exit $?
85 WVPASSEQ src "$result"
87 result=$(WVPASS ls mnt/src) || exit $?
88 WVPASSEQ "$result" "$savename1
91 result=$(WVPASS ls mnt/src/latest) || exit $?
92 WVPASSEQ "$result" "foo
95 result=$(WVPASS cat mnt/src/latest/foo) || exit $?
96 WVPASSEQ "$result" "content"
98 # Right now we don't detect new saves.
99 WVPASS bup save -n src -d "$savestamp2" --strip src
100 result=$(WVPASS ls mnt/src) || exit $?
101 WVPASSEQ "$result" "$savename1
104 WVPASS fusermount -uz mnt
105 WVPASS wait "$fuse_pid"
108 WVSTART "extended metadata"
110 bup fuse -f --meta mnt &
112 while ! test -d mnt/src; do
116 readonly user=$(WVPASS id -un) || $?
117 readonly group=$(WVPASS id -gn) || $?
118 result="$(stat --format='%A %U %G %x' mnt/src/latest/foo)"
119 WVPASSEQ "$result" "-rw-r--r-- $user $group 2011-11-11 11:11:00.000000000 +0000"
120 result="$(stat --format='%A %U %G %x' mnt/src/latest/pre-epoch)"
121 WVPASSEQ "$result" "-rw-r--r-- $user $group 1970-01-01 00:00:00.000000000 +0000"
123 WVPASS fusermount -uz mnt
124 WVPASS rm -rf "$tmpdir"