diff options
26 files changed, 100 insertions, 128 deletions
diff --git a/tests.build/ambiguous-refs.script b/tests.build/ambiguous-refs.script index fbfbdfd7..e1eae59d 100755 --- a/tests.build/ambiguous-refs.script +++ b/tests.build/ambiguous-refs.script @@ -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/build-chunk-failures-dump-log.script b/tests.build/build-chunk-failures-dump-log.script index b54c2c1e..e5c7c38d 100755 --- a/tests.build/build-chunk-failures-dump-log.script +++ b/tests.build/build-chunk-failures-dump-log.script @@ -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/build-chunk-writes-log.script b/tests.build/build-chunk-writes-log.script index 0e7aac88..5bfb2ae3 100755 --- a/tests.build/build-chunk-writes-log.script +++ b/tests.build/build-chunk-writes-log.script @@ -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/build-chunk.stdout b/tests.build/build-chunk.stdout deleted file mode 100644 index 8077cac2..00000000 --- a/tests.build/build-chunk.stdout +++ /dev/null @@ -1,8 +0,0 @@ -.chunk.hello: -./ -baserock/ -baserock/hello.meta -bin/ -bin/hello -etc/ - diff --git a/tests.build/build-stratum-with-submodules.script b/tests.build/build-stratum-with-submodules.script index 987fbadf..f64ba9f6 100755 --- a/tests.build/build-stratum-with-submodules.script +++ b/tests.build/build-stratum-with-submodules.script @@ -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 index a5f677f3..bf9836d7 100644 --- a/tests.build/build-stratum-with-submodules.stdout +++ b/tests.build/build-stratum-with-submodules.stdout @@ -1,4 +1,8 @@ ./ baserock/ +baserock/hello-stratum.meta +baserock/hello-system-rootfs.meta baserock/parent.meta -baserock/submod-stratum.meta +etc/ +etc/fstab +etc/os-release diff --git a/tests.build/build-stratum.script b/tests.build/build-stratum.script deleted file mode 100755 index 4392036d..00000000 --- a/tests.build/build-stratum.script +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# -# 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. - - -## Test build a simple stratum. - -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:^\./::' - diff --git a/tests.build/build-system-autotools-fails-if-autogen-fails.script b/tests.build/build-system-autotools-fails-if-autogen-fails.script index ddd3e4cc..d7fdd055 100755 --- a/tests.build/build-system-autotools-fails-if-autogen-fails.script +++ b/tests.build/build-system-autotools-fails-if-autogen-fails.script @@ -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/build-system-autotools.script b/tests.build/build-system-autotools.script index 35fcd779..c2171750 100755 --- a/tests.build/build-system-autotools.script +++ b/tests.build/build-system-autotools.script @@ -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/build-system-cpan.script b/tests.build/build-system-cpan.script index 6e5a02e4..19e45e42 100755 --- a/tests.build/build-system-cpan.script +++ b/tests.build/build-system-cpan.script @@ -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/build-system-python-distutils.script b/tests.build/build-system-python-distutils.script index 2a1b5f70..cebb9f84 100755 --- a/tests.build/build-system-python-distutils.script +++ b/tests.build/build-system-python-distutils.script @@ -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/build-chunk.script b/tests.build/build-system.script index 4232d3f6..75b9d0d0 100755 --- a/tests.build/build-chunk.script +++ b/tests.build/build-system.script @@ -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/build-stratum.stdout b/tests.build/build-system.stdout index 4f422ea4..3d5201ee 100644 --- a/tests.build/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.build/missing-ref.script b/tests.build/missing-ref.script index db654e61..a18ce2d1 100755 --- a/tests.build/missing-ref.script +++ b/tests.build/missing-ref.script @@ -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.build/missing-ref.stderr b/tests.build/missing-ref.stderr index d2b5d254..5fa5456b 100644 --- a/tests.build/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.build/morphless-chunks.script b/tests.build/morphless-chunks.script index b5b8f37e..c9294c3e 100755 --- a/tests.build/morphless-chunks.script +++ b/tests.build/morphless-chunks.script @@ -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/morphless-chunks.stdout b/tests.build/morphless-chunks.stdout index 8e17b29a..22292c14 100644 --- a/tests.build/morphless-chunks.stdout +++ b/tests.build/morphless-chunks.stdout @@ -1,5 +1,5 @@ -.chunk.morphless: +.chunk.hello: ./ baserock/ -baserock/morphless.meta +baserock/hello.meta diff --git a/tests.build/rebuild-cached-stratum.script b/tests.build/rebuild-cached-stratum.script index 06003a26..306c16f2 100755 --- a/tests.build/rebuild-cached-stratum.script +++ b/tests.build/rebuild-cached-stratum.script @@ -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.build/setup b/tests.build/setup index 50fd5bd4..935e388b 100755 --- a/tests.build/setup +++ b/tests.build/setup @@ -106,7 +106,8 @@ cat <<EOF > hello-system.morph { "name": "hello-system", "kind": "system", - "system-kind": "syslinux-disk", + "arch": "$(uname -m)", + "system-kind": "rootfs-tarball", "disk-size": "1G", "strata": [ { diff --git a/tests.build/stratum-overlap-warns.script b/tests.build/stratum-overlap-warns.script index 86071954..2a3b06e1 100755 --- a/tests.build/stratum-overlap-warns.script +++ b/tests.build/stratum-overlap-warns.script @@ -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.build/stratum-overlap-warns.setup b/tests.build/stratum-overlap-warns.setup index ef771794..520a37a1 100755 --- a/tests.build/stratum-overlap-warns.setup +++ b/tests.build/stratum-overlap-warns.setup @@ -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.build/stratum-overlap-writes-overlap.script b/tests.build/stratum-overlap-writes-overlap.script index 90b65cb9..ca06454b 100755 --- a/tests.build/stratum-overlap-writes-overlap.script +++ b/tests.build/stratum-overlap-writes-overlap.script @@ -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.build/uses-tempdir.script b/tests.build/uses-tempdir.script index a9ac40dd..80c06d56 100755 --- a/tests.build/uses-tempdir.script +++ b/tests.build/uses-tempdir.script @@ -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/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 |