]> arthur.barton.de Git - bup.git/commitdiff
test-fuse: format save name with python, not bash
authorRob Browning <rlb@defaultvalue.org>
Sat, 13 Jun 2015 17:54:21 +0000 (12:54 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sat, 13 Jun 2015 17:55:51 +0000 (12:55 -0500)
Some versions of bash don't support the date expansion we used.

Thanks to pspdevel for reporting the issue.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Gabriel Filion <gabster@lelutin.ca>
Tested-by: Gabriel Filion <gabster@lelutin.ca>
[rlb@defaultvalue.org: add comment above savename()]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
t/test-fuse.sh

index c19918284cc30d2e401b81d2348b5b00a95c9c41..8246a46ebc7cec4ec1284dd4ba1562ebed289ae2 100755 (executable)
@@ -28,13 +28,21 @@ 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 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 $?
 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