summaryrefslogtreecommitdiff
path: root/tests.as-root
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2012-11-07 17:09:12 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2012-11-12 16:48:18 +0000
commit116d30546a114364de54e3bd8522c22cd69412cf (patch)
treea92615d75a9aef21e4f1172dc87772607d8c43b1 /tests.as-root
parentcbaa45c1dccec5bc5e7fd1650a6a2f99638ee65e (diff)
downloadmorph-116d30546a114364de54e3bd8522c22cd69412cf.tar.gz
Add 'morph build' test with strata outside the root repo
Diffstat (limited to 'tests.as-root')
-rwxr-xr-xtests.as-root/build-with-external-strata.script62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests.as-root/build-with-external-strata.script b/tests.as-root/build-with-external-strata.script
new file mode 100755
index 00000000..affb28f5
--- /dev/null
+++ b/tests.as-root/build-with-external-strata.script
@@ -0,0 +1,62 @@
+#!/bin/bash
+# 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.
+
+# "morph build" with strata outside the branch root repository.
+
+set -eu
+
+# Disable test on versions of Python before 2.7.
+if ! python --version 2>&1 | grep '^Python 2\.[78]' > /dev/null
+then
+ cat "$SRCDIR/tests.as-root/build-with-external-strata.stdout"
+ exit 0
+fi
+
+. "$SRCDIR/scripts/setup-3rd-party-strata"
+
+cd "$DATADIR/workspace"
+"$SRCDIR/scripts/test-morph" branch test:morphs branch1
+
+# System will fail to build unless we add linux to it -- make the change but
+# don't commit it, in one of the external strata, as a challenge for
+# 'morph build'.
+cd "branch1"
+"$SRCDIR/scripts/test-morph" edit hello-system stratum2
+cd "test:external-strata"
+cat stratum2.morph | \
+ head -n $(expr $(wc -l < stratum2.morph) - 3) > stratum2.morph
+cat <<EOF >> stratum2.morph
+ },
+ {
+ "name": "linux",
+ "repo": "test:kernel-repo",
+ "ref": "master",
+ "build-depends": []
+ }
+ ]
+}
+EOF
+
+# Ignore Morph's output for now because it gives us:
+# 2012-11-07 16:26:12 Overlaps in system artifact hello-system-rootfs detected
+#
+# This is due to having a chunk named 'hello' in more than one stratum. It's
+# a bug that this generates overlaps (the chunk's .meta file needs to be called
+# $stratum.$chunk.meta rather than $chunk.meta to avoid the overlap) and the
+# redirection should be removed once this bug is fixed.
+"$SRCDIR/scripts/test-morph" build hello-system > /dev/null
+
+[ $("$SRCDIR/scripts/list-tree" "$DATADIR/cache/artifacts" | wc -l) -eq 23 ]