]> arthur.barton.de Git - bup.git/blobdiff - t/test-fuse.sh
Change remaining uses of python to bup-python
[bup.git] / t / test-fuse.sh
index c19918284cc30d2e401b81d2348b5b00a95c9c41..c61a1d25da4707d9acb249b3f5f4003860a94735 100755 (executable)
@@ -1,5 +1,6 @@
 #!/usr/bin/env bash
 . ./wvtest-bup.sh || exit $?
+. t/lib.sh || exit $?
 
 set -o pipefail
 
@@ -28,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
@@ -66,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"