From ef0b21be1845d69886bd84f402725e439fc928b4 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Tue, 11 Sep 2012 16:43:36 +0100 Subject: tests: Always use fixed git committer info Move this into a script which can be sourced by the 'setup' scripts and the actual tests (this is needed as the environment in 'setup' is not passed on to the tests). --- scripts/fix-committer-info | 25 ++++++++++++++++++++++ ...iple-times-doesnt-generate-new-artifacts.script | 3 +++ ...stem-branch-picks-up-uncommitted-changes.script | 2 ++ .../building-a-system-branch-works-anywhere.script | 2 ++ .../building-creates-correct-temporary-refs.script | 2 ++ tests.as-root/setup | 13 +---------- tests.branching/setup | 13 +---------- tests/show-dependencies.setup | 14 +----------- 8 files changed, 37 insertions(+), 37 deletions(-) create mode 100644 scripts/fix-committer-info diff --git a/scripts/fix-committer-info b/scripts/fix-committer-info new file mode 100644 index 00000000..1989a3e1 --- /dev/null +++ b/scripts/fix-committer-info @@ -0,0 +1,25 @@ +#!/bin/sh +# Copyright (C) 2012 Codethink Limited +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +# Fix git committer info. By hardcoding all of this info we make sure that +# all of the commits we make during testing have reproducible commit SHA1s. + +export GIT_AUTHOR_NAME=developer +export GIT_AUTHOR_EMAIL=developer@example.com +export GIT_AUTHOR_DATE="1343753514 +0000" +export GIT_COMMITTER_NAME=developer +export GIT_COMMITTER_EMAIL=developer@example.com +export GIT_COMMITTER_DATE="1343753514 +0000" diff --git a/tests.as-root/building-a-system-branch-multiple-times-doesnt-generate-new-artifacts.script b/tests.as-root/building-a-system-branch-multiple-times-doesnt-generate-new-artifacts.script index c00ef637..ecb3b0e0 100755 --- a/tests.as-root/building-a-system-branch-multiple-times-doesnt-generate-new-artifacts.script +++ b/tests.as-root/building-a-system-branch-multiple-times-doesnt-generate-new-artifacts.script @@ -19,6 +19,8 @@ set -eu +source "$SRCDIR/scripts/fix-committer-info" + # Initialise the workspace. cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init @@ -37,6 +39,7 @@ git config -f "$DATADIR/workspace/branch1/test:morphs-repo/.git/config" \ git config -f "$DATADIR/workspace/branch1/test:kernel-repo/.git/config" \ morph.uuid AABBCCDDE + # Build once. cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" build linux-system diff --git a/tests.as-root/building-a-system-branch-picks-up-uncommitted-changes.script b/tests.as-root/building-a-system-branch-picks-up-uncommitted-changes.script index 0942bc82..002f4abd 100755 --- a/tests.as-root/building-a-system-branch-picks-up-uncommitted-changes.script +++ b/tests.as-root/building-a-system-branch-picks-up-uncommitted-changes.script @@ -19,6 +19,8 @@ set -eu +source "$SRCDIR/scripts/fix-committer-info" + # Initialise the workspace. cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init diff --git a/tests.as-root/building-a-system-branch-works-anywhere.script b/tests.as-root/building-a-system-branch-works-anywhere.script index 3bb32f17..0d0b70b1 100755 --- a/tests.as-root/building-a-system-branch-works-anywhere.script +++ b/tests.as-root/building-a-system-branch-works-anywhere.script @@ -19,6 +19,8 @@ set -eu +source "$SRCDIR/scripts/fix-committer-info" + # Initialise the workspace. cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init diff --git a/tests.as-root/building-creates-correct-temporary-refs.script b/tests.as-root/building-creates-correct-temporary-refs.script index 87ba6db6..c3ee7019 100755 --- a/tests.as-root/building-creates-correct-temporary-refs.script +++ b/tests.as-root/building-creates-correct-temporary-refs.script @@ -19,6 +19,8 @@ set -eu +source "$SRCDIR/scripts/fix-committer-info" + # Initialise the workspace. cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init diff --git a/tests.as-root/setup b/tests.as-root/setup index f8077165..1392450e 100755 --- a/tests.as-root/setup +++ b/tests.as-root/setup @@ -28,18 +28,7 @@ set -eu -export GIT_AUTHOR_NAME -export GIT_AUTHOR_EMAIL -export GIT_AUTHOR_DATE -export GIT_COMMITTER_NAME -export GIT_COMMITTER_EMAIL -export GIT_COMMITTER_DATE -GIT_AUTHOR_NAME=developer -GIT_AUTHOR_EMAIL=developer@example.com -GIT_AUTHOR_DATE="1343753514 +0000" -GIT_COMMITTER_NAME=developer -GIT_COMMITTER_EMAIL=developer@example.com -GIT_COMMITTER_DATE="1343753514 +0000" +source "$SRCDIR/scripts/fix-committer-info" # The $DATADIR should be empty at the beginnig of each test. find "$DATADIR" -mindepth 1 -delete diff --git a/tests.branching/setup b/tests.branching/setup index 30bfbd24..cce3b672 100755 --- a/tests.branching/setup +++ b/tests.branching/setup @@ -24,18 +24,7 @@ set -eu -export GIT_AUTHOR_NAME -export GIT_AUTHOR_EMAIL -export GIT_AUTHOR_DATE -export GIT_COMMITTER_NAME -export GIT_COMMITTER_EMAIL -export GIT_COMMITTER_DATE -GIT_AUTHOR_NAME=developer -GIT_AUTHOR_EMAIL=developer@example.com -GIT_AUTHOR_DATE="1343753514 +0000" -GIT_COMMITTER_NAME=developer -GIT_COMMITTER_EMAIL=developer@example.com -GIT_COMMITTER_DATE="1343753514 +0000" +source "$SRCDIR/scripts/fix-committer-info" # Create a morph configuration file cat < "$DATADIR/morph.conf" diff --git a/tests/show-dependencies.setup b/tests/show-dependencies.setup index 76711987..e85c5ecf 100755 --- a/tests/show-dependencies.setup +++ b/tests/show-dependencies.setup @@ -17,19 +17,7 @@ set -e -# Setting all these means that we will always create a repository -# with identical commit sha1s - -GIT_AUTHOR_NAME="An Author" -GIT_AUTHOR_EMAIL="an.author@test.org" -GIT_AUTHOR_DATE="Thu, 07 Apr 2005 22:13:13 +0200" -GIT_COMMITTER_NAME="An Committer" -GIT_COMMITTER_EMAIL="a.committer@test.org" -GIT_COMMITTER_DATE="Thu, 07 Apr 2005 22:13:13 +0200" - -export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE -export GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE - +source "$SRCDIR/scripts/fix-committer-info" # Create a repository repo="$DATADIR/test-repo" -- cgit v1.2.1