summaryrefslogtreecommitdiff
path: root/tests.branching
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2012-07-31 17:29:43 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2012-08-01 13:29:34 +0000
commitec3d3314f2a6484b3cca591920ed4e8034e546f5 (patch)
tree32faaca189190d0074be747866486c7635474ee6 /tests.branching
parentdabe86700200c529846927230e5e97249bf70792 (diff)
downloadmorph-ec3d3314f2a6484b3cca591920ed4e8034e546f5.tar.gz
Add test for petrifying strata
This test checks if the same morphology json is generated during petrification. Because commits include the author and date, the sha1 sum will differ if a different user commits at a different time. This can be overridden by the environment variables GIT_{AUTHOR,COMMITTER}_{NAME,EMAIL,DATE}. The date chosen was just something recent at the time the work was done, since a too-early timestamp is rejected by git as invalid.
Diffstat (limited to 'tests.branching')
-rwxr-xr-xtests.branching/petrify.script32
-rw-r--r--tests.branching/petrify.stdout12
-rwxr-xr-xtests.branching/setup12
3 files changed, 56 insertions, 0 deletions
diff --git a/tests.branching/petrify.script b/tests.branching/petrify.script
new file mode 100755
index 00000000..303d7f72
--- /dev/null
+++ b/tests.branching/petrify.script
@@ -0,0 +1,32 @@
+#!/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.
+
+
+# Verify that "morph petrify" works.
+
+
+set -eu
+
+
+cd "$DATADIR/mine"
+"$SRCDIR/scripts/test-morph" init
+"$SRCDIR/scripts/test-morph" update-gits baserock:morphs master \
+ hello-stratum.morph
+"$SRCDIR/scripts/test-morph" checkout master
+
+cd master/morphs
+"$SRCDIR/scripts/test-morph" petrify hello-stratum.morph
+cat hello-stratum.morph
diff --git a/tests.branching/petrify.stdout b/tests.branching/petrify.stdout
new file mode 100644
index 00000000..bf8eb1a1
--- /dev/null
+++ b/tests.branching/petrify.stdout
@@ -0,0 +1,12 @@
+{
+ "kind": "stratum",
+ "name": "hello-stratum",
+ "sources": [
+ {
+ "build-depends": [],
+ "name": "hello",
+ "ref": "f4d032b42c0134e67bdf19a43fa99072493667d7",
+ "repo": "baserock:hello"
+ }
+ ]
+} \ No newline at end of file
diff --git a/tests.branching/setup b/tests.branching/setup
index d659b1d0..84d1d545 100755
--- a/tests.branching/setup
+++ b/tests.branching/setup
@@ -24,6 +24,18 @@
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"
# Create a morph configuration file
cat <<EOF > "$DATADIR/morph.conf"