summaryrefslogtreecommitdiff
path: root/tests.build
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-07-28 15:23:09 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2015-10-14 14:34:29 +0000
commitb8b8de2b123ff96e6469196934359485bcd06b04 (patch)
tree2bb774dcaf3db88d6dafb8ab34322b5df4550ce0 /tests.build
parent3c59628c80ffe47992bf7347268ca587fc6d368d (diff)
downloadmorph-b8b8de2b123ff96e6469196934359485bcd06b04.tar.gz
Add support for Baserock definitions version 7
This adds a new 'Defaults' class to represent definitions defaults The Python 'jsonschema' module is used to validate the contents of the Defaults file. This module is already included in Baserock 'build' and 'devel' reference systems by way of the 'openstack-common' stratum. This commit embeds a copy of the JSON-Schema schema for the DEFAULTS file. I think the canonical location of this schema should be in the reference definitions.git, for now. In future, the schemas should maybe have their own repos. Either way, Morph should embed a copy for the time being so that we are sure the schema matches how Morph expects to parse the file. Morph's automated tests are all updated to use definitions version 7. I removed most of the tests for built-in build systems, because the built-ins themselves are no longer part of Morph. Only the mechanism for defining them needs to be tested now. Change-Id: I65f8f1c967683ef605852bfae5c68518e53f9981
Diffstat (limited to 'tests.build')
-rwxr-xr-xtests.build/ambiguous-refs.script3
-rwxr-xr-xtests.build/build-stratum-with-submodules.script2
-rwxr-xr-xtests.build/prefix.script6
-rwxr-xr-xtests.build/rebuild-cached-stratum.script4
-rw-r--r--tests.build/rebuild-cached-stratum.stdout26
-rwxr-xr-xtests.build/setup25
-rwxr-xr-xtests.build/setup-build-essential12
7 files changed, 47 insertions, 31 deletions
diff --git a/tests.build/ambiguous-refs.script b/tests.build/ambiguous-refs.script
index 181af3cc..84fca86e 100755
--- a/tests.build/ambiguous-refs.script
+++ b/tests.build/ambiguous-refs.script
@@ -19,6 +19,9 @@
## instead of 'git rev-parse --verify': show-ref returns a list of partial
## matches sorted alphabetically, so any code using it may resolve refs
+## The 'autotools' build system is defined in the DEFAULTS file created
+## by the 'setup' script.
+
set -eu
# Create a ref that will show up in 'git show-ref' before the real master ref
diff --git a/tests.build/build-stratum-with-submodules.script b/tests.build/build-stratum-with-submodules.script
index 2dd2b924..b3073af1 100755
--- a/tests.build/build-stratum-with-submodules.script
+++ b/tests.build/build-stratum-with-submodules.script
@@ -24,6 +24,7 @@ set -eu
parent="$DATADIR/parent-repo"
mkdir "$parent"
+
echo "No real content here" > "$parent/dummy"
"$SRCDIR/scripts/run-git-in" "$parent" init --quiet
@@ -49,6 +50,7 @@ name: hello-stratum
kind: stratum
chunks:
- name: parent
+ morph: parent.morph
repo: test:parent-repo
ref: master
morph: parent.morph
diff --git a/tests.build/prefix.script b/tests.build/prefix.script
index 291b25cf..0ff077b8 100755
--- a/tests.build/prefix.script
+++ b/tests.build/prefix.script
@@ -49,6 +49,7 @@ name: hello-stratum
kind: stratum
chunks:
- name: xyzzy
+ morph: xyzzy.morph
repo: test:chunk-repo
ref: master
morph: xyzzy.morph
@@ -56,6 +57,7 @@ chunks:
build-mode: test
prefix: /plover
- name: plugh
+ morph: plugh.morph
repo: test:chunk-repo
ref: master
morph: plugh.morph
@@ -70,6 +72,6 @@ git commit -q -m "Update build definitions"
test:morphs-repo master hello-system
cd "$DATADIR/cache/artifacts"
-first_chunk=$(ls -1 *.chunk.xyzzy-* | head -n1 | cut -c -64)
-second_chunk=$(ls -1 *.chunk.plugh-* | head -n1 | cut -c -64)
+first_chunk=$(ls -1 *.chunk.xyzzy* | head -n1 | cut -c -64)
+second_chunk=$(ls -1 *.chunk.plugh* | head -n1 | cut -c -64)
cat $first_chunk.build-log $second_chunk.build-log
diff --git a/tests.build/rebuild-cached-stratum.script b/tests.build/rebuild-cached-stratum.script
index e2e0face..bc1b83fd 100755
--- a/tests.build/rebuild-cached-stratum.script
+++ b/tests.build/rebuild-cached-stratum.script
@@ -41,7 +41,7 @@ cache="$DATADIR/cache/artifacts"
"$SRCDIR/scripts/test-morph" build-morphology \
test:morphs-repo rebuild-cached-stratum hello-system
echo "first build:"
-(cd "$cache" && ls *.chunk.* *hello-stratum-* | sed 's/^[^.]*\./ /' |
+(cd "$cache" && ls *.chunk.* *hello-stratum* | sed 's/^[^.]*\./ /' |
LC_ALL=C sort -u)
# Change the chunk.
@@ -53,6 +53,6 @@ echo "first build:"
"$SRCDIR/scripts/test-morph" build-morphology \
test:morphs-repo rebuild-cached-stratum hello-system
echo "second build:"
-(cd "$cache" && ls *.chunk.* *hello-stratum-* | sed 's/^[^.]*\./ /' |
+(cd "$cache" && ls *.chunk.* *hello-stratum* | sed 's/^[^.]*\./ /' |
LC_ALL=C sort -u)
diff --git a/tests.build/rebuild-cached-stratum.stdout b/tests.build/rebuild-cached-stratum.stdout
index 9c53ee60..4672e7f2 100644
--- a/tests.build/rebuild-cached-stratum.stdout
+++ b/tests.build/rebuild-cached-stratum.stdout
@@ -1,22 +1,8 @@
first build:
- chunk.hello-bins
- chunk.hello-devel
- chunk.hello-doc
- chunk.hello-libs
- chunk.hello-locale
- chunk.hello-misc
- stratum.hello-stratum-devel
- stratum.hello-stratum-devel.meta
- stratum.hello-stratum-runtime
- stratum.hello-stratum-runtime.meta
+ chunk.hello-chunk
+ stratum.hello-stratum
+ stratum.hello-stratum.meta
second build:
- chunk.hello-bins
- chunk.hello-devel
- chunk.hello-doc
- chunk.hello-libs
- chunk.hello-locale
- chunk.hello-misc
- stratum.hello-stratum-devel
- stratum.hello-stratum-devel.meta
- stratum.hello-stratum-runtime
- stratum.hello-stratum-runtime.meta
+ chunk.hello-chunk
+ stratum.hello-stratum
+ stratum.hello-stratum.meta
diff --git a/tests.build/setup b/tests.build/setup
index 7936584b..ca60d426 100755
--- a/tests.build/setup
+++ b/tests.build/setup
@@ -55,8 +55,7 @@ int main(void)
EOF
git add hello.c
-git commit --quiet -m "add a hello world program and morph"
-
+git commit --quiet -m "add a hello world program"
git checkout --quiet master
@@ -68,11 +67,28 @@ mkdir "$morphsrepo"
cd "$morphsrepo"
git init --quiet
-echo 'version: 6' > VERSION
+echo 'version: 7' > VERSION
git add VERSION
+cat <<'EOF' > DEFAULTS
+# This is a deliberately minimal DEFAULTS file.
+
+# There are no splitting rules defined, because it's important that Morph
+# still works correctly when the user didn't define any.
+
+build-systems:
+ autotools:
+ configure-commands:
+ - ./configure
+ build-commands:
+ - make
+ install-commands:
+ - make DESTDIR="$DESTDIR" install
+EOF
+git add DEFAULTS
+
cat <<EOF > hello.morph
-name: hello
+name: hello-chunk
kind: chunk
build-commands:
- gcc -o hello hello.c
@@ -88,6 +104,7 @@ name: hello-stratum
kind: stratum
chunks:
- name: hello
+ morph: hello.morph
repo: test:chunk-repo
ref: farrokh
morph: hello.morph
diff --git a/tests.build/setup-build-essential b/tests.build/setup-build-essential
index 8868db68..28847d76 100755
--- a/tests.build/setup-build-essential
+++ b/tests.build/setup-build-essential
@@ -17,6 +17,7 @@
# Set up a stratum which resembles Baserock's 'build-essential' slightly. Used
# for testing 'morph cross-bootstrap' and the 'bootstrap' build mode.
+# Add a mock compiler chunk.
mkdir -p "$DATADIR/cc-repo"
cd "$DATADIR/cc-repo"
@@ -32,9 +33,6 @@ git commit -q -m "Create compiler chunk"
cd "$DATADIR/morphs-repo"
-# Require 'cc' in hello-chunk. We should have the second version available
-# but *not* the first one.
-
cat <<EOF > "stage1-cc.morph"
name: stage1-cc
kind: chunk
@@ -53,6 +51,11 @@ install-commands:
- install -m 755 morph-test-cc "\$DESTDIR\$PREFIX/bin/morph-test-cc"
EOF
+git add cc.morph stage1-cc.morph
+git commit -q -m "Add build instructions for mock compiler."
+
+# Require 'cc' in hello-chunk. We should have the second version available
+# but *not* the first one.
cat <<EOF > "hello.morph"
name: hello
kind: chunk
@@ -76,6 +79,7 @@ name: build-essential
kind: stratum
chunks:
- name: stage1-cc
+ morph: stage1-cc.morph
repo: test:cc-repo
ref: master
morph: stage1-cc.morph
@@ -83,6 +87,7 @@ chunks:
build-mode: bootstrap
prefix: /tools
- name: cc
+ morph: cc.morph
repo: test:cc-repo
ref: master
morph: cc.morph
@@ -98,6 +103,7 @@ build-depends:
- morph: build-essential
chunks:
- name: hello
+ morph: hello.morph
repo: test:chunk-repo
ref: farrokh
morph: hello.morph