summaryrefslogtreecommitdiff
path: root/tests.build
diff options
context:
space:
mode:
Diffstat (limited to 'tests.build')
-rwxr-xr-xtests.build/build-chunk-writes-log.script35
-rwxr-xr-xtests.build/build-stratum-with-submodules.script15
-rw-r--r--tests.build/build-stratum-with-submodules.stdout2
-rwxr-xr-xtests.build/build-system-autotools.script13
-rw-r--r--tests.build/build-system-autotools.stdout3
-rwxr-xr-xtests.build/build-system-cmake.script14
-rw-r--r--tests.build/build-system-cmake.stdout2
-rwxr-xr-xtests.build/build-system-cpan.script14
-rw-r--r--tests.build/build-system-cpan.stdout1
-rwxr-xr-xtests.build/build-system-python-distutils.script19
-rw-r--r--tests.build/build-system-python-distutils.stdout6
-rwxr-xr-xtests.build/build-system-qmake.script8
-rw-r--r--tests.build/build-system-qmake.stdout8
-rwxr-xr-xtests.build/build-system.script35
-rw-r--r--tests.build/build-system.stdout2
-rwxr-xr-xtests.build/cross-bootstrap.script4
-rwxr-xr-xtests.build/morphless-chunks.script13
-rw-r--r--tests.build/morphless-chunks.stdout0
-rw-r--r--tests.build/only-build-systems.stderr4
-rwxr-xr-xtests.build/prefix.script14
-rw-r--r--tests.build/prefix.stdout8
-rwxr-xr-xtests.build/rebuild-cached-stratum.script7
-rw-r--r--tests.build/rebuild-cached-stratum.stdout10
23 files changed, 232 insertions, 5 deletions
diff --git a/tests.build/build-chunk-writes-log.script b/tests.build/build-chunk-writes-log.script
new file mode 100755
index 00000000..5f257571
--- /dev/null
+++ b/tests.build/build-chunk-writes-log.script
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# Copyright (C) 2011-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/>.
+
+
+## Build log should be saved when a chunk is built.
+
+set -eu
+
+"$SRCDIR/scripts/test-morph" build-morphology \
+ test:morphs-repo master hello-system
+
+refsdir="$DATADIR/cache/artifacts/repo/refs/heads"
+chunks=$(find "$refsdir" -name '*-misc' | sed -e "s:$refsdir::" -e "s:-misc::")
+found=false
+
+for chunk in $chunks;
+do
+ [ -e "$DATADIR/cache/artifacts/$chunk".build-log ] || continue
+ found=true
+ break
+done
+"$found"
diff --git a/tests.build/build-stratum-with-submodules.script b/tests.build/build-stratum-with-submodules.script
index a2a1ddc9..d1daa292 100755
--- a/tests.build/build-stratum-with-submodules.script
+++ b/tests.build/build-stratum-with-submodules.script
@@ -56,7 +56,20 @@ EOF
"$SRCDIR/scripts/run-git-in" "$morphs" commit --quiet -m 'foo'
-# Now build
+# Now build and verify we got a stratum.
"$SRCDIR/scripts/test-morph" build-morphology \
test:morphs-repo master hello-system
+
+cd "$DATADIR"
+"$SRCDIR/scripts/test-morph" init workspace
+cd "$DATADIR/workspace"
+"$SRCDIR/scripts/test-morph" checkout test:morphs-repo master
+cd "$DATADIR/workspace/master/test/morphs-repo"
+
+ref=`"$SRCDIR/scripts/test-morph" query-cache hello-system.morph`
+ostree --repo="$DATADIR/cache/artifacts/repo" checkout --fsync=false \
+ "$ref" "$DATADIR/$ref"
+find $DATADIR/$ref/* | sed "s:^$DATADIR/$ref/::" | LC_ALL=C sort |
+sed '/^\.\/./s:^\./::' | grep -v '^baserock'
+
diff --git a/tests.build/build-stratum-with-submodules.stdout b/tests.build/build-stratum-with-submodules.stdout
new file mode 100644
index 00000000..864f253f
--- /dev/null
+++ b/tests.build/build-stratum-with-submodules.stdout
@@ -0,0 +1,2 @@
+etc
+etc/os-release
diff --git a/tests.build/build-system-autotools.script b/tests.build/build-system-autotools.script
index 936fa490..7ecb31be 100755
--- a/tests.build/build-system-autotools.script
+++ b/tests.build/build-system-autotools.script
@@ -46,3 +46,16 @@ git commit --quiet -m "Convert hello to an autotools project"
"$SRCDIR/scripts/test-morph" build-morphology \
test:morphs-repo master hello-system
+
+cd "$DATADIR"
+"$SRCDIR/scripts/test-morph" init workspace
+cd "$DATADIR/workspace"
+"$SRCDIR/scripts/test-morph" checkout test:morphs-repo master
+cd "$DATADIR/workspace/master/test/morphs-repo"
+
+refs=`"$SRCDIR/scripts/test-morph" query-cache hello-system.morph hello`
+for ref in $refs
+do
+ ostree --repo="$DATADIR/cache/artifacts/repo" checkout --fsync=false "$ref" "$DATADIR/$ref"
+ find $DATADIR/$ref/* | sed "s:^$DATADIR/$ref/::"
+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
new file mode 100644
index 00000000..6dd6cda7
--- /dev/null
+++ b/tests.build/build-system-autotools.stdout
@@ -0,0 +1,3 @@
+bin
+bin/hello
+etc
diff --git a/tests.build/build-system-cmake.script b/tests.build/build-system-cmake.script
index b848aab9..b761a5d5 100755
--- a/tests.build/build-system-cmake.script
+++ b/tests.build/build-system-cmake.script
@@ -48,3 +48,17 @@ git commit --quiet -m "Convert hello to a cmake project"
"$SRCDIR/scripts/test-morph" build-morphology \
test:morphs-repo master hello-system
+
+cd "$DATADIR"
+"$SRCDIR/scripts/test-morph" init workspace
+cd "$DATADIR/workspace"
+"$SRCDIR/scripts/test-morph" checkout test:morphs-repo master
+cd "$DATADIR/workspace/master/test/morphs-repo"
+
+refs=`"$SRCDIR/scripts/test-morph" query-cache hello-system.morph hello`
+for ref in $refs
+do
+ ostree --repo="$DATADIR/cache/artifacts/repo" checkout --fsync=false \
+ "$ref" "$DATADIR/$ref"
+ find $DATADIR/$ref/* | sed "s:^$DATADIR/$ref/::"
+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
new file mode 100644
index 00000000..861fd1fa
--- /dev/null
+++ b/tests.build/build-system-cmake.stdout
@@ -0,0 +1,2 @@
+usr/bin
+usr/bin/hello
diff --git a/tests.build/build-system-cpan.script b/tests.build/build-system-cpan.script
index b686de34..e6bd579c 100755
--- a/tests.build/build-system-cpan.script
+++ b/tests.build/build-system-cpan.script
@@ -70,3 +70,17 @@ git commit -q -m "Set custom install prefix for hello"
"$SRCDIR/scripts/test-morph" build-morphology \
test:morphs-repo master hello-system
+
+cd "$DATADIR"
+"$SRCDIR/scripts/test-morph" init workspace
+cd "$DATADIR/workspace"
+"$SRCDIR/scripts/test-morph" checkout test:morphs-repo master
+cd "$DATADIR/workspace/master/test/morphs-repo"
+
+refs=`"$SRCDIR/scripts/test-morph" query-cache hello-system.morph hello`
+for ref in $refs
+do
+ ostree --repo="$DATADIR/cache/artifacts/repo" checkout --fsync=false \
+ "$ref" "$DATADIR/$ref"
+ find $DATADIR/$ref/* | sed "s:^$DATADIR/$ref/::"
+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
new file mode 100644
index 00000000..180e949b
--- /dev/null
+++ b/tests.build/build-system-cpan.stdout
@@ -0,0 +1 @@
+bin/hello
diff --git a/tests.build/build-system-python-distutils.script b/tests.build/build-system-python-distutils.script
index d8210319..44418655 100755
--- a/tests.build/build-system-python-distutils.script
+++ b/tests.build/build-system-python-distutils.script
@@ -68,3 +68,22 @@ git commit -q -m "Set custom install prefix for hello"
"$SRCDIR/scripts/test-morph" build-morphology \
test:morphs-repo master hello-system
+
+cd "$DATADIR"
+"$SRCDIR/scripts/test-morph" init workspace
+cd "$DATADIR/workspace"
+"$SRCDIR/scripts/test-morph" checkout test:morphs-repo master
+cd "$DATADIR/workspace/master/test/morphs-repo"
+
+refs=`"$SRCDIR/scripts/test-morph" query-cache hello-system.morph hello`
+for ref in $refs
+do
+ ostree --repo="$DATADIR/cache/artifacts/repo" checkout --fsync=false \
+ "$ref" "$DATADIR/$ref"
+ find $DATADIR/$ref/* | sed "s:^$DATADIR/$ref/::"
+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
new file mode 100644
index 00000000..a2ceb5ad
--- /dev/null
+++ b/tests.build/build-system-python-distutils.stdout
@@ -0,0 +1,6 @@
+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
index b477de4b..d430fba7 100755
--- a/tests.build/build-system-qmake.script
+++ b/tests.build/build-system-qmake.script
@@ -22,6 +22,7 @@ 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
@@ -55,3 +56,10 @@ 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
new file mode 100644
index 00000000..ccf80a86
--- /dev/null
+++ b/tests.build/build-system-qmake.stdout
@@ -0,0 +1,8 @@
+.chunk.hello:
+./
+baserock/
+baserock/hello.meta
+usr/
+usr/bin/
+usr/bin/hello
+
diff --git a/tests.build/build-system.script b/tests.build/build-system.script
new file mode 100755
index 00000000..d3e338cf
--- /dev/null
+++ b/tests.build/build-system.script
@@ -0,0 +1,35 @@
+#!/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/>.
+
+
+## Test building a simple system.
+
+set -eu
+
+"$SRCDIR/scripts/test-morph" build-morphology \
+ test:morphs-repo master hello-system
+
+cd "$DATADIR"
+"$SRCDIR/scripts/test-morph" init workspace
+cd "$DATADIR/workspace"
+"$SRCDIR/scripts/test-morph" checkout test:morphs-repo master
+cd "$DATADIR/workspace/master/test/morphs-repo"
+
+ref=`"$SRCDIR/scripts/test-morph" query-cache hello-system.morph`
+ostree --repo="$DATADIR/cache/artifacts/repo" checkout --fsync=false \
+ "$ref" "$DATADIR/$ref"
+find $DATADIR/$ref/* | sed "s:^$DATADIR/$ref/::" | LC_ALL=C sort |
+sed '/^\.\/./s:^\./::' | grep -v '^baserock'
diff --git a/tests.build/build-system.stdout b/tests.build/build-system.stdout
new file mode 100644
index 00000000..864f253f
--- /dev/null
+++ b/tests.build/build-system.stdout
@@ -0,0 +1,2 @@
+etc
+etc/os-release
diff --git a/tests.build/cross-bootstrap.script b/tests.build/cross-bootstrap.script
index 6bab1659..eb9ade34 100755
--- a/tests.build/cross-bootstrap.script
+++ b/tests.build/cross-bootstrap.script
@@ -20,11 +20,11 @@
set -eu
-"$SRCDIR/tests.build/setup-build-essential"
-
# cross-bootstrap needs rewriting for OSTree
exit 0
+"$SRCDIR/tests.build/setup-build-essential"
+
"$SRCDIR/scripts/test-morph" cross-bootstrap \
$("$SRCDIR/scripts/test-morph" print-architecture) \
test:morphs-repo master hello-system
diff --git a/tests.build/morphless-chunks.script b/tests.build/morphless-chunks.script
index b46fa635..f0eb1518 100755
--- a/tests.build/morphless-chunks.script
+++ b/tests.build/morphless-chunks.script
@@ -40,3 +40,16 @@ git commit -q -m "Convert hello into an autodetectable chunk"
"$SRCDIR/scripts/test-morph" build-morphology \
test:morphs-repo master hello-system
+
+cd "$DATADIR"
+"$SRCDIR/scripts/test-morph" init workspace
+cd "$DATADIR/workspace"
+"$SRCDIR/scripts/test-morph" checkout test:morphs-repo master
+cd "$DATADIR/workspace/master/test/morphs-repo"
+
+refs=`"$SRCDIR/scripts/test-morph" query-cache hello-system.morph hello`
+for ref in $refs
+do
+ ostree --repo="$DATADIR/cache/artifacts/repo" checkout --fsync=false \
+ "$ref" "$DATADIR/$ref"
+done | cat >/dev/null
diff --git a/tests.build/morphless-chunks.stdout b/tests.build/morphless-chunks.stdout
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests.build/morphless-chunks.stdout
diff --git a/tests.build/only-build-systems.stderr b/tests.build/only-build-systems.stderr
index ba7339d2..ac24ab25 100644
--- a/tests.build/only-build-systems.stderr
+++ b/tests.build/only-build-systems.stderr
@@ -1,2 +1,2 @@
-ERROR: Building a stratum directly is not supported
-ERROR: Building a chunk directly is not supported
+ERROR: In order to build this stratum directly, please give the filename of the system which contains it, and the name of the stratum. See `morph build --help` for more information.
+ERROR: In order to build this chunk directly, please give the filename of the system which contains it, and the name of the chunk. See `morph build --help` for more information.
diff --git a/tests.build/prefix.script b/tests.build/prefix.script
index 75c91200..a87671c5 100755
--- a/tests.build/prefix.script
+++ b/tests.build/prefix.script
@@ -65,3 +65,17 @@ git commit -q -m "Update stratum"
"$SRCDIR/scripts/test-morph" build-morphology \
test:morphs-repo master hello-system
+
+cd "$DATADIR"
+"$SRCDIR/scripts/test-morph" init workspace
+cd "$DATADIR/workspace"
+"$SRCDIR/scripts/test-morph" checkout test:morphs-repo master
+
+cd "$DATADIR/workspace/master/test/morphs-repo"
+test_morph="$SRCDIR/scripts/test-morph"
+first_chunk=$("$test_morph" query-cache hello-system.morph xyzzy | head -n1 |
+ cut -c -64)
+second_chunk=$("$test_morph" query-cache hello-system.morph plugh | head -n1 |
+ cut -c -64)
+cd "$DATADIR/cache/artifacts"
+cat $first_chunk.build-log $second_chunk.build-log
diff --git a/tests.build/prefix.stdout b/tests.build/prefix.stdout
new file mode 100644
index 00000000..80c18fae
--- /dev/null
+++ b/tests.build/prefix.stdout
@@ -0,0 +1,8 @@
+# configure
+# # echo First chunk: prefix $PREFIX
+First chunk: prefix /plover
+# configure
+# # echo Second chunk: prefix $PREFIX
+Second chunk: prefix /usr
+# # echo Path: $(echo $PATH | grep -o '/plover')
+Path: /plover
diff --git a/tests.build/rebuild-cached-stratum.script b/tests.build/rebuild-cached-stratum.script
index bdbe193d..dacd441f 100755
--- a/tests.build/rebuild-cached-stratum.script
+++ b/tests.build/rebuild-cached-stratum.script
@@ -40,6 +40,9 @@ cache="$DATADIR/cache/artifacts"
# Build the first time.
"$SRCDIR/scripts/test-morph" build-morphology \
test:morphs-repo rebuild-cached-stratum hello-system
+echo "first build:"
+(cd "$cache" && ls *hello-stratum-* | sed 's/^[^.]*\./ /' |
+ LC_ALL=C sort -u)
# Change the chunk.
(cd "$DATADIR/chunk-repo" &&
@@ -49,3 +52,7 @@ cache="$DATADIR/cache/artifacts"
# Rebuild.
"$SRCDIR/scripts/test-morph" build-morphology \
test:morphs-repo rebuild-cached-stratum hello-system
+echo "second build:"
+(cd "$cache" && ls *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
new file mode 100644
index 00000000..7a61bc55
--- /dev/null
+++ b/tests.build/rebuild-cached-stratum.stdout
@@ -0,0 +1,10 @@
+first build:
+ stratum.hello-stratum-devel
+ stratum.hello-stratum-devel.meta
+ stratum.hello-stratum-runtime
+ stratum.hello-stratum-runtime.meta
+second build:
+ stratum.hello-stratum-devel
+ stratum.hello-stratum-devel.meta
+ stratum.hello-stratum-runtime
+ stratum.hello-stratum-runtime.meta