summaryrefslogtreecommitdiff
path: root/scripts/test-morph
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2012-10-25 11:06:57 +0100
committerSam Thursfield <sam.thursfield@codethink.co.uk>2012-10-26 13:43:58 +0100
commitc67afe0431f4abfc16eb9994239c3f21b56ad303 (patch)
tree4dcc13c491a68211e375f8ceda0f04491d66a4af /scripts/test-morph
parent2bcc7ba44734c73a4a80b40b80a42b1376af5e00 (diff)
downloadmorph-c67afe0431f4abfc16eb9994239c3f21b56ad303.tar.gz
Write metadata for the rootfs itself into the rootfs
This makes it easier to identify what version of a system we are running. Tests are updated to check inside the contents of the rootfs we created, and the code to mount the rootfs as a loopback device was extracted out into tests.as-root/lib
Diffstat (limited to 'scripts/test-morph')
-rwxr-xr-xscripts/test-morph24
1 files changed, 21 insertions, 3 deletions
diff --git a/scripts/test-morph b/scripts/test-morph
index 2b7fb57d..fb3e2cd4 100755
--- a/scripts/test-morph
+++ b/scripts/test-morph
@@ -27,7 +27,25 @@ set -eu
# distributed builds, which invoke morph as a sub-process.
export PATH="$SRCDIR:$PATH"
-"$SRCDIR/scripts/cmd-filter" "$SRCDIR/morph" --no-default-config \
- --tarball-server= --cache-server= \
- --config="$DATADIR/morph.conf" "$@"
+if [ "$1" = "--find-system-artifact" ]; then
+ shift
+ "$SRCDIR/morph" --no-default-config \
+ --tarball-server= --cache-server= \
+ --config="$DATADIR/morph.conf" --verbose "$@" > $DATADIR/stdout
+
+ ARTIFACT=$(grep "system \S\+-rootfs is cached at" "$DATADIR/stdout" | \
+ sed -nre "s/^.*system \S+-rootfs is cached at (\S+)$/\1/p")
+ rm "$DATADIR/stdout"
+
+ if [ ! -e "$ARTIFACT" ]; then
+ echo "Unable to find rootfs artifact: $ARTIFACT" 1>&2
+ exit 1
+ fi
+
+ echo $ARTIFACT
+else
+ "$SRCDIR/scripts/cmd-filter" "$SRCDIR/morph" --no-default-config \
+ --tarball-server= --cache-server= \
+ --config="$DATADIR/morph.conf" "$@"
+fi