From bba1d9e9f17edf885e857d0ddcf5b6f41e956b10 Mon Sep 17 00:00:00 2001 From: Adam Coldrick Date: Fri, 8 Aug 2014 11:10:25 +0000 Subject: cmdtests: Use YAML not JSON to represent morphologies --- tests.build/build-chunk-failures-dump-log.script | 17 ++-- tests.build/build-stratum-with-submodules.script | 34 +++---- tests.build/build-system-autotools.script | 10 +- tests.build/build-system-cmake.script | 11 +- tests.build/build-system-cpan.script | 31 +++--- tests.build/build-system-python-distutils.script | 31 +++--- tests.build/build-system-qmake.script | 13 ++- tests.build/empty-stratum.script | 6 +- tests.build/prefix.script | 62 +++++------- tests.build/setup | 58 ++++------- tests.build/setup-build-essential | 122 +++++++++-------------- tests.build/stratum-overlap-warns.setup | 120 ++++++++++------------ 12 files changed, 204 insertions(+), 311 deletions(-) (limited to 'tests.build') diff --git a/tests.build/build-chunk-failures-dump-log.script b/tests.build/build-chunk-failures-dump-log.script index e5c7c38d..645fd59a 100755 --- a/tests.build/build-chunk-failures-dump-log.script +++ b/tests.build/build-chunk-failures-dump-log.script @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (C) 2011-2013 Codethink Limited +# Copyright (C) 2011-2014 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,15 +25,12 @@ chunkrepo="$DATADIR/chunk-repo" cd "$chunkrepo" git checkout --quiet farrokh cat <hello.morph -{ - "name": "hello", - "kind": "chunk", - "build-system": "dummy", - "build-commands": [ - "echo The next command will fail", - "false" - ] -} +name: hello +kind: chunk +build-system: dummy +build-commands: + - echo The next command will fail + - "false" EOF git add hello.morph git commit --quiet -m "Make morphology fail to build." diff --git a/tests.build/build-stratum-with-submodules.script b/tests.build/build-stratum-with-submodules.script index c996e769..015db3f2 100755 --- a/tests.build/build-stratum-with-submodules.script +++ b/tests.build/build-stratum-with-submodules.script @@ -26,14 +26,11 @@ set -eu parent="$DATADIR/parent-repo" mkdir "$parent" cat < "$parent/parent.morph" -{ - "name": "parent", - "kind": "chunk", - "build-system": "manual", - "build-commands": [ - "test -f le-sub/README" - ] -} +name: parent +kind: chunk +build-system: manual +build-commands: + - test -f le-sub/README EOF "$SRCDIR/scripts/run-git-in" "$parent" init --quiet @@ -47,19 +44,14 @@ EOF morphs="$DATADIR/morphs-repo" cat < "$morphs/hello-stratum.morph" -{ - "name": "hello-stratum", - "kind": "stratum", - "chunks": [ - { - "name": "parent", - "repo": "test:parent-repo", - "ref": "master", - "build-depends": [], - "build-mode": "test" - } - ] -} +name: hello-stratum +kind: stratum +chunks: + - name: parent + repo: test:parent-repo + ref: master + build-depends: [] + build-mode: test EOF "$SRCDIR/scripts/run-git-in" "$morphs" add hello-stratum.morph "$SRCDIR/scripts/run-git-in" "$morphs" commit --quiet -m 'foo' diff --git a/tests.build/build-system-autotools.script b/tests.build/build-system-autotools.script index ba5cd32f..2ea53174 100755 --- a/tests.build/build-system-autotools.script +++ b/tests.build/build-system-autotools.script @@ -37,12 +37,10 @@ EOF git add Makefile cat < hello.morph -{ - "name": "hello", - "kind": "chunk", - "build-system": "autotools", - "configure-commands": [] -} +name: hello +kind: chunk +build-system: autotools +configure-commands: [] EOF git add hello.morph git commit --quiet -m "Convert hello to an autotools project" diff --git a/tests.build/build-system-cmake.script b/tests.build/build-system-cmake.script index ab5186d7..570a9af7 100755 --- a/tests.build/build-system-cmake.script +++ b/tests.build/build-system-cmake.script @@ -38,12 +38,11 @@ EOF git add CMakeLists.txt cat < hello.morph -{ - "name": "hello", - "kind": "chunk", - "build-system": "cmake", - "install-commands": ["make DESTDIR=\"\$DESTDIR\" install"] -} +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" diff --git a/tests.build/build-system-cpan.script b/tests.build/build-system-cpan.script index f66d4027..735dac84 100755 --- a/tests.build/build-system-cpan.script +++ b/tests.build/build-system-cpan.script @@ -44,11 +44,9 @@ EOF git add Makefile.PL cat <hello.morph -{ - "name": "hello", - "kind": "chunk", - "build-system": "cpan" -} +name: hello +kind: chunk +build-system: cpan EOF git add hello.morph @@ -57,20 +55,15 @@ git commit --quiet -m 'convert hello into a perl cpan project' # Set 'prefix' of hello to something custom cd "$DATADIR/morphs-repo" cat < hello-stratum.morph -{ - "name": "hello-stratum", - "kind": "stratum", - "chunks": [ - { - "name": "hello", - "repo": "test:chunk-repo", - "ref": "farrokh", - "build-depends": [], - "build-mode": "test", - "prefix": "/" - } - ] -} +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" diff --git a/tests.build/build-system-python-distutils.script b/tests.build/build-system-python-distutils.script index e1dccb4b..9a751491 100755 --- a/tests.build/build-system-python-distutils.script +++ b/tests.build/build-system-python-distutils.script @@ -41,11 +41,9 @@ EOF git add setup.py cat <hello.morph -{ - "name": "hello", - "kind": "chunk", - "build-system": "python-distutils" -} +name: hello +kind: chunk +build-system: python-distutils EOF git add hello.morph @@ -55,20 +53,15 @@ git commit --quiet -m 'convert hello into a python project' # Set 'prefix' of hello to something custom cd "$DATADIR/morphs-repo" cat < hello-stratum.morph -{ - "name": "hello-stratum", - "kind": "stratum", - "chunks": [ - { - "name": "hello", - "repo": "test:chunk-repo", - "ref": "farrokh", - "build-depends": [], - "build-mode": "test", - "prefix": "" - } - ] -} +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" diff --git a/tests.build/build-system-qmake.script b/tests.build/build-system-qmake.script index d9e21fba..b3861936 100755 --- a/tests.build/build-system-qmake.script +++ b/tests.build/build-system-qmake.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2011-2013 Codethink Limited +# Copyright (C) 2011-2014 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,12 +46,11 @@ EOF git add hello.pro cat < hello.morph -{ - "name": "hello", - "kind": "chunk", - "build-system": "qmake", - "install-commands": ["make INSTALL_ROOT=\"\$DESTDIR\" install"] -} +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" diff --git a/tests.build/empty-stratum.script b/tests.build/empty-stratum.script index cb39b94a..19c36558 100755 --- a/tests.build/empty-stratum.script +++ b/tests.build/empty-stratum.script @@ -24,10 +24,8 @@ git checkout --quiet -b empty-stratum # Create empty stratum to test S4585 cat < hello-stratum.morph -{ - "name": "hello-stratum", - "kind": "stratum" -} +name: hello-stratum +kind: stratum EOF sed -i 's/master/empty-stratum/' hello-system.morph git add hello-stratum.morph hello-system.morph diff --git a/tests.build/prefix.script b/tests.build/prefix.script index ca9648c9..209c1a54 100755 --- a/tests.build/prefix.script +++ b/tests.build/prefix.script @@ -24,24 +24,18 @@ set -eu cd "$DATADIR/chunk-repo" git checkout -q master cat <<\EOF > xyzzy.morph -{ - "name": "xyzzy", - "kind": "chunk", - "configure-commands": [ - "echo First chunk: prefix $PREFIX" - ] -} +name: xyzzy +kind: chunk +configure-commands: + - "echo First chunk: prefix $PREFIX" EOF cat <<\EOF > plugh.morph -{ - "name": "plugh", - "kind": "chunk", - "configure-commands": [ - "echo Second chunk: prefix $PREFIX", - "echo Path: $(echo $PATH | grep -o '/plover')" - ] -} +name: plugh +kind: chunk +configure-commands: + - "echo Second chunk: prefix $PREFIX" + - "echo Path: $(echo $PATH | grep -o '/plover')" EOF git add xyzzy.morph @@ -51,29 +45,21 @@ git commit -q -m "Add chunks" # Change stratum to include those two chunks, and use a custom install prefix cd "$DATADIR/morphs-repo" cat < hello-stratum.morph -{ - "name": "hello-stratum", - "kind": "stratum", - "chunks": [ - { - "name": "xyzzy", - "repo": "test:chunk-repo", - "ref": "master", - "build-depends": [], - "build-mode": "test", - "prefix": "/plover" - }, - { - "name": "plugh", - "repo": "test:chunk-repo", - "ref": "master", - "build-mode": "test", - "build-depends": [ - "xyzzy" - ] - } - ] -} +name: hello-stratum +kind: stratum +chunks: + - name: xyzzy + repo: test:chunk-repo + ref: master + build-depends: [] + build-mode: test + prefix: /plover + - name: plugh + repo: test:chunk-repo + ref: master + build-mode: test + build-depends: + - xyzzy EOF git add hello-stratum.morph git commit -q -m "Update stratum" diff --git a/tests.build/setup b/tests.build/setup index 559825b1..833f132d 100755 --- a/tests.build/setup +++ b/tests.build/setup @@ -57,19 +57,15 @@ EOF git add hello.c cat < 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" - ] -} +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 @@ -87,33 +83,23 @@ cd "$morphsrepo" git init --quiet cat < hello-stratum.morph -{ - "name": "hello-stratum", - "kind": "stratum", - "chunks": [ - { - "name": "hello", - "repo": "test:chunk-repo", - "ref": "farrokh", - "build-mode": "test", - "build-depends": [] - } - ] -} +name: hello-stratum +kind: stratum +chunks: + - name: hello + repo: test:chunk-repo + ref: farrokh + build-mode: test + build-depends: [] EOF git add hello-stratum.morph cat < hello-system.morph -{ - "name": "hello-system", - "kind": "system", - "arch": "$("$SRCDIR/scripts/test-morph" print-architecture)", - "strata": [ - { - "morph": "hello-stratum", - } - ] -} +name: hello-system +kind: system +arch: $("$SRCDIR/scripts/test-morph" print-architecture) +strata: + - morph: hello-stratum EOF git add hello-system.morph diff --git a/tests.build/setup-build-essential b/tests.build/setup-build-essential index 5674020d..9ffb7774 100755 --- a/tests.build/setup-build-essential +++ b/tests.build/setup-build-essential @@ -28,28 +28,21 @@ EOF chmod +x morph-test-cc cat < "stage1-cc.morph" -{ - "name": "stage1-cc", - "kind": "chunk", - "install-commands": [ - "install -d \"\$DESTDIR\$PREFIX/bin\"", - "install -m 755 morph-test-cc \"\$DESTDIR\$PREFIX/bin/morph-test-cc\"" - ] -} +name: stage1-cc +kind: chunk +install-commands: + - install -d "\$DESTDIR\$PREFIX/bin" + - install -m 755 morph-test-cc "\$DESTDIR\$PREFIX/bin/morph-test-cc" EOF cat < "cc.morph" -{ - "name": "cc", - "kind": "chunk", - "configure-commands": [ - "[ -e ../tools/bin/morph-test-cc ]" - ], - "install-commands": [ - "install -d \"\$DESTDIR\$PREFIX/bin\"", - "install -m 755 morph-test-cc \"\$DESTDIR\$PREFIX/bin/morph-test-cc\"" - ] -} +name: cc +kind: chunk +configure-commands: + - [ -e ../tools/bin/morph-test-cc ] +install-commands: + - install -d "\$DESTDIR\$PREFIX/bin" + - install -m 755 morph-test-cc "\$DESTDIR\$PREFIX/bin/morph-test-cc" EOF git init -q @@ -61,21 +54,16 @@ git commit -q -m "Create compiler chunk" cd "$DATADIR/chunk-repo" git checkout -q farrokh cat < "hello.morph" -{ - "name": "hello", - "kind": "chunk", - "configure-commands": [ - "[ ! -e ../tools/bin/morph-test-cc ]", - "[ -e ../usr/bin/morph-test-cc ]" - ], - "build-commands": [ - "../usr/bin/morph-test-cc > hello" - ], - "install-commands": [ - "install -d \"\$DESTDIR\$PREFIX/bin\"", - "install hello \"\$DESTDIR\$PREFIX/bin/hello\"" - ] -} +name: hello +kind: chunk +configure-commands: + - [ ! -e ../tools/bin/morph-test-cc ] + - [ -e ../usr/bin/morph-test-cc ] +build-commands: + - ../usr/bin/morph-test-cc > hello +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" @@ -85,50 +73,34 @@ git commit -q -m "Make 'hello' require our mock compiler" # artifact, and neither should make it into the system. cd "$DATADIR/morphs-repo" cat < "build-essential.morph" -{ - "name": "build-essential", - "kind": "stratum", - "chunks": [ - { - "name": "stage1-cc", - "repo": "test:cc-repo", - "ref": "master", - "build-depends": [], - "build-mode": "bootstrap", - "prefix": "/tools" - }, - { - "name": "cc", - "repo": "test:cc-repo", - "ref": "master", - "build-depends": [ - "stage1-cc" - ], - "build-mode": "test" - } - ] -} +name: build-essential +kind: stratum +chunks: + - name: stage1-cc + repo: test:cc-repo + ref: master + build-depends: [] + build-mode: bootstrap + prefix: /tools + - name: cc + repo: test:cc-repo + ref: master + build-depends: + - stage1-cc + build-mode: test EOF cat < "hello-stratum.morph" -{ - "name": "hello-stratum", - "kind": "stratum", - "build-depends": [ - { - "morph": "build-essential", - } - ], - "chunks": [ - { - "name": "hello", - "repo": "test:chunk-repo", - "ref": "farrokh", - "build-depends": [], - "build-mode": "test" - } - ] -} +name: hello-stratum +kind: stratum +build-depends: + - morph: build-essential +chunks: + - name: hello + repo: test:chunk-repo + ref: farrokh + build-depends: [] + build-mode: test EOF git add build-essential.morph hello-stratum.morph hello-system.morph diff --git a/tests.build/stratum-overlap-warns.setup b/tests.build/stratum-overlap-warns.setup index 5ebd217c..b969822d 100755 --- a/tests.build/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-2013 Codethink Limited +# Copyright (C) 2011-2014 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 @@ -26,40 +26,32 @@ morphsrepo="$DATADIR/morphs-repo" cd "$morphsrepo" git checkout --quiet -b overlap master cat <hello-stratum.morph -{ - "name": "hello-stratum", - "kind": "stratum", - "chunks": [ - { - "name": "dirs", - "repo": "test:chunk-repo", - "ref": "overlap", - "build-depends": [], - "build-mode": "test" - }, - { - "name": "overlap-foobar", - "repo": "test:chunk-repo", - "ref": "overlap", - "build-depends": ["dirs"], - "build-mode": "test" - }, - { - "name": "overlap-fooqux", - "repo": "test:chunk-repo", - "ref": "overlap", - "build-depends": ["overlap-foobar"], - "build-mode": "test" - }, - { - "name": "overlap-foo-baz", - "repo": "test:chunk-repo", - "ref": "overlap", - "build-depends": ["overlap-fooqux"], - "build-mode": "test" - } - ] -} +name: hello-stratum +kind: stratum +chunks: + - name: dirs + repo: test:chunk-repo + ref: overlap + build-depends: [] + build-mode: test + - name: overlap-foobar + repo: test:chunk-repo + ref: overlap + build-depends: + - dirs + build-mode: test + - name: overlap-fooqux + repo: test:chunk-repo + ref: overlap + build-depends: + - overlap-foobar + build-mode: test + - name: overlap-foo-baz + repo: test:chunk-repo + ref: overlap + build-depends: + - overlap-fooqux + build-mode: test EOF sed -i 's/master/overlap/' hello-system.morph git add hello-stratum.morph hello-system.morph @@ -69,53 +61,41 @@ cd "$chunkrepo" git checkout --quiet -b overlap master cat <dirs.morph -{ - "name": "dirs", - "kind": "chunk", - "install-commands": [ - "mkdir -p \$DESTDIR/bin", - "ln -s .. \$DESTDIR/usr" - ] -} +name: dirs +kind: chunk +install-commands: + - mkdir -p "\$DESTDIR/bin" + - ln -s .. "\$DESTDIR/usr" EOF git add dirs.morph cat <overlap-foo-baz.morph -{ - "name": "overlap-foo-baz", - "kind": "chunk", - "install-commands": [ - "mkdir -p \$DESTDIR/bin", - "for f in foo bar baz; do echo echo \$f >\$DESTDIR/bin/\$f; done" - ] -} +name: overlap-foo-baz +kind: chunk +install-commands: + - mkdir -p "\$DESTDIR/bin" + - for f in foo bar baz; do echo echo \$f >"\$DESTDIR/bin/\$f"; done EOF git add overlap-foo-baz.morph cat <overlap-foobar.morph -{ - "name": "overlap-foobar", - "kind": "chunk", - "install-commands": [ - "mkdir -p \$DESTDIR/usr/bin \$DESTDIR/bin", - "echo echo foobar >\$DESTDIR/usr/bin/foobar", - "ln -s /usr/bin/foobar \$DESTDIR/bin/foo", - "ln -s /usr/bin/foobar \$DESTDIR/bin/bar" - ] -} +name: overlap-foobar +kind: chunk +install-commands: + - mkdir -p "\$DESTDIR/usr/bin" "\$DESTDIR/bin" + - echo echo foobar >"\$DESTDIR/usr/bin/foobar" + - ln -s /usr/bin/foobar "\$DESTDIR/bin/foo" + - ln -s /usr/bin/foobar "\$DESTDIR/bin/bar" EOF git add overlap-foobar.morph cat <overlap-fooqux.morph -{ - "name": "overlap-fooqux", - "kind": "chunk", - "install-commands": [ - "mkdir -p \$DESTDIR/usr/bin \$DESTDIR/bin", - "for f in qux fooqux; do echo echo \$f >\$DESTDIR/usr/bin/\$f; done", - "ln -s /usr/bin/fooqux \$DESTDIR/bin/foo" - ] -} +name: overlap-fooqux +kind: chunk +install-commands: + - mkdir -p "\$DESTDIR/usr/bin" "\$DESTDIR/bin" + - for f in qux fooqux; do echo echo \$f >"\$DESTDIR/usr/bin/\$f"; done + - ln -s /usr/bin/fooqux "\$DESTDIR/bin/foo" EOF git add overlap-fooqux.morph -- cgit v1.2.1