summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2015-04-13 14:13:02 +0000
committerAdam Coldrick <adam.coldrick@codethink.co.uk>2015-04-13 14:13:02 +0000
commitdf621335702009867ed0310d080cad60948dd3a0 (patch)
tree4321efe78cb357dbd0d7d3becc0f0e0c71ed89d2
parent39d1d623fa27417c1494f4dc82a2049cc60ce802 (diff)
downloadmorph-df621335702009867ed0310d080cad60948dd3a0.tar.gz
Revert "cmdtests: We can no longer meaningfully look at chunks in the cache"
This reverts commit 826e49e2791d4c45e4902396a4a59836290dc175.
-rwxr-xr-xtests.build/build-chunk-writes-log.script37
-rwxr-xr-xtests.build/build-stratum-with-submodules.script6
-rw-r--r--tests.build/build-stratum-with-submodules.stdout3
-rwxr-xr-xtests.build/build-system-autotools.script5
-rw-r--r--tests.build/build-system-autotools.stdout3
-rwxr-xr-xtests.build/build-system-cmake.script5
-rw-r--r--tests.build/build-system-cmake.stdout2
-rwxr-xr-xtests.build/build-system-cpan.script5
-rw-r--r--tests.build/build-system-cpan.stdout1
-rwxr-xr-xtests.build/build-system-python-distutils.script10
-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.script26
-rw-r--r--tests.build/build-system.stdout5
-rwxr-xr-xtests.build/cross-bootstrap.script3
-rwxr-xr-xtests.build/morphless-chunks.script5
-rw-r--r--tests.build/morphless-chunks.stdout0
-rwxr-xr-xtests.build/prefix.script5
-rw-r--r--tests.build/prefix.stdout8
-rwxr-xr-xtests.build/rebuild-cached-stratum.script7
-rw-r--r--tests.build/rebuild-cached-stratum.stdout22
22 files changed, 176 insertions, 4 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..e636924e
--- /dev/null
+++ b/tests.build/build-chunk-writes-log.script
@@ -0,0 +1,37 @@
+#!/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
+
+SOURCES="$DATADIR/cached-sources"
+find "$DATADIR/cache/artifacts" -name '*.chunk.*' |
+ sed 's|\.chunk\..*||' | sort -u >"$SOURCES"
+
+found=false
+# list of sources in cache is not piped because while loop changes variable
+while read source; do
+ [ -e "$source".build-log ] || continue
+ found=true
+ break
+done <"$SOURCES"
+"$found"
+
diff --git a/tests.build/build-stratum-with-submodules.script b/tests.build/build-stratum-with-submodules.script
index a2a1ddc9..bd6b97ce 100755
--- a/tests.build/build-stratum-with-submodules.script
+++ b/tests.build/build-stratum-with-submodules.script
@@ -56,7 +56,11 @@ 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
+
+system=$(ls "$DATADIR/cache/artifacts/"*hello-system-rootfs)
+tar tf $system | 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..d4d03e13
--- /dev/null
+++ b/tests.build/build-stratum-with-submodules.stdout
@@ -0,0 +1,3 @@
+./
+etc/
+etc/os-release
diff --git a/tests.build/build-system-autotools.script b/tests.build/build-system-autotools.script
index 936fa490..710a8f98 100755
--- a/tests.build/build-system-autotools.script
+++ b/tests.build/build-system-autotools.script
@@ -46,3 +46,8 @@ 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
new file mode 100644
index 00000000..683441c9
--- /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..fe02f9dc 100755
--- a/tests.build/build-system-cmake.script
+++ b/tests.build/build-system-cmake.script
@@ -48,3 +48,8 @@ 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
new file mode 100644
index 00000000..3410b113
--- /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..103d5466 100755
--- a/tests.build/build-system-cpan.script
+++ b/tests.build/build-system-cpan.script
@@ -70,3 +70,8 @@ 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
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..e5c0ea74 100755
--- a/tests.build/build-system-python-distutils.script
+++ b/tests.build/build-system-python-distutils.script
@@ -68,3 +68,13 @@ 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
new file mode 100644
index 00000000..4d4c3a1e
--- /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..0180939a
--- /dev/null
+++ b/tests.build/build-system.script
@@ -0,0 +1,26 @@
+#!/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
+
+system=$(ls "$DATADIR/cache/artifacts/"*hello-system-rootfs)
+tar tf $system | 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..4d0fac2f
--- /dev/null
+++ b/tests.build/build-system.stdout
@@ -0,0 +1,5 @@
+./
+bin/
+bin/hello
+etc/
+etc/os-release
diff --git a/tests.build/cross-bootstrap.script b/tests.build/cross-bootstrap.script
index 6bab1659..245c2a13 100755
--- a/tests.build/cross-bootstrap.script
+++ b/tests.build/cross-bootstrap.script
@@ -22,9 +22,6 @@ set -eu
"$SRCDIR/tests.build/setup-build-essential"
-# cross-bootstrap needs rewriting for OSTree
-exit 0
-
"$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..5b19bc4a 100755
--- a/tests.build/morphless-chunks.script
+++ b/tests.build/morphless-chunks.script
@@ -40,3 +40,8 @@ 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
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests.build/morphless-chunks.stdout
diff --git a/tests.build/prefix.script b/tests.build/prefix.script
index 75c91200..140617e1 100755
--- a/tests.build/prefix.script
+++ b/tests.build/prefix.script
@@ -65,3 +65,8 @@ git commit -q -m "Update stratum"
"$SRCDIR/scripts/test-morph" build-morphology \
test:morphs-repo master hello-system
+
+cd "$DATADIR/cache/artifacts"
+first_chunk=$(ls -1 *.chunk.xyzzy-* | head -n1 | cut -c -64)
+second_chunk=$(ls -1 *.chunk.plugh-* | head -n1 | cut -c -64)
+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..e2e0face 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 *.chunk.* *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 *.chunk.* *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..9c53ee60
--- /dev/null
+++ b/tests.build/rebuild-cached-stratum.stdout
@@ -0,0 +1,22 @@
+first build:
+ chunk.hello-bins
+ chunk.hello-devel
+ chunk.hello-doc
+ chunk.hello-libs
+ chunk.hello-locale
+ chunk.hello-misc
+ stratum.hello-stratum-devel
+ stratum.hello-stratum-devel.meta
+ stratum.hello-stratum-runtime
+ stratum.hello-stratum-runtime.meta
+second build:
+ chunk.hello-bins
+ chunk.hello-devel
+ chunk.hello-doc
+ chunk.hello-libs
+ chunk.hello-locale
+ chunk.hello-misc
+ stratum.hello-stratum-devel
+ stratum.hello-stratum-devel.meta
+ stratum.hello-stratum-runtime
+ stratum.hello-stratum-runtime.meta