X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=t%2Ftest-fuse.sh;h=c61a1d25da4707d9acb249b3f5f4003860a94735;hb=6bfd8db535475a7e4a30b6c62161359fd0dc5e56;hp=3e2b3b288752e2f4e1c46ec05634ae2c63887d63;hpb=7cdde9af1222ddcf65b02a8ba3be184ca90d2dc8;p=bup.git diff --git a/t/test-fuse.sh b/t/test-fuse.sh index 3e2b3b2..c61a1d2 100755 --- a/t/test-fuse.sh +++ b/t/test-fuse.sh @@ -1,8 +1,11 @@ #!/usr/bin/env bash . ./wvtest-bup.sh || exit $? +. t/lib.sh || exit $? set -o pipefail +unset BLOCKSIZE BLOCK_SIZE DF_BLOCK_SIZE + if test -n "$(type -p modprobe)" && ! modprobe fuse; then echo 'Unable to load fuse module; skipping dependent tests.' 1>&2 exit 0 @@ -26,13 +29,22 @@ export GIT_DIR="$tmpdir/bup" bup() { "$top/bup" "$@"; } +# Some versions of bash's printf don't support the relevant date expansion. +savename() +{ + readonly secs="$1" + 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="$(printf '%(%Y-%m-%d-%H%M%S)T' "$savestamp1")" || exit $? -savename2="$(printf '%(%Y-%m-%d-%H%M%S)T' "$savestamp2")" || exit $? + +savename1="$(savename "$savestamp1")" || exit $? +savename2="$(savename "$savestamp2")" || exit $? WVPASS mkdir src WVPASS echo content > src/foo @@ -64,7 +76,6 @@ pre-epoch" # Right now we don't detect new saves. 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 latest"