summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2013-02-21 12:09:23 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2013-02-21 12:17:06 +0000
commitb1dc3a2e5a161ab92b481d69e6e5cbb34e5c9395 (patch)
treec8674053d8fc44e929e94b81cab6363086338dfc
parenta36d1414c114ac9c56ec2852ecc50a14f8add12c (diff)
parent765331d76fc252d06b70532f869c82f8611e2b48 (diff)
downloadmorph-b1dc3a2e5a161ab92b481d69e6e5cbb34e5c9395.tar.gz
Merge branch 'samthursfield/only-build-systems' of git://git.baserock.org/baserock/baserock/morph
This includes a merge fixup in ./check, so that it does not complain about build-system-autotools' test's tabs.
-rwxr-xr-xcheck3
-rw-r--r--morphlib/buildcommand.py7
-rwxr-xr-xtests.build/ambiguous-refs.script (renamed from tests/ambiguous-refs.script)6
-rw-r--r--tests.build/build-chunk-failures-dump-log.exit (renamed from tests/build-chunk-failures-dump-log.exit)0
-rwxr-xr-xtests.build/build-chunk-failures-dump-log.script (renamed from tests/build-chunk-failures-dump-log.script)16
-rw-r--r--tests.build/build-chunk-failures-dump-log.stdout (renamed from tests/build-chunk-failures-dump-log.stdout)0
-rwxr-xr-xtests.build/build-chunk-writes-log.script (renamed from tests/build-chunk-writes-log.script)7
-rwxr-xr-xtests.build/build-stratum-with-submodules.script (renamed from tests/build-stratum-with-submodules.script)19
-rw-r--r--tests.build/build-stratum-with-submodules.stdout8
-rw-r--r--tests.build/build-system-autotools-fails-if-autogen-fails.exit (renamed from tests/build-system-autotools-fails-if-autogen-fails.exit)0
-rwxr-xr-xtests.build/build-system-autotools-fails-if-autogen-fails.script (renamed from tests/build-system-autotools-fails-if-autogen-fails.script)20
-rwxr-xr-xtests.build/build-system-autotools.script (renamed from tests/build-system-autotools.script)5
-rw-r--r--tests.build/build-system-autotools.stdout (renamed from tests/build-system-autotools.stdout)0
-rwxr-xr-xtests.build/build-system-cpan.script (renamed from tests/build-system-cpan.script)4
-rw-r--r--tests.build/build-system-cpan.stdout (renamed from tests/build-system-cpan.stdout)0
-rwxr-xr-xtests.build/build-system-python-distutils.script (renamed from tests/build-system-python-distutils.script)4
-rw-r--r--tests.build/build-system-python-distutils.stdout (renamed from tests/build-system-python-distutils.stdout)0
-rwxr-xr-xtests.build/build-system.script (renamed from tests/build-chunk.script)15
-rw-r--r--tests.build/build-system.stdout (renamed from tests/build-stratum.stdout)3
-rw-r--r--tests.build/missing-ref.exit (renamed from tests/missing-ref.exit)0
-rwxr-xr-xtests.build/missing-ref.script (renamed from tests/missing-ref.script)4
-rw-r--r--tests.build/missing-ref.stderr (renamed from tests/missing-ref.stderr)2
-rwxr-xr-xtests.build/morphless-chunks.script (renamed from tests/morphless-chunks.script)39
-rw-r--r--tests.build/morphless-chunks.stdout (renamed from tests/build-chunk.stdout)3
-rwxr-xr-xtests.build/only-build-systems.script (renamed from tests/build-stratum.script)14
-rw-r--r--tests.build/only-build-systems.stderr2
-rwxr-xr-xtests.build/rebuild-cached-stratum.script (renamed from tests/rebuild-cached-stratum.script)7
-rw-r--r--tests.build/rebuild-cached-stratum.stdout (renamed from tests/rebuild-cached-stratum.stdout)0
-rwxr-xr-xtests.build/setup135
-rwxr-xr-xtests.build/stratum-overlap-warns.script (renamed from tests/stratum-overlap-warns.script)8
-rwxr-xr-xtests.build/stratum-overlap-warns.setup (renamed from tests/stratum-overlap-warns.setup)11
-rwxr-xr-xtests.build/stratum-overlap-writes-overlap.script (renamed from tests/stratum-overlap-writes-overlap.script)8
l---------tests.build/stratum-overlap-writes-overlap.setup (renamed from tests/stratum-overlap-writes-overlap.setup)0
-rw-r--r--tests.build/stratum-overlap-writes-overlap.stdout (renamed from tests/stratum-overlap-writes-overlap.stdout)0
-rwxr-xr-xtests.build/uses-tempdir.script (renamed from tests/uses-tempdir.script)4
-rw-r--r--tests/build-stratum-with-submodules.stdout4
-rw-r--r--tests/morphless-chunks.stdout5
-rwxr-xr-xtests/show-dependencies.script4
-rwxr-xr-xtests/show-dependencies.setup20
-rw-r--r--tests/show-dependencies.stdout4
40 files changed, 267 insertions, 124 deletions
diff --git a/check b/check
index baced129..76b50208 100755
--- a/check
+++ b/check
@@ -37,6 +37,7 @@ if not morphlib.got_yaml:
sys.exit(1)
" > /dev/null 2>&1
then
+ cmdtest tests.build
cmdtest tests.as-root
else
echo "NOT RUNNING tests.as-root"
@@ -51,7 +52,7 @@ then
git ls-files |
grep -v '\.gz$' |
grep -Ev 'tests[^/]*/.*\.std(out|err)' |
- grep -vF 'tests/build-system-autotools.script' |
+ grep -vF 'tests.build/build-system-autotools.script' |
while read x
do
if tr -cd '\t' < "$x" | grep . > /dev/null
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py
index 27fec4da..b9ded140 100644
--- a/morphlib/buildcommand.py
+++ b/morphlib/buildcommand.py
@@ -80,7 +80,12 @@ class BuildCommand(object):
self.app.status(msg='Creating source pool', chatty=True)
srcpool = self.app.create_source_pool(
self.lrc, self.rrc, (repo_name, ref, filename))
-
+
+ root_kind = srcpool.lookup(repo_name, ref, filename).morphology['kind']
+ if root_kind != 'system':
+ raise morphlib.Error(
+ 'Building a %s directly is not supported' % root_kind)
+
self.app.status(
msg='Validating cross-morphology references', chatty=True)
self._validate_cross_morphology_references(srcpool)
diff --git a/tests/ambiguous-refs.script b/tests.build/ambiguous-refs.script
index 58d09d26..e1eae59d 100755
--- a/tests/ambiguous-refs.script
+++ b/tests.build/ambiguous-refs.script
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2011, 2012 Codethink Limited
+# Copyright (C) 2011-2013 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
@@ -25,8 +25,8 @@ set -eu
# Create a ref that will show up in 'git show-ref' before the real master ref
cd "$DATADIR/morphs-repo"
git checkout -q -b alpha/master
-git rm -q hello-stratum.morph
+git rm -q hello-system.morph
git commit -q -m "This ref will not build correctly"
"$SRCDIR/scripts/test-morph" build-morphology \
- test:morphs-repo master hello-stratum
+ test:morphs-repo master hello-system
diff --git a/tests/build-chunk-failures-dump-log.exit b/tests.build/build-chunk-failures-dump-log.exit
index d00491fd..d00491fd 100644
--- a/tests/build-chunk-failures-dump-log.exit
+++ b/tests.build/build-chunk-failures-dump-log.exit
diff --git a/tests/build-chunk-failures-dump-log.script b/tests.build/build-chunk-failures-dump-log.script
index 3e0985d8..e5c7c38d 100755
--- a/tests/build-chunk-failures-dump-log.script
+++ b/tests.build/build-chunk-failures-dump-log.script
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2011, 2012 Codethink Limited
+# Copyright (C) 2011-2013 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
@@ -20,12 +20,13 @@
set -eu
+# Make 'hello' chunk fail to build
chunkrepo="$DATADIR/chunk-repo"
cd "$chunkrepo"
-git checkout --quiet master
-cat <<EOF >false.morph
+git checkout --quiet farrokh
+cat <<EOF >hello.morph
{
- "name": "false",
+ "name": "hello",
"kind": "chunk",
"build-system": "dummy",
"build-commands": [
@@ -34,9 +35,8 @@ cat <<EOF >false.morph
]
}
EOF
-git add false.morph
-git commit --quiet -m "Make a morphology that fails."
+git add hello.morph
+git commit --quiet -m "Make morphology fail to build."
"$SRCDIR/scripts/test-morph" build-morphology \
- test:chunk-repo master false \
- 2>/dev/null
+ test:morphs-repo master hello-system 2>/dev/null
diff --git a/tests/build-chunk-failures-dump-log.stdout b/tests.build/build-chunk-failures-dump-log.stdout
index 7a13c12a..7a13c12a 100644
--- a/tests/build-chunk-failures-dump-log.stdout
+++ b/tests.build/build-chunk-failures-dump-log.stdout
diff --git a/tests/build-chunk-writes-log.script b/tests.build/build-chunk-writes-log.script
index a258bf99..5bfb2ae3 100755
--- a/tests/build-chunk-writes-log.script
+++ b/tests.build/build-chunk-writes-log.script
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2011, 2012 Codethink Limited
+# Copyright (C) 2011-2013 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
@@ -16,11 +16,12 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-## Test building a chunk - build log should be saved.
+## Build log should be saved when a chunk is built.
set -eu
-"$SRCDIR/scripts/test-morph" build-morphology test:chunk-repo farrokh hello
+"$SRCDIR/scripts/test-morph" build-morphology \
+ test:morphs-repo master hello-system
SOURCES="$DATADIR/cached-sources"
find "$DATADIR/cache/artifacts" -name '*.chunk.*' |
diff --git a/tests/build-stratum-with-submodules.script b/tests.build/build-stratum-with-submodules.script
index 1799d74a..f64ba9f6 100755
--- a/tests/build-stratum-with-submodules.script
+++ b/tests.build/build-stratum-with-submodules.script
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2011, 2012 Codethink Limited
+# Copyright (C) 2011-2013 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
@@ -46,9 +46,9 @@ EOF
# Modify the stratum to refer to the parent, not the submodule.
morphs="$DATADIR/morphs-repo"
-cat <<EOF > "$morphs/submod-stratum.morph"
+cat <<EOF > "$morphs/hello-stratum.morph"
{
- "name": "submod-stratum",
+ "name": "hello-stratum",
"kind": "stratum",
"chunks": [
{
@@ -60,16 +60,15 @@ cat <<EOF > "$morphs/submod-stratum.morph"
]
}
EOF
-"$SRCDIR/scripts/run-git-in" "$morphs" add submod-stratum.morph
+"$SRCDIR/scripts/run-git-in" "$morphs" add hello-stratum.morph
"$SRCDIR/scripts/run-git-in" "$morphs" commit --quiet -m 'foo'
-# No build and verify we got a stratum.
+# Now build and verify we got a stratum.
"$SRCDIR/scripts/test-morph" build-morphology \
- test:morphs-repo master submod-stratum
-"$SRCDIR/scripts/assemble-stratum" --cachedir "$DATADIR/cache" \
- "$DATADIR/cache/artifacts/"*submod-stratum \
- "$DATADIR/stratum.tar" submod-stratum
-tar -tf "$DATADIR/stratum.tar" | LC_ALL=C sort | sed '/^\.\/./s:^\./::'
+ test:morphs-repo master hello-system
+
+system=$(ls "$DATADIR/cache/artifacts/"*hello-system-rootfs)
+tar tf $system | LC_ALL=C sort | sed '/^\.\/./s:^\./::'
diff --git a/tests.build/build-stratum-with-submodules.stdout b/tests.build/build-stratum-with-submodules.stdout
new file mode 100644
index 00000000..bf9836d7
--- /dev/null
+++ b/tests.build/build-stratum-with-submodules.stdout
@@ -0,0 +1,8 @@
+./
+baserock/
+baserock/hello-stratum.meta
+baserock/hello-system-rootfs.meta
+baserock/parent.meta
+etc/
+etc/fstab
+etc/os-release
diff --git a/tests/build-system-autotools-fails-if-autogen-fails.exit b/tests.build/build-system-autotools-fails-if-autogen-fails.exit
index d00491fd..d00491fd 100644
--- a/tests/build-system-autotools-fails-if-autogen-fails.exit
+++ b/tests.build/build-system-autotools-fails-if-autogen-fails.exit
diff --git a/tests/build-system-autotools-fails-if-autogen-fails.script b/tests.build/build-system-autotools-fails-if-autogen-fails.script
index 46510516..d7fdd055 100755
--- a/tests/build-system-autotools-fails-if-autogen-fails.script
+++ b/tests.build/build-system-autotools-fails-if-autogen-fails.script
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2012 Codethink Limited
+# Copyright (C) 2012-2013 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
@@ -21,19 +21,21 @@
set -eu
-x="$DATADIR/autogen-chunk"
-mkdir "$x"
-cat <<EOF > "$x/autogen.sh"
+cd "$DATADIR/chunk-repo"
+git checkout -q farrokh
+
+cat <<EOF > autogen.sh
#!/bin/sh
echo "in failing autogen.sh"
exit 1
EOF
-chmod a+x "$x/autogen.sh"
-"$SRCDIR/scripts/run-git-in" "$x" init --quiet
-"$SRCDIR/scripts/run-git-in" "$x" add .
-"$SRCDIR/scripts/run-git-in" "$x" commit --quiet -m initial
+chmod a+x autogen.sh
+
+git add autogen.sh
+git rm -q hello.morph
+git commit -q -m "Convert hello to a broken autotools project"
"$SRCDIR/scripts/test-morph" build-morphology \
- test:autogen-chunk master detected \
+ test:morphs-repo master hello-system \
>/dev/null 2> /dev/null
diff --git a/tests/build-system-autotools.script b/tests.build/build-system-autotools.script
index 6037d1b5..c2171750 100755
--- a/tests/build-system-autotools.script
+++ b/tests.build/build-system-autotools.script
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2011, 2012 Codethink Limited
+# Copyright (C) 2011-2013 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
@@ -47,7 +47,8 @@ EOF
git add hello.morph
git commit --quiet -m "Convert hello to an autotools project"
-"$SRCDIR/scripts/test-morph" build-morphology test:chunk-repo farrokh hello
+"$SRCDIR/scripts/test-morph" build-morphology \
+ test:morphs-repo master hello-system
for chunk in "$DATADIR/cache/artifacts/"*.chunk.*
do
diff --git a/tests/build-system-autotools.stdout b/tests.build/build-system-autotools.stdout
index 8077cac2..8077cac2 100644
--- a/tests/build-system-autotools.stdout
+++ b/tests.build/build-system-autotools.stdout
diff --git a/tests/build-system-cpan.script b/tests.build/build-system-cpan.script
index 9217ab16..19e45e42 100755
--- a/tests/build-system-cpan.script
+++ b/tests.build/build-system-cpan.script
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2011, 2012 Codethink Limited
+# Copyright (C) 2011-2013 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
@@ -55,7 +55,7 @@ git add hello.morph
git commit --quiet -m 'convert hello into a perl cpan project'
"$SRCDIR/scripts/test-morph" build-morphology --prefix=/ \
- test:chunk-repo farrokh hello
+ test:morphs-repo master hello-system
for chunk in "$DATADIR/cache/artifacts/"*.chunk.*
do
diff --git a/tests/build-system-cpan.stdout b/tests.build/build-system-cpan.stdout
index 5cbe4c73..5cbe4c73 100644
--- a/tests/build-system-cpan.stdout
+++ b/tests.build/build-system-cpan.stdout
diff --git a/tests/build-system-python-distutils.script b/tests.build/build-system-python-distutils.script
index 683599f2..cebb9f84 100755
--- a/tests/build-system-python-distutils.script
+++ b/tests.build/build-system-python-distutils.script
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2011, 2012 Codethink Limited
+# Copyright (C) 2011-2013 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
@@ -52,7 +52,7 @@ git add hello.morph
git commit --quiet -m 'convert hello into a python project'
"$SRCDIR/scripts/test-morph" build-morphology --prefix= \
- test:chunk-repo farrokh hello
+ test:morphs-repo master hello-system
for chunk in "$DATADIR/cache/artifacts/"*.chunk.*
do
diff --git a/tests/build-system-python-distutils.stdout b/tests.build/build-system-python-distutils.stdout
index 4d4abdbb..4d4abdbb 100644
--- a/tests/build-system-python-distutils.stdout
+++ b/tests.build/build-system-python-distutils.stdout
diff --git a/tests/build-chunk.script b/tests.build/build-system.script
index 9728f939..75b9d0d0 100755
--- a/tests/build-chunk.script
+++ b/tests.build/build-system.script
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2011, 2012 Codethink Limited
+# Copyright (C) 2011-2013 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
@@ -16,15 +16,12 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-## Test building a chunk.
+## Test building a simple system.
set -eu
-"$SRCDIR/scripts/test-morph" build-morphology test:chunk-repo farrokh hello
+"$SRCDIR/scripts/test-morph" build-morphology \
+ test:morphs-repo master hello-system
-for chunk in "$DATADIR/cache/artifacts/"*.chunk.*
-do
- echo "$chunk:" | sed 's/[^.]*//'
- tar -tf "$chunk" | LC_ALL=C sort | sed '/^\.\/./s:^\./::'
- echo
-done
+system=$(ls "$DATADIR/cache/artifacts/"*hello-system-rootfs)
+tar tf $system | LC_ALL=C sort | sed '/^\.\/./s:^\./::'
diff --git a/tests/build-stratum.stdout b/tests.build/build-system.stdout
index 4f422ea4..3d5201ee 100644
--- a/tests/build-stratum.stdout
+++ b/tests.build/build-system.stdout
@@ -1,7 +1,10 @@
./
baserock/
baserock/hello-stratum.meta
+baserock/hello-system-rootfs.meta
baserock/hello.meta
bin/
bin/hello
etc/
+etc/fstab
+etc/os-release
diff --git a/tests/missing-ref.exit b/tests.build/missing-ref.exit
index d00491fd..d00491fd 100644
--- a/tests/missing-ref.exit
+++ b/tests.build/missing-ref.exit
diff --git a/tests/missing-ref.script b/tests.build/missing-ref.script
index 26183af3..a18ce2d1 100755
--- a/tests/missing-ref.script
+++ b/tests.build/missing-ref.script
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2011,2012 Codethink Limited
+# Copyright (C) 2011-2013 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
@@ -19,5 +19,5 @@
## Test building with a bad reference.
"$SRCDIR/scripts/test-morph" build-morphology \
- test:chunk-repo non-existent-branch hello
+ test:morphs-repo non-existent-branch hello-system
diff --git a/tests/missing-ref.stderr b/tests.build/missing-ref.stderr
index d2b5d254..5fa5456b 100644
--- a/tests/missing-ref.stderr
+++ b/tests.build/missing-ref.stderr
@@ -1 +1 @@
-ERROR: Ref non-existent-branch is an invalid reference for repo file://TMP/chunk-repo
+ERROR: Ref non-existent-branch is an invalid reference for repo file://TMP/morphs-repo
diff --git a/tests/morphless-chunks.script b/tests.build/morphless-chunks.script
index d7b068da..c9294c3e 100755
--- a/tests/morphless-chunks.script
+++ b/tests.build/morphless-chunks.script
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2012 Codethink Limited
+# Copyright (C) 2012-2013 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
@@ -20,10 +20,10 @@
set -eu
-# Create an auto-detectable chunk.
+# Make 'hello' chunk into an auto-detectable chunk.
-mkdir "$DATADIR/morphless"
-cd "$DATADIR/morphless"
+cd "$DATADIR/chunk-repo"
+git checkout -q farrokh
touch configure
chmod +x configure
@@ -34,34 +34,13 @@ cat << EOF > Makefile
all install:
EOF
-git init --quiet
-git add *
-git commit --quiet -m initial
+git rm -q hello.morph
+git add Makefile configure
+git commit -q -m "Convert hello into an autodetectable chunk"
-# Create a stratum that refers to the morphless chunk.
-
-mkdir "$DATADIR/stratum"
-cd "$DATADIR/stratum"
-cat << EOF > alfred.morph
-{
- "name": "alfred",
- "kind": "stratum",
- "chunks": [
- {
- "name": "morphless",
- "repo": "test:morphless",
- "ref": "master",
- "build-depends": []
- }
- ]
-}
-EOF
-git init --quiet
-git add alfred.morph
-git commit --quiet -m initial
-
-"$SRCDIR/scripts/test-morph" build-morphology test:stratum master alfred
+"$SRCDIR/scripts/test-morph" build-morphology \
+ test:morphs-repo master hello-system
for chunk in "$DATADIR/cache/artifacts/"*.chunk.*
do
diff --git a/tests/build-chunk.stdout b/tests.build/morphless-chunks.stdout
index 8077cac2..22292c14 100644
--- a/tests/build-chunk.stdout
+++ b/tests.build/morphless-chunks.stdout
@@ -2,7 +2,4 @@
./
baserock/
baserock/hello.meta
-bin/
-bin/hello
-etc/
diff --git a/tests/build-stratum.script b/tests.build/only-build-systems.script
index ac210129..635a218f 100755
--- a/tests/build-stratum.script
+++ b/tests.build/only-build-systems.script
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2011, 2012 Codethink Limited
+# Copyright (C) 2013 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
@@ -16,14 +16,14 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-## Test build a simple stratum.
+## Morph should refuse build a chunk or a stratum out of the context. Only
+## system morphologies can be built.
set -eu
"$SRCDIR/scripts/test-morph" build-morphology \
- test:morphs-repo master hello-stratum
-"$SRCDIR/scripts/assemble-stratum" --cachedir "$DATADIR/cache" \
- "$DATADIR/cache/artifacts/"*.hello-stratum \
- "$DATADIR/stratum.tar" hello-stratum
-tar -tf "$DATADIR/stratum.tar" | LC_ALL=C sort | sed '/^\.\/./s:^\./::'
+ test:morphs-repo master hello-stratum || true
+
+"$SRCDIR/scripts/test-morph" build-morphology \
+ test:chunk-repo farrokh hello || true
diff --git a/tests.build/only-build-systems.stderr b/tests.build/only-build-systems.stderr
new file mode 100644
index 00000000..ba7339d2
--- /dev/null
+++ b/tests.build/only-build-systems.stderr
@@ -0,0 +1,2 @@
+ERROR: Building a stratum directly is not supported
+ERROR: Building a chunk directly is not supported
diff --git a/tests/rebuild-cached-stratum.script b/tests.build/rebuild-cached-stratum.script
index 70cc54cf..306c16f2 100755
--- a/tests/rebuild-cached-stratum.script
+++ b/tests.build/rebuild-cached-stratum.script
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2011, 2012 Codethink Limited
+# Copyright (C) 2011-2013 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
@@ -35,11 +35,12 @@ cache="$DATADIR/cache/artifacts"
(cd "$DATADIR/morphs-repo" &&
git checkout --quiet -b rebuild-cached-stratum &&
sed -i 's/farrokh/rebuild-cached-stratum/' hello-stratum.morph &&
+ sed -i 's/master/rebuild-cached-stratum/' hello-system.morph &&
git commit --quiet -m "rebuild-cached-stratum" -a)
# Build the first time.
"$SRCDIR/scripts/test-morph" build-morphology \
- test:morphs-repo rebuild-cached-stratum hello-stratum
+ test:morphs-repo rebuild-cached-stratum hello-system
echo "first build:"
(cd "$cache" && ls *.chunk.* *hello-stratum | sed 's/^[^.]*\./ /' |
LC_ALL=C sort)
@@ -51,7 +52,7 @@ echo "first build:"
# Rebuild.
"$SRCDIR/scripts/test-morph" build-morphology \
- test:morphs-repo rebuild-cached-stratum hello-stratum
+ test:morphs-repo rebuild-cached-stratum hello-system
echo "second build:"
(cd "$cache" && ls *.chunk.* *hello-stratum | sed 's/^[^.]*\./ /' |
LC_ALL=C sort)
diff --git a/tests/rebuild-cached-stratum.stdout b/tests.build/rebuild-cached-stratum.stdout
index eee106f5..eee106f5 100644
--- a/tests/rebuild-cached-stratum.stdout
+++ b/tests.build/rebuild-cached-stratum.stdout
diff --git a/tests.build/setup b/tests.build/setup
new file mode 100755
index 00000000..935e388b
--- /dev/null
+++ b/tests.build/setup
@@ -0,0 +1,135 @@
+#!/bin/sh
+#
+# Create git repositories for tests. The chunk repository will contain a
+# simple "hello, world" C program, and two branches ("master", "farrokh"),
+# with the master branch containing just a README. The two branches are there
+# so that we can test building a branch that hasn't been checked out.
+# The branches are different so that we know that if the wrong branch
+# is uses, the build will fail.
+#
+# The stratum repository contains a single branch, "master", with a
+# stratum and a system morphology that include the chunk above.
+#
+# Copyright (C) 2011-2013 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.
+
+
+set -eu
+
+# The $DATADIR should be empty at the beginnig of each test.
+find "$DATADIR" -mindepth 1 -delete
+
+# Create chunk repository.
+
+chunkrepo="$DATADIR/chunk-repo"
+mkdir "$chunkrepo"
+cd "$chunkrepo"
+git init --quiet
+
+cat <<EOF > README
+This is a sample README.
+EOF
+git add README
+git commit --quiet -m "add README"
+
+git checkout --quiet -b farrokh
+
+cat <<EOF > hello.c
+#include <stdio.h>
+int main(void)
+{
+ puts("hello, world");
+ return 0;
+}
+EOF
+git add hello.c
+
+cat <<EOF > hello.morph
+{
+ "name": "hello",
+ "kind": "chunk",
+ "build-system": "dummy",
+ "build-commands": [
+ "gcc -o hello hello.c"
+ ],
+ "install-commands": [
+ "install -d \\"\$DESTDIR\\"/etc",
+ "install -d \\"\$DESTDIR\\"/bin",
+ "install hello \\"\$DESTDIR\\"/bin/hello"
+ ]
+}
+EOF
+git add hello.morph
+
+git commit --quiet -m "add a hello world program and morph"
+
+git checkout --quiet master
+
+
+
+# Create morph repository.
+
+morphsrepo="$DATADIR/morphs-repo"
+mkdir "$morphsrepo"
+cd "$morphsrepo"
+git init --quiet
+
+cat <<EOF > hello-stratum.morph
+{
+ "name": "hello-stratum",
+ "kind": "stratum",
+ "chunks": [
+ {
+ "name": "hello",
+ "repo": "test:chunk-repo",
+ "ref": "farrokh",
+ "build-depends": []
+ }
+ ]
+}
+EOF
+git add hello-stratum.morph
+
+cat <<EOF > hello-system.morph
+{
+ "name": "hello-system",
+ "kind": "system",
+ "arch": "$(uname -m)",
+ "system-kind": "rootfs-tarball",
+ "disk-size": "1G",
+ "strata": [
+ {
+ "morph": "hello-stratum",
+ "repo": "test:morphs-repo",
+ "ref": "master"
+ }
+ ]
+}
+EOF
+git add hello-system.morph
+
+git commit --quiet -m "add morphs"
+
+
+# Create a morph configuration file.
+cat <<EOF > "$DATADIR/morph.conf"
+[config]
+repo-alias = test=file://$DATADIR/%s#file://$DATADIR/%s
+cachedir = $DATADIR/cache
+log = $DATADIR/morph.log
+no-distcc = true
+quiet = true
+EOF
+
diff --git a/tests/stratum-overlap-warns.script b/tests.build/stratum-overlap-warns.script
index c9aeed72..2a3b06e1 100755
--- a/tests/stratum-overlap-warns.script
+++ b/tests.build/stratum-overlap-warns.script
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2011, 2012 Codethink Limited
+# Copyright (C) 2011-2013 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
@@ -30,10 +30,10 @@ warning_mentions(){
}
"$SRCDIR/scripts/test-morph" build-morphology --log=$log \
- test:morphs-repo overlap overlap-stratum > /dev/null
+ test:morphs-repo overlap hello-system > /dev/null
grep WARNING "$log" >"$warnings"
-for str in overlap-stratum \
+for str in hello-stratum \
overlap-foo-baz overlap-foobar bin/bar \
overlap-fooqux bin/foo; do
- warning_mentions 'overlap-stratum' || exit $?
+ warning_mentions 'hello-stratum' || exit $?
done
diff --git a/tests/stratum-overlap-warns.setup b/tests.build/stratum-overlap-warns.setup
index a699bf2d..520a37a1 100755
--- a/tests/stratum-overlap-warns.setup
+++ b/tests.build/stratum-overlap-warns.setup
@@ -3,7 +3,7 @@
# If a stratum has multiple chunks that have the same files in them,
# then this should be notified
#
-# Copyright (C) 2011, 2012 Codethink Limited
+# Copyright (C) 2011-2013 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
@@ -25,9 +25,9 @@ morphsrepo="$DATADIR/morphs-repo"
cd "$morphsrepo"
git checkout --quiet -b overlap master
-cat <<EOF >overlap-stratum.morph
+cat <<EOF >hello-stratum.morph
{
- "name": "overlap-stratum",
+ "name": "hello-stratum",
"kind": "stratum",
"chunks": [
{
@@ -57,8 +57,9 @@ cat <<EOF >overlap-stratum.morph
]
}
EOF
-git add overlap-stratum.morph
-git commit --quiet -m "add overlapping stratum"
+sed -i 's/master/overlap/' hello-system.morph
+git add hello-stratum.morph hello-system.morph
+git commit --quiet -m "Make hello stratum contain overlaps"
cd "$chunkrepo"
git checkout --quiet -b overlap master
diff --git a/tests/stratum-overlap-writes-overlap.script b/tests.build/stratum-overlap-writes-overlap.script
index a52d1ba7..ca06454b 100755
--- a/tests/stratum-overlap-writes-overlap.script
+++ b/tests.build/stratum-overlap-writes-overlap.script
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2011, 2012 Codethink Limited
+# Copyright (C) 2011-2013 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
@@ -25,11 +25,11 @@ cache="$DATADIR/cache/artifacts"
"$SRCDIR/scripts/test-morph" build-morphology \
- test:morphs-repo overlap overlap-stratum > /dev/null
+ test:morphs-repo overlap hello-system > /dev/null
"$SRCDIR/scripts/list-overlaps" groups \
- "$cache"/*.stratum.overlap-stratum.overlaps |
+ "$cache"/*.stratum.hello-stratum.overlaps |
while IFS='\n' read overlaps; do
echo $overlaps
"$SRCDIR/scripts/list-overlaps" list-files \
- "$cache"/*.stratum.overlap-stratum.overlaps $overlaps
+ "$cache"/*.stratum.hello-stratum.overlaps $overlaps
done
diff --git a/tests/stratum-overlap-writes-overlap.setup b/tests.build/stratum-overlap-writes-overlap.setup
index 255e9a74..255e9a74 120000
--- a/tests/stratum-overlap-writes-overlap.setup
+++ b/tests.build/stratum-overlap-writes-overlap.setup
diff --git a/tests/stratum-overlap-writes-overlap.stdout b/tests.build/stratum-overlap-writes-overlap.stdout
index 40485659..40485659 100644
--- a/tests/stratum-overlap-writes-overlap.stdout
+++ b/tests.build/stratum-overlap-writes-overlap.stdout
diff --git a/tests/uses-tempdir.script b/tests.build/uses-tempdir.script
index a4aac557..80c06d56 100755
--- a/tests/uses-tempdir.script
+++ b/tests.build/uses-tempdir.script
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2011, 2012 Codethink Limited
+# Copyright (C) 2011-2013 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
@@ -25,4 +25,4 @@ TMPDIR="$DATADIR"/unwritable-tmp
install -m 000 -d "$TMPDIR"
mkdir "$DATADIR"/tmp
"$SRCDIR/scripts/test-morph" build-morphology --tempdir "$DATADIR"/tmp \
- test:morphs-repo master hello-stratum
+ test:morphs-repo master hello-system
diff --git a/tests/build-stratum-with-submodules.stdout b/tests/build-stratum-with-submodules.stdout
deleted file mode 100644
index a5f677f3..00000000
--- a/tests/build-stratum-with-submodules.stdout
+++ /dev/null
@@ -1,4 +0,0 @@
-./
-baserock/
-baserock/parent.meta
-baserock/submod-stratum.meta
diff --git a/tests/morphless-chunks.stdout b/tests/morphless-chunks.stdout
deleted file mode 100644
index 8e17b29a..00000000
--- a/tests/morphless-chunks.stdout
+++ /dev/null
@@ -1,5 +0,0 @@
-.chunk.morphless:
-./
-baserock/
-baserock/morphless.meta
-
diff --git a/tests/show-dependencies.script b/tests/show-dependencies.script
index 056b81b2..15b69e25 100755
--- a/tests/show-dependencies.script
+++ b/tests/show-dependencies.script
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2012 Codethink Limited
+# Copyright (C) 2012-2013 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
@@ -21,5 +21,5 @@
set -eu
"$SRCDIR/scripts/test-morph" \
- show-dependencies test:test-repo master xfce-core |
+ show-dependencies test:test-repo master xfce-system |
sed 's/test://'
diff --git a/tests/show-dependencies.setup b/tests/show-dependencies.setup
index e85c5ecf..5d70d821 100755
--- a/tests/show-dependencies.setup
+++ b/tests/show-dependencies.setup
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2012 Codethink Limited
+# Copyright (C) 2012-2013 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
@@ -321,3 +321,21 @@ cat <<EOF > xfce-core.morph
EOF
git add xfce-core.morph
git commit --quiet -m "add xfce-core.morph stratum"
+
+cat <<EOF > xfce-system.morph
+{
+ "name": "xfce-system",
+ "kind": "system",
+ "system-kind": "rootfs-tarball",
+ "arch": "$(uname -m)",
+ "strata": [
+ {
+ "repo": "test:test-repo",
+ "ref": "master",
+ "morph": "xfce-core"
+ }
+ ]
+}
+EOF
+git add xfce-system.morph
+git commit --quiet -m "add xfce-system"
diff --git a/tests/show-dependencies.stdout b/tests/show-dependencies.stdout
index 84ed3ba6..ab1453db 100644
--- a/tests/show-dependencies.stdout
+++ b/tests/show-dependencies.stdout
@@ -1,4 +1,6 @@
-dependency graph for test-repo|master|xfce-core:
+dependency graph for test-repo|master|xfce-system:
+ test-repo|master|xfce-system|xfce-system-rootfs
+ -> test-repo|master|xfce-core|xfce-core
test-repo|master|xfce-core|xfce-core
-> test-repo|master|exo|exo
-> test-repo|master|garcon|garcon