]> arthur.barton.de Git - bup.git/blobdiff - t/test-fuse.sh
vfs: limit root_items branches to refs/heads
[bup.git] / t / test-fuse.sh
index 8246a46ebc7cec4ec1284dd4ba1562ebed289ae2..5a7365ad547b63924114de340f2d4cf5527a89a4 100755 (executable)
@@ -1,10 +1,18 @@
 #!/usr/bin/env bash
 . ./wvtest-bup.sh || exit $?
+. t/lib.sh || exit $?
 
 set -o pipefail
 
 unset BLOCKSIZE BLOCK_SIZE DF_BLOCK_SIZE
 
+root_status="$(t/root-status)" || exit $?
+
+if ! bup-python -c 'import fuse' 2> /dev/null; then
+    WVSTART 'unable to import fuse; skipping test'
+    exit 0
+fi
+
 if test -n "$(type -p modprobe)" && ! modprobe fuse; then
     echo 'Unable to load fuse module; skipping dependent tests.' 1>&2
     exit 0
@@ -15,7 +23,7 @@ if ! fusermount -V; then
     exit 0
 fi
 
-if ! groups | grep -q fuse && test "$(t/root-status)" != root; then
+if ! groups | grep -q fuse && test "$root_status" != root; then
     echo 'skipping FUSE tests: you are not root and not in the fuse group'
     exit 0
 fi
@@ -32,15 +40,16 @@ bup() { "$top/bup" "$@"; }
 savename()
 {
     readonly secs="$1"
-    WVPASS python -c "from time import strftime, localtime; \
+    WVPASS bup-python -c "from time import strftime, localtime; \
        print strftime('%Y-%m-%d-%H%M%S', localtime($secs))"
 }
 
 WVPASS bup init
 WVPASS cd "$tmpdir"
 
-savestamp1=$(WVPASS python -c 'import time; print int(time.time())') || exit $?
+savestamp1=$(WVPASS bup-python -c 'import time; print int(time.time())') || exit $?
 savestamp2=$(($savestamp1 + 1))
+
 savename1="$(savename "$savestamp1")" || exit $?
 savename2="$(savename "$savestamp2")" || exit $?
 
@@ -71,11 +80,13 @@ result=$(WVPASS ls mnt/src/latest) || exit $?
 WVPASSEQ "$result" "foo
 pre-epoch"
 
-# Right now we don't detect new saves.
+result=$(WVPASS cat mnt/src/latest/foo) || exit $?
+WVPASSEQ "$result" "content"
+
 WVPASS bup save -n src -d "$savestamp2" --strip src
 result=$(WVPASS ls mnt/src) || exit $?
-savename="$(WVPASS printf '%(%Y-%m-%d-%H%M%S)T' "$savestamp1")" || exit $?
 WVPASSEQ "$result" "$savename1
+$savename2
 latest"
 
 WVPASS fusermount -uz mnt
@@ -85,7 +96,7 @@ WVPASS bup fuse --meta mnt
 result=$(TZ=UTC LC_ALL=C WVPASS ls -l mnt/src/latest/) || exit $?
 readonly user=$(WVPASS id -un) || $?
 readonly group=$(WVPASS id -gn) || $?
-WVPASSEQ "$result" "total 0
+WVPASSEQ "$result" "total 1
 -rw-r--r-- 1 $user $group 8 Nov 11  2011 foo
 -rw-r--r-- 1 $user $group 8 Jan  1  1970 pre-epoch"