diff options
Diffstat (limited to 'tests.build')
19 files changed, 49 insertions, 480 deletions
diff --git a/tests.build/build-chunk-failures-dump-log.script b/tests.build/build-chunk-failures-dump-log.script index 81361ad0..75c3caf2 100755 --- a/tests.build/build-chunk-failures-dump-log.script +++ b/tests.build/build-chunk-failures-dump-log.script @@ -20,13 +20,13 @@ set -eu # Make 'hello' chunk fail to build -chunkrepo="$DATADIR/chunk-repo" -cd "$chunkrepo" -git checkout --quiet farrokh +morphsrepo="$DATADIR/morphs-repo" +cd "$morphsrepo" cat <<EOF >hello.morph name: hello kind: chunk -build-system: dummy +configure-commands: + - echo dummy configure build-commands: - echo The next command will fail - "false" diff --git a/tests.build/build-stratum-with-submodules.script b/tests.build/build-stratum-with-submodules.script index bd6b97ce..2dd2b924 100755 --- a/tests.build/build-stratum-with-submodules.script +++ b/tests.build/build-stratum-with-submodules.script @@ -24,13 +24,7 @@ set -eu parent="$DATADIR/parent-repo" mkdir "$parent" -cat <<EOF > "$parent/parent.morph" -name: parent -kind: chunk -build-system: manual -build-commands: - - test -f le-sub/README -EOF +echo "No real content here" > "$parent/dummy" "$SRCDIR/scripts/run-git-in" "$parent" init --quiet "$SRCDIR/scripts/run-git-in" "$parent" add . @@ -42,6 +36,14 @@ EOF # Modify the stratum to refer to the parent, not the submodule. morphs="$DATADIR/morphs-repo" +cat <<EOF > "$morphs/parent.morph" +name: parent +kind: chunk +build-system: manual +build-commands: + - test -f le-sub/README +EOF + cat <<EOF > "$morphs/hello-stratum.morph" name: hello-stratum kind: stratum @@ -49,10 +51,11 @@ chunks: - name: parent repo: test:parent-repo ref: master + morph: parent.morph build-depends: [] build-mode: test EOF -"$SRCDIR/scripts/run-git-in" "$morphs" add hello-stratum.morph +"$SRCDIR/scripts/run-git-in" "$morphs" add hello-stratum.morph parent.morph "$SRCDIR/scripts/run-git-in" "$morphs" commit --quiet -m 'foo' diff --git a/tests.build/build-system-autotools-fails-if-autogen-fails.exit b/tests.build/build-system-autotools-fails-if-autogen-fails.exit deleted file mode 100644 index d00491fd..00000000 --- a/tests.build/build-system-autotools-fails-if-autogen-fails.exit +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests.build/build-system-autotools-fails-if-autogen-fails.script b/tests.build/build-system-autotools-fails-if-autogen-fails.script deleted file mode 100755 index 0b009b54..00000000 --- a/tests.build/build-system-autotools-fails-if-autogen-fails.script +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2012-2013,2015 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, see <http://www.gnu.org/licenses/>. - - -## Test that the autotools build system fails if it runs autogen.sh and that -## fails. - -set -eu - -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 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: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 deleted file mode 100755 index 710a8f98..00000000 --- a/tests.build/build-system-autotools.script +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2011-2015 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, see <http://www.gnu.org/licenses/>. - - -## Convert the hello-chunk project to something autotools-like, then -## build it. - -set -eu - -chunkrepo="$DATADIR/chunk-repo" -cd "$chunkrepo" - -git checkout --quiet farrokh - -cat <<'EOF' >Makefile -all: hello - -install: all - install -d "$(DESTDIR)/etc" - install -d "$(DESTDIR)/bin" - install hello "$(DESTDIR)/bin/hello" -EOF -git add Makefile - -cat <<EOF > hello.morph -name: hello -kind: chunk -build-system: autotools -configure-commands: [] -EOF -git add hello.morph -git commit --quiet -m "Convert hello to an autotools project" - -"$SRCDIR/scripts/test-morph" build-morphology \ - test:morphs-repo master hello-system - -for chunk in "$DATADIR/cache/artifacts/"*.chunk.* -do - tar -tf "$chunk" -done | LC_ALL=C sort -u | sed '/^\.\/./s:^\./::' | grep -Ee '^(bin|etc)' diff --git a/tests.build/build-system-autotools.stdout b/tests.build/build-system-autotools.stdout deleted file mode 100644 index 683441c9..00000000 --- a/tests.build/build-system-autotools.stdout +++ /dev/null @@ -1,3 +0,0 @@ -bin/ -bin/hello -etc/ diff --git a/tests.build/build-system-cmake.script b/tests.build/build-system-cmake.script deleted file mode 100755 index fe02f9dc..00000000 --- a/tests.build/build-system-cmake.script +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2011-2015 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, see <http://www.gnu.org/licenses/>. - - -## Convert the hello-chunk project to something cmake-like, then -## build it. - -set -eu - -chunkrepo="$DATADIR/chunk-repo" -cd "$chunkrepo" - -git checkout --quiet farrokh - -cat <<'EOF' >CMakeLists.txt -cmake_minimum_required(VERSION 2.8) -project(hello) - -set(hello_SOURCES hello.c) -add_executable(hello ${hello_SOURCES}) -install(TARGETS hello RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -EOF - -git add CMakeLists.txt - -cat <<EOF > hello.morph -name: hello -kind: chunk -build-system: cmake -install-commands: - - make DESTDIR="\$DESTDIR" install -EOF -git add hello.morph -git commit --quiet -m "Convert hello to a cmake project" - -"$SRCDIR/scripts/test-morph" build-morphology \ - test:morphs-repo master hello-system - -for chunk in "$DATADIR/cache/artifacts/"*.chunk.* -do - tar -tf "$chunk" -done | LC_ALL=C sort -u | sed '/^\.\/./s:^\./::' | grep -Ee '^(usr/)?(bin|etc)' diff --git a/tests.build/build-system-cmake.stdout b/tests.build/build-system-cmake.stdout deleted file mode 100644 index 3410b113..00000000 --- a/tests.build/build-system-cmake.stdout +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin/ -usr/bin/hello diff --git a/tests.build/build-system-cpan.script b/tests.build/build-system-cpan.script deleted file mode 100755 index 103d5466..00000000 --- a/tests.build/build-system-cpan.script +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2011-2015 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, see <http://www.gnu.org/licenses/>. - - -## Convert the hello-chunk project to perl with CPAN and build. - -set -eu - -chunkrepo="$DATADIR/chunk-repo" -cd "$chunkrepo" - -git checkout --quiet farrokh - -git rm --quiet hello.c - -cat <<EOF >hello -#!/usr/bin/perl -print "hello, world\n" -EOF -git add hello - -cat <<EOF >Makefile.PL -use strict; -use warnings; -use ExtUtils::MakeMaker; -WriteMakefile( - EXE_FILES => ['hello'], -) -EOF -git add Makefile.PL - -cat <<EOF >hello.morph -name: hello -kind: chunk -build-system: cpan -EOF -git add hello.morph - -git commit --quiet -m 'convert hello into a perl cpan project' - -# Set 'prefix' of hello to something custom -cd "$DATADIR/morphs-repo" -cat <<EOF > hello-stratum.morph -name: hello-stratum -kind: stratum -chunks: - - name: hello - repo: test:chunk-repo - ref: farrokh - build-depends: [] - build-mode: test - prefix: / -EOF -git add hello-stratum.morph -git commit -q -m "Set custom install prefix for hello" - - -"$SRCDIR/scripts/test-morph" build-morphology \ - test:morphs-repo master hello-system - -for chunk in "$DATADIR/cache/artifacts/"*.chunk.* -do - tar -tf "$chunk" -done | LC_ALL=C sort | sed '/^\.\/./s:^\./::' | grep -F 'bin/hello' diff --git a/tests.build/build-system-cpan.stdout b/tests.build/build-system-cpan.stdout deleted file mode 100644 index 180e949b..00000000 --- a/tests.build/build-system-cpan.stdout +++ /dev/null @@ -1 +0,0 @@ -bin/hello diff --git a/tests.build/build-system-python-distutils.script b/tests.build/build-system-python-distutils.script deleted file mode 100755 index e5c0ea74..00000000 --- a/tests.build/build-system-python-distutils.script +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2011-2015 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, see <http://www.gnu.org/licenses/>. - - -## Convert the hello-chunk project to python with distutils and build. - -set -eu - -chunkrepo="$DATADIR/chunk-repo" -cd "$chunkrepo" - -git checkout --quiet farrokh - -git rm --quiet hello.c -cat <<EOF >hello -#!/usr/bin/python -print "hello, world" -EOF -git add hello - -cat <<EOF >setup.py -#!/usr/bin/python -from distutils.core import setup -setup(name='hello', - scripts=['hello']) -EOF -git add setup.py - -cat <<EOF >hello.morph -name: hello -kind: chunk -build-system: python-distutils -EOF -git add hello.morph - -git commit --quiet -m 'convert hello into a python project' - - -# Set 'prefix' of hello to something custom -cd "$DATADIR/morphs-repo" -cat <<EOF > hello-stratum.morph -name: hello-stratum -kind: stratum -chunks: - - name: hello - repo: test:chunk-repo - ref: farrokh - build-depends: [] - build-mode: test - prefix: "" -EOF -git add hello-stratum.morph -git commit -q -m "Set custom install prefix for hello" - - -"$SRCDIR/scripts/test-morph" build-morphology \ - test:morphs-repo master hello-system - -for chunk in "$DATADIR/cache/artifacts/"*.chunk.* -do - tar -tf "$chunk" -done | LC_ALL=C sort -u | sed '/^\.\/./s:^\./::' | grep -Ee '^(bin|lib)' | -sed -e 's:^local/::' \ - -e 's:lib/python2.[6-9]/:lib/python2.x/:' \ - -e 's:/hello-0\.0\.0[^/]*\.egg-info$:/hello.egg-info/:' \ - -e 's:[^/]*-packages:packages:' \ - -e '/^$/d' diff --git a/tests.build/build-system-python-distutils.stdout b/tests.build/build-system-python-distutils.stdout deleted file mode 100644 index 4d4c3a1e..00000000 --- a/tests.build/build-system-python-distutils.stdout +++ /dev/null @@ -1,6 +0,0 @@ -bin/ -bin/hello -lib/ -lib/python2.x/ -lib/python2.x/packages/ -lib/python2.x/packages/hello.egg-info/ diff --git a/tests.build/build-system-qmake.script b/tests.build/build-system-qmake.script deleted file mode 100755 index d430fba7..00000000 --- a/tests.build/build-system-qmake.script +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2011-2015 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, see <http://www.gnu.org/licenses/>. - - -## Convert the hello-chunk project to something qmake-like, then -## build it. - -set -eu - -if ! command -v qmake > /dev/null ; then - # There is no qmake, so skip this test. - cat "$SRCDIR/tests.build/build-system-qmake.stdout" - exit 0 -fi - -chunkrepo="$DATADIR/chunk-repo" -cd "$chunkrepo" - -git checkout --quiet farrokh - -cat <<'EOF' >hello.pro -TEMPLATE = app -TARGET = hello -DEPENDPATH += . -INCLUDEPATH += . - -SOURCES += hello.c -hello.path = /usr/bin -hello.files = hello -INSTALLS += hello -EOF -git add hello.pro - -cat <<EOF > hello.morph -name: hello -kind: chunk -build-system: qmake -install-commands: - - make INSTALL_ROOT="\$DESTDIR" install -EOF -git add hello.morph -git commit --quiet -m "Convert hello to an qmake project" - -"$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 diff --git a/tests.build/build-system-qmake.stdout b/tests.build/build-system-qmake.stdout deleted file mode 100644 index ccf80a86..00000000 --- a/tests.build/build-system-qmake.stdout +++ /dev/null @@ -1,8 +0,0 @@ -.chunk.hello: -./ -baserock/ -baserock/hello.meta -usr/ -usr/bin/ -usr/bin/hello - diff --git a/tests.build/morphless-chunks.script b/tests.build/morphless-chunks.script deleted file mode 100755 index 5b19bc4a..00000000 --- a/tests.build/morphless-chunks.script +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2012-2015 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, see <http://www.gnu.org/licenses/>. - - -## Try to build a morphless chunk. - -set -eu - -# Make 'hello' chunk into an auto-detectable chunk. - -cd "$DATADIR/chunk-repo" -git checkout -q farrokh - -touch configure -chmod +x configure -# FIXME: If we leave the file empty, busybox sh on ARMv7 fails to execute it. -echo '#!/bin/sh' > configure - -cat << EOF > Makefile -all install: -EOF - -git rm -q hello.morph -git add Makefile configure -git commit -q -m "Convert hello into an autodetectable chunk" - - -"$SRCDIR/scripts/test-morph" build-morphology \ - test:morphs-repo master hello-system - -for chunk in "$DATADIR/cache/artifacts/"*.chunk.* -do - tar -tf "$chunk" -done | cat >/dev/null # No files get installed apart from metadata diff --git a/tests.build/morphless-chunks.stdout b/tests.build/morphless-chunks.stdout deleted file mode 100644 index e69de29b..00000000 --- a/tests.build/morphless-chunks.stdout +++ /dev/null diff --git a/tests.build/prefix.script b/tests.build/prefix.script index 662be704..291b25cf 100755 --- a/tests.build/prefix.script +++ b/tests.build/prefix.script @@ -19,9 +19,10 @@ set -eu -# Create two chunks which print out PATH and PREFIX from their environment. -cd "$DATADIR/chunk-repo" +cd "$DATADIR/morphs-repo" git checkout -q master + +# Create two chunks which print out PATH and PREFIX from their environment. cat <<\EOF > xyzzy.morph name: xyzzy kind: chunk @@ -41,10 +42,8 @@ EOF git add xyzzy.morph git add plugh.morph -git commit -q -m "Add chunks" # Change stratum to include those two chunks, and use a custom install prefix -cd "$DATADIR/morphs-repo" cat <<EOF > hello-stratum.morph name: hello-stratum kind: stratum @@ -52,18 +51,20 @@ chunks: - name: xyzzy repo: test:chunk-repo ref: master + morph: xyzzy.morph build-depends: [] build-mode: test prefix: /plover - name: plugh repo: test:chunk-repo ref: master + morph: plugh.morph build-mode: test build-depends: - xyzzy EOF git add hello-stratum.morph -git commit -q -m "Update stratum" +git commit -q -m "Update build definitions" "$SRCDIR/scripts/test-morph" build-morphology \ test:morphs-repo master hello-system diff --git a/tests.build/setup b/tests.build/setup index 054bdc3e..7936584b 100755 --- a/tests.build/setup +++ b/tests.build/setup @@ -55,19 +55,6 @@ int main(void) 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 @@ -81,9 +68,21 @@ mkdir "$morphsrepo" cd "$morphsrepo" git init --quiet -echo 'version: 5' > VERSION +echo 'version: 6' > VERSION git add VERSION +cat <<EOF > hello.morph +name: hello +kind: chunk +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 + cat <<EOF > hello-stratum.morph name: hello-stratum kind: stratum @@ -91,6 +90,7 @@ chunks: - name: hello repo: test:chunk-repo ref: farrokh + morph: hello.morph build-mode: test build-depends: [] EOF diff --git a/tests.build/setup-build-essential b/tests.build/setup-build-essential index 281ff7ec..8868db68 100755 --- a/tests.build/setup-build-essential +++ b/tests.build/setup-build-essential @@ -26,6 +26,15 @@ echo "I'm a compiler!" EOF chmod +x morph-test-cc +git init -q +git add morph-test-cc +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 @@ -44,14 +53,6 @@ install-commands: - install -m 755 morph-test-cc "\$DESTDIR\$PREFIX/bin/morph-test-cc" EOF -git init -q -git add morph-test-cc cc.morph stage1-cc.morph -git commit -q -m "Create compiler chunk" - -# Require 'cc' in hello-chunk. We should have the second version available -# but *not* the first one. -cd "$DATADIR/chunk-repo" -git checkout -q farrokh cat <<EOF > "hello.morph" name: hello kind: chunk @@ -64,13 +65,12 @@ install-commands: - install -d "\$DESTDIR\$PREFIX/bin" - install hello "\$DESTDIR\$PREFIX/bin/hello" EOF -git add hello.morph -git commit -q -m "Make 'hello' require our mock compiler" +git add hello.morph stage1-cc.morph cc.morph # Add 'build-essential' stratum and make hello-stratum depend upon it. Only # the *second* 'cc' chunk should make it into the build-essential stratum # artifact, and neither should make it into the system. -cd "$DATADIR/morphs-repo" + cat <<EOF > "build-essential.morph" name: build-essential kind: stratum @@ -78,12 +78,14 @@ chunks: - name: stage1-cc repo: test:cc-repo ref: master + morph: stage1-cc.morph build-depends: [] build-mode: bootstrap prefix: /tools - name: cc repo: test:cc-repo ref: master + morph: cc.morph build-depends: - stage1-cc build-mode: test @@ -98,6 +100,7 @@ chunks: - name: hello repo: test:chunk-repo ref: farrokh + morph: hello.morph build-depends: [] build-mode: test EOF |