[Reproducible-builds] [misc] 07/07: test-reproducibility: fix time handling to something that actually works

Jérémy Bobbio lunar at moszumanska.debian.org
Sun Aug 31 19:09:57 UTC 2014


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch master
in repository misc.

commit 4b9706cb7a8db2798abcfb0fad68dc2b8f774089
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Sun Aug 31 19:09:38 2014 +0000

    test-reproducibility: fix time handling to something that actually works
---
 test-reproducibility/test-reproducibility | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/test-reproducibility/test-reproducibility b/test-reproducibility/test-reproducibility
index 4de4969..86d0829 100755
--- a/test-reproducibility/test-reproducibility
+++ b/test-reproducibility/test-reproducibility
@@ -20,7 +20,7 @@ if [ $# -eq 0 ]; then
 	exit 253
 fi
 
-NOW="$(date +%s)"
+NOW="$(date +'%Y-%m-%d %H:%M:%S')"
 
 TEST_REPRODUCIBILITY_TMPDIR="$(mktemp -d)"
 if ! [ -d "$TEST_REPRODUCIBILITY_TMPDIR" ]; then
@@ -28,7 +28,6 @@ if ! [ -d "$TEST_REPRODUCIBILITY_TMPDIR" ]; then
 	exit 254
 fi
 trap "rm -rf '$TEST_REPRODUCIBILITY_TMPDIR'" EXIT
-FAKETIME_RECORD_FILE="$TEST_REPRODUCIBILITY_TMPDIR/faketime-record"
 
 if [ "$1" = "-c" ]; then
 	shift
@@ -41,18 +40,18 @@ else
 fi
 
 run_baseline() {
-	FAKETIME_SAVE_FILE="$FAKETIME_RECORD_FILE" TEST_REPRODUCIBILITY_STAGE="baseline" faketime "@+$NOW" $COMMAND
+	TEST_REPRODUCIBILITY_STAGE="baseline" faketime -f "@$NOW i0,1" $COMMAND
 }
 
 run_different_time() {
-	TEST_REPRODUCIBILITY_STAGE="timestamps" faketime "tomorrow" $COMMAND
+	TEST_REPRODUCIBILITY_STAGE="timestamps" faketime -f "+1h i0,1" $COMMAND
 }
 
 run_different_path() {
 	local parent
 
 	parent="$(dirname "$PWD")"
-	faketime @+$NOW proot -b "$PWD:$parent/different" sh -c "cd $parent/different && TEST_REPRODUCIBILITY_STAGE="build-path" $COMMAND"
+	faketime -f "@$NOW i0,1" proot -b "$PWD:$parent/different" sh -c "cd $parent/different && TEST_REPRODUCIBILITY_STAGE="build-path" $COMMAND"
 }
 
 run_different_user() {
@@ -60,27 +59,24 @@ run_different_user() {
 
 	new_uid=$(($(id -u) + 1))
 	new_gid=$(($(id -g) + 1))
-	TEST_REPRODUCIBILITY_STAGE="usernames" faketime @+$NOW proot -i "$new_uid:$new_gid" $COMMAND
+	TEST_REPRODUCIBILITY_STAGE="usernames" faketime -f "@$NOW i0,1" proot -i "$new_uid:$new_gid" $COMMAND
 }
 
 run_different_hostname() {
 	local current_user
 
 	current_user="$(whoami)"
-	sudo unshare --uts -- sh -c "hostname different-hostname && su $current_user -c 'TEST_REPRODUCIBILITY_STAGE=hostname faketime @+$NOW $COMMAND'"
+	sudo unshare --uts -- sh -c "hostname different-hostname && su $current_user -c 'TEST_REPRODUCIBILITY_STAGE=hostname faketime -f \"@$NOW i0,1\" $COMMAND'"
 }
 
 run_different_kernel() {
 	local current_kernel
 
 	current_kernel="$(uname -r)"
-	TEST_REPRODUCIBILITY_STAGE="kernel-version" faketime @+$NOW proot -k "${current_kernel}+different" $COMMAND
+	TEST_REPRODUCIBILITY_STAGE="kernel-version" faketime -f "@$NOW i0,1" proot -k "${current_kernel}+different" $COMMAND
 }
 
 (run_baseline > "$TEST_REPRODUCIBILITY_TMPDIR/output-baseline")
-if [ -s "$FAKETIME_RECORD_FILE" ]; then
-	FAKETIME_LOAD_FILE="$FAKETIME_RECORD_FILE"
-fi
 (run_different_time > "$TEST_REPRODUCIBILITY_TMPDIR/output-different-time")
 (run_different_path > "$TEST_REPRODUCIBILITY_TMPDIR/output-different-path")
 (run_different_user > "$TEST_REPRODUCIBILITY_TMPDIR/output-different-user")

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/misc.git



More information about the Reproducible-builds mailing list