chiark / gitweb /
Set GIT_COMMITTER_DATE and GIT_AUTHOR_DATE
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 1 Jul 2016 22:37:55 +0000 (23:37 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 1 Jul 2016 22:53:10 +0000 (23:53 +0100)
This avoids most date dependencies: unless other measures are taken,
the commits and tags are identical iff they are constructed
identically.  This makes the test suite more deterministic.

In drs-push-rejects test, increment them explicitly, so as to make all
of mktag's tags distinct objects.

Otherwise it can generate identical tags (now, always; previously,
only sometimes on fast computers), causing spurious variations in
behaviour (eg, things not being rejected because they do not represent
any change).

debian/changelog
tests/lib
tests/tests/drs-push-rejects

index f267d1dbd01252389ab83c62700e1fa631de6ca3..697fae88e1141c3441f9a11466de0c302cc27809 100644 (file)
@@ -24,6 +24,9 @@ dgit (1.5~~) unstable; urgency=medium
     file.  Instead, simply tolerate the absence of the log file.
   * Put --no-arch-all in build-modes-sbuild act, not only its real_act.
     Cosmetic change only.
+  * Set GIT_COMMITTER_DATE and GIT_AUTHOR_DATE and increment them
+    explicitly in drs-push-rejects test.  This avoids date dependencies
+    which can cause that test to fail on fast computers.
 
  --
 
index 9308b169e9636d8440956c965b1f819203ce6279..7f459aa2cf2f258fc124de9fce0ceeb342ea1ddc 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -12,6 +12,9 @@ t-set-intree
 : ${DGIT_TEST_DEBUG=-D}
 export DGIT_TEST_DEBUG
 
+export GIT_COMMITTER_DATE='1440253867 +0100'
+export GIT_AUTHOR_DATE='1440253867 +0100'
+
 root=`pwd`
 troot=$root/tests
 testname="${DGIT_TEST_TESTNAME-${0##*/}}"
@@ -45,6 +48,11 @@ incoming             = $tmp/incoming
 run_dinstall           = 0
 END
 
+t-git-next-date () {
+       GIT_COMMITTER_DATE="$(( ${GIT_COMMITTER_DATE%% *} + 1 )) ${GIT_COMMITTER_DATE#* }"
+       GIT_AUTHOR_DATE="$GIT_COMMITTER_DATE"
+}
+
 t-expect-fail () {
        local mpat="$1"; shift
 
index 37828908a45e3997b3a5a3b6c8e5a101399384ae..1a573748f0ccccf1d71649e65e7f128cbfe7f937 100755 (executable)
@@ -37,6 +37,7 @@ prep () {
        push_spec="$push_spec1 $push_spec2"
 }
 mktag () {
+       t-git-next-date
        git tag -f $tag_signer -m "$tag_message" $tag_name "$@"
 }