]> arthur.barton.de Git - bup.git/commitdiff
test-tz.sh: test save in a fractional time zone
authorDavid Kettler <kettler@internode.on.net>
Mon, 30 Nov 2015 13:28:28 +0000 (23:58 +1030)
committerRob Browning <rlb@defaultvalue.org>
Sat, 12 Dec 2015 17:18:21 +0000 (11:18 -0600)
Prior to this change[1], the commit time zone offset was generated
incorrectly for non-integer hour offsets from UTC; seconds, rather
than minutes, were output.  Such values in a bup commit cause
subsequent attempts to access the repository to fail with "Exception:
cannot parse commit".

When run with TZ=Australia/Adelaide the test suite failed in several
places.  Add a test which sets the time zone explicitly and tests a
save for consistency.

[1] Fix utc_offset_str for fractional TZs
    f25ef2e868f85ca19bfce314081c956ade9c10ef

Signed-off-by: David Kettler <kettler@internode.on.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: remove proposed utc_offset_str fix; adjust
 commit message]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
Makefile
t/test-tz.sh [new file with mode: 0755]

index 988a9cc91ab8856755476f56278edf0d4f010dd8..daefc0808edb109bd585e62d9880d7ffcce1c602 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -108,6 +108,7 @@ cmdline_tests := \
   t/test-index-clear.sh \
   t/test-index-check-device.sh \
   t/test-ls.sh \
+  t/test-tz.sh \
   t/test-meta.sh \
   t/test-on.sh \
   t/test-restore-map-owner.sh \
diff --git a/t/test-tz.sh b/t/test-tz.sh
new file mode 100755 (executable)
index 0000000..4b566b1
--- /dev/null
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+. ./wvtest-bup.sh || exit $?
+
+set -o pipefail
+
+top="$(WVPASS pwd)" || exit $?
+tmpdir="$(WVPASS wvmktempdir)" || exit $?
+
+export BUP_DIR="$tmpdir/bup"
+export GIT_DIR="$tmpdir/bup"
+
+bup() { "$top/bup" "$@"; }
+
+WVSTART "half hour TZ"
+
+export TZ=ACDT-10:30
+
+WVPASS bup init
+WVPASS cd "$tmpdir"
+
+WVPASS mkdir src
+WVPASS bup index src
+WVPASS bup save -n src -d 1420164180 src
+
+WVPASSEQ "$(WVPASS git cat-file commit src | sed -ne 's/^author .*> //p')" \
+"1420164180 +1030"
+
+WVPASSEQ "$(WVPASS bup ls /src)" \
+"2015-01-02-123300
+latest"
+
+WVPASS rm -rf "$tmpdir"