tests: Unset SOURCE_DATE_EPOCH
authorSimon McVittie <smcv@collabora.com>
Mon, 26 Jul 2021 10:48:45 +0000 (11:48 +0100)
committerSimon McVittie <smcv@collabora.com>
Mon, 26 Jul 2021 10:48:45 +0000 (11:48 +0100)
Some distributions set this during build in order to have reproducible
builds from the same source code: for example, Debian uses the date
from debian/changelog.

However, some of our tests assume that `ostree commit` will result in
a commit with the current date/time, and SOURCE_DATE_EPOCH breaks that
assumption. Unset it for our build-time tests.

Resolves: https://github.com/ostreedev/ostree/issues/2405
Signed-off-by: Simon McVittie <smcv@collabora.com>
ci/gh-build.sh
tests/libtest.sh

index 11434327e5b8ce291fd16afe1dc6b3b31f52a19f..fdc795692986c8dd09b4182e10851660be1ba220 100755 (executable)
@@ -44,6 +44,11 @@ ${make}
 
 # Run the tests both using check and distcheck.
 ${make} check
+
+# Some tests historically failed when package builds set this.
+# By setting it for distcheck but not check, we exercise both ways.
+export SOURCE_DATE_EPOCH=$(date '+%s')
+
 ${make} distcheck DISTCHECK_CONFIGURE_FLAGS="$*"
 
 # Show the installed files
index 260b8d1d9d29abd36f461fce1008b1f6493bec96..f04ccaa08407beb4ce3ff9909250354427a0cf73 100755 (executable)
@@ -69,6 +69,10 @@ if ! test -f .testtmp; then
     touch .testtmp
 fi
 
+# Some distribution builds set this, but some of our build-time tests
+# assume this won't be used when committing
+unset SOURCE_DATE_EPOCH
+
 # Also, unbreak `tar` inside `make check`...Automake will inject
 # TAR_OPTIONS: --owner=0 --group=0 --numeric-owner presumably so that
 # tarballs are predictable, except we don't want this in our tests.