From: Rob Browning Date: Sat, 13 Jun 2015 17:54:21 +0000 (-0500) Subject: test-fuse: format save name with python, not bash X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=8f4a02810eb48faecc66bf15fbc83b212b19bbbd;p=packages%2Fb%2Fbup.git test-fuse: format save name with python, not bash Some versions of bash don't support the date expansion we used. Thanks to pspdevel for reporting the issue. Signed-off-by: Rob Browning Tested-by: Rob Browning Reviewed-by: Gabriel Filion Tested-by: Gabriel Filion [rlb@defaultvalue.org: add comment above savename()] Signed-off-by: Rob Browning Tested-by: Rob Browning --- diff --git a/t/test-fuse.sh b/t/test-fuse.sh index c199182..8246a46 100755 --- a/t/test-fuse.sh +++ b/t/test-fuse.sh @@ -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