summaryrefslogtreecommitdiff
path: root/yarns
diff options
context:
space:
mode:
authorDaniel Firth <dan.firth@codethink.co.uk>2013-10-28 17:56:23 +0000
committerDaniel Firth <dan.firth@codethink.co.uk>2013-10-30 12:20:00 +0000
commit6a315135ac6273c90f7dc35b7d4c49da158be487 (patch)
treec014c050030311112f32e97fe58197a7c7c062d1 /yarns
parent9f22da771ebfec1901d0fe90f87b1960aa578748 (diff)
downloadmorph-6a315135ac6273c90f7dc35b7d4c49da158be487.tar.gz
Added scenario test for preventing cross-building
Diffstat (limited to 'yarns')
-rw-r--r--yarns/architecture.yarn11
-rw-r--r--yarns/implementations.yarn25
-rw-r--r--yarns/morph.shell-lib4
3 files changed, 39 insertions, 1 deletions
diff --git a/yarns/architecture.yarn b/yarns/architecture.yarn
new file mode 100644
index 00000000..66329c81
--- /dev/null
+++ b/yarns/architecture.yarn
@@ -0,0 +1,11 @@
+Morph Cross-Building Tests
+==========================
+
+ SCENARIO building a system for a different architecture
+ GIVEN a workspace
+ AND a git server
+ AND a system called base-system-testarch for architecture testarch in the git server
+ WHEN checking out the master system branch
+ AND attempting to build the system base-system-testarch in branch master
+ THEN morph failed
+ AND the build error message includes the string "Are you trying to cross-build?"
diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn
index d03e7ae0..7efff54e 100644
--- a/yarns/implementations.yarn
+++ b/yarns/implementations.yarn
@@ -128,6 +128,18 @@ another to hold a chunk.
mkdir "$DATADIR/cache"
mkdir "$DATADIR/tmp"
+ IMPLEMENTS GIVEN a system called (\S+) for architecture (\S+) in the git server
+ cat << EOF > "$DATADIR/gits/morphs/$MATCH_1.morph"
+ arch: $MATCH_2
+ configuration-extensions: []
+ description: A system called $MATCH_1 for architectures $MATCH_2
+ kind: system
+ name: $MATCH_1
+ strata: []
+ EOF
+ run_in "$DATADIR/gits/morphs" git add "$MATCH_1.morph"
+ run_in "$DATADIR/gits/morphs" git commit -m "Added $MATCH_1 morphology."
+
Morphologies need to support having a null ref, which means look for the
stratum in the same repository and ref. Testing this requires different
morphologies.
@@ -434,6 +446,19 @@ Generating a manifest.
die "Output isn't what we expect"
fi
+Implementation sections for building
+====================================
+
+ IMPLEMENTS WHEN attempting to build the system (\S+) in branch (\S+)
+ cd "$DATADIR/workspace/$MATCH_2"
+ attempt_morph build "$MATCH_1"
+
+Implementations sections for reading error messages
+===================================================
+
+ IMPLEMENTS THEN the (init|build|checkout|branch) error message includes the string "(.*)"
+ grep "$MATCH_2" "$DATADIR/result-$MATCH_1"
+
IMPLEMENTS for test file and directory handling
===============================================
diff --git a/yarns/morph.shell-lib b/yarns/morph.shell-lib
index 448c60ce..58521ee8 100644
--- a/yarns/morph.shell-lib
+++ b/yarns/morph.shell-lib
@@ -31,7 +31,9 @@
run_morph()
{
"${SRCDIR:-.}"/morph \
- --no-default-config --config "$DATADIR/morph.conf" "$@"
+ --cachedir-min-space=0 --tempdir-min-space=0 \
+ --no-default-config --config "$DATADIR/morph.conf" "$@" \
+ 2> "$DATADIR/result-$1"
}