]> arthur.barton.de Git - bup.git/blob - t/test-fuse.sh
Return integers, not strings from get_commit_dates()
[bup.git] / t / test-fuse.sh
1 #!/usr/bin/env bash
2 . ./wvtest-bup.sh
3
4 set -o pipefail
5
6 if ! fusermount -V; then
7     echo 'skipping FUSE tests: fusermount does not appear to work'
8     exit 0
9 fi
10
11 if ! groups | grep -q fuse && test "$(t/root-status)" != root; then
12     echo 'skipping FUSE tests: you are not root and not in the fuse group'
13     exit 0
14 fi
15
16 top="$(WVPASS pwd)" || exit $?
17 tmpdir="$(WVPASS wvmktempdir)" || exit $?
18
19 export BUP_DIR="$tmpdir/bup"
20 export GIT_DIR="$tmpdir/bup"
21
22 bup() { "$top/bup" "$@"; }
23
24 WVPASS bup init
25 WVPASS cd "$tmpdir"
26
27 savestamp1=$(WVPASS python -c 'import time; print int(time.time())') || exit $?
28 savestamp2=$(($savestamp1 + 1))
29 savename1="$(printf '%(%Y-%m-%d-%H%M%S)T' "$savestamp1")" || exit $?
30 savename2="$(printf '%(%Y-%m-%d-%H%M%S)T' "$savestamp2")" || exit $?
31
32 WVPASS mkdir src
33 WVPASS date > src/foo
34 WVPASS bup index src
35 WVPASS bup save -n src -d "$savestamp1" --strip src
36
37 WVSTART "basics"
38 WVPASS mkdir mnt
39 WVPASS bup fuse mnt
40
41 result=$(WVPASS ls mnt) || exit $?
42 WVPASSEQ src "$result"
43
44 result=$(WVPASS ls mnt/src) || exit $?
45 WVPASSEQ "$result" "$savename1
46 latest"
47
48 result=$(WVPASS ls mnt/src/latest) || exit $?
49 WVPASSEQ "$result" "foo"
50
51 # Right now we don't detect new saves.
52 WVPASS bup save -n src -d "$savestamp2" --strip src
53 result=$(WVPASS ls mnt/src) || exit $?
54 savename="$(WVPASS printf '%(%Y-%m-%d-%H%M%S)T' "$savestamp1")" || exit $?
55 WVPASSEQ "$result" "$savename1
56 latest"
57
58 WVPASS fusermount -uz mnt
59 WVPASS rm -rf "$tmpdir"