summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2014-02-14 13:24:07 (GMT)
committerRichard Maw <richard.maw@codethink.co.uk>2014-02-14 13:40:27 (GMT)
commitd036610974f229a806d682c6d051c299f6396d2f (patch)
treee537cb29fa6b913c98106a2d5d3c37af4fd157ee
parentec9c9632970dc817a13ab954c3e4d86ad8731527 (diff)
downloadmorph-d036610974f229a806d682c6d051c299f6396d2f.tar.gz
yarns: Ensure machine altered morphologies don't include repo/ref
-rwxr-xr-xscripts/yaml-extract4
-rw-r--r--yarns/branches-workspaces.yarn22
-rw-r--r--yarns/implementations.yarn7
3 files changed, 32 insertions, 1 deletions
diff --git a/scripts/yaml-extract b/scripts/yaml-extract
index 5a945b6..6f55e62 100755
--- a/scripts/yaml-extract
+++ b/scripts/yaml-extract
@@ -28,7 +28,7 @@
# values for missing fields (e.g., the morph field if name is given).
# Construct your tests accordingly.
-# Copyright (C) 2013 Codethink Limited
+# Copyright (C) 2013-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
@@ -52,6 +52,8 @@ with open(sys.argv[1]) as f:
obj = yaml.safe_load(f)
for thing in sys.argv[2:]:
if type(obj) == dict:
+ if thing not in obj:
+ raise Exception("Object does not contain %s" % thing)
obj = obj[thing]
elif type(obj) == list:
if '=' in thing:
diff --git a/yarns/branches-workspaces.yarn b/yarns/branches-workspaces.yarn
index 15d31cb..5b7d5c6 100644
--- a/yarns/branches-workspaces.yarn
+++ b/yarns/branches-workspaces.yarn
@@ -197,6 +197,12 @@ purposes.
THEN in branch foo, stratum test-stratum refs test-chunk in foo
AND the edited chunk test:test-chunk has git branch foo
+Editing a morphology should not cause it to start having repo or ref
+fields when referring to strata, when it didn't before.
+
+ AND in branch foo, system test-system refers to test-stratum without repo
+ AND in branch foo, system test-system refers to test-stratum without ref
+
Morph edit should only work with a system argument.
SCENARIO morph edit errors when supplied only a stratum and chunk as arguments
@@ -267,9 +273,25 @@ unpetrify and verify that we have all the same refs as before.
AND remembering all refs in foo
AND petrifying foo
THEN foo is petrified
+
+Petrifying a morphology should not cause it to start having repo or ref
+fields when referring to strata, when it didn't before.
+
+ AND in branch foo, system test-system refers to test-stratum without repo
+ AND in branch foo, system test-system refers to test-stratum without ref
+
+Unpertify must put the morphologies back in the same logical state they
+were in before.
+
WHEN unpetrifying foo
THEN foo refs are as remembered
+Unpetrifying a morphology should not cause it to start having repo or
+ref fields when referring to strata, when it didn't before.
+
+ AND in branch foo, system test-system refers to test-stratum without repo
+ AND in branch foo, system test-system refers to test-stratum without ref
+
Tagging system branches
-----------------------
diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn
index bf6cec5..ccebabc 100644
--- a/yarns/implementations.yarn
+++ b/yarns/implementations.yarn
@@ -416,6 +416,13 @@ Editing morphologies with `morph edit`.
echo "$MATCH_4" > "$DATADIR/ref.wanted"
diff -u "$DATADIR/ref.wanted" "$DATADIR/ref.actual"
+ IMPLEMENTS THEN in branch (\S+), (system|stratum) (\S+) refers to (\S+) without (\S+)
+ if [ $MATCH_2 == system ]; then field=strata; else field=build-depends; fi
+ { ! "$SRCDIR/scripts/yaml-extract" \
+ "$DATADIR/workspace/$MATCH_1/test:morphs/$MATCH_3.morph" \
+ "$field" name="$MATCH_4" "$MATCH_5"; } 2>&1 |
+ grep -qFe "Object does not contain $MATCH_5"
+
IMPLEMENTS WHEN the user edits the stratum (\S+) in the system (\S+) in branch (\S+)
cd "$DATADIR/workspace/$MATCH_3/test:morphs"
run_morph edit "$MATCH_2" "$MATCH_1"