summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2014-06-19 13:55:30 (GMT)
committerRichard Maw <richard.maw@codethink.co.uk>2014-06-19 16:41:26 (GMT)
commit6da0ef49f8d467a7820c9cf7fcbc13e566f5db47 (patch)
treed82557b841d95a66c788a7473274daea2cab7fc6
parent6b4cb5a5a58d5a536369a20612ff7c656cdd0921 (diff)
downloadmorph-baserock/richardmaw/S11284/morphologies-by-path.tar.gz
yarns: Adapt to put morphologies in subdirsbaserock/richardmaw/S11284/morphologies-by-path
We want to move our morphologies in our definitions repository into subdirectories, so they're more organised. We'd prefer to only refer to morphologies by file path, rather than a name that loosely corresponds to the file path, but we need to support that for backwards compatibility until we can move all of our morphologies into the definitions repository. However, since we want to eventually remove this, and we want to ensure that file paths work, we change the yarn tests to use file paths.
-rwxr-xr-xscripts/edit-morph6
-rw-r--r--yarns/architecture.yarn8
-rw-r--r--yarns/branches-workspaces.yarn22
-rw-r--r--yarns/building.yarn4
-rw-r--r--yarns/deployment.yarn130
-rw-r--r--yarns/implementations.yarn94
-rw-r--r--yarns/regression.yarn37
-rw-r--r--yarns/splitting.yarn99
8 files changed, 198 insertions, 202 deletions
diff --git a/scripts/edit-morph b/scripts/edit-morph
index 2b81747..d0b793a 100755
--- a/scripts/edit-morph
+++ b/scripts/edit-morph
@@ -283,13 +283,9 @@ class EditMorph(cliapp.Application):
return system
def cmd_cluster_init(self, (cluster_file,)):
- suffix = '.morph'
- if not cluster_file.endswith(suffix):
- raise cliapp.AppException(
- "Morphology file path must end with .morph")
with open(cluster_file, 'w') as f:
d = {
- 'name': os.path.basename(cluster_file)[:-len(suffix)],
+ 'name': os.path.splitext(os.path.basename(cluster_file))[0],
'kind': 'cluster',
}
yaml.dump(d, f)
diff --git a/yarns/architecture.yarn b/yarns/architecture.yarn
index 679c804..2240c42 100644
--- a/yarns/architecture.yarn
+++ b/yarns/architecture.yarn
@@ -4,9 +4,9 @@ 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 the test architecture in the git server
+ AND a system called base-system-testarch.morph for the test architecture in the git server
WHEN the user checks out the system branch called master
- AND the user attempts to build the system base-system-testarch in branch master
+ AND the user attempts to build the system base-system-testarch.morph in branch master
THEN morph failed
AND the build error message includes the string "Are you trying to cross-build?"
@@ -17,6 +17,6 @@ Morph Cross-Bootstrap Tests
SCENARIO cross-bootstraping a system for a different architecture
GIVEN a workspace
AND a git server
- AND a system called base-system-testarch for the test architecture in the git server
+ AND a system called base-system-testarch.morph for the test architecture in the git server
WHEN the user checks out the system branch called master
- THEN the user cross-bootstraps the system base-system-testarch in branch master of repo test:morphs to the arch testarch
+ THEN the user cross-bootstraps the system base-system-testarch.morph in branch master of repo test:morphs to the arch testarch
diff --git a/yarns/branches-workspaces.yarn b/yarns/branches-workspaces.yarn
index 4c5d0ef..96fbbd1 100644
--- a/yarns/branches-workspaces.yarn
+++ b/yarns/branches-workspaces.yarn
@@ -178,21 +178,21 @@ all the refs are unchanged.
GIVEN a workspace
AND a git server
WHEN the user creates a system branch called foo
- THEN in branch foo, stratum test-stratum refs test-chunk in master
+ THEN in branch foo, stratum strata/test-stratum.morph refs test-chunk in master
Edit the chunk. We make use of special knowledge here: `test:test-chunk`
is a chunk repository created in the mocked git server, for testing
purposes.
- WHEN the user edits the chunk test-chunk in the stratum test-stratum in the system test-system in branch foo
- THEN in branch foo, stratum test-stratum refs test-chunk in foo
+ WHEN the user edits the chunk test-chunk in branch foo
+ THEN in branch foo, stratum strata/test-stratum.morph 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
+ AND in branch foo, system systems/test-system.morph refers to test-stratum without repo
+ AND in branch foo, system systems/test-system.morph refers to test-stratum without ref
Status of system branch checkout
--------------------------------
@@ -207,7 +207,7 @@ repositories referenced in the system branch.
WHEN the user creates a system branch called foo
THEN morph reports no outstanding changes in foo
- WHEN the user edits the chunk test-chunk in the stratum test-stratum in the system test-system in branch foo
+ WHEN the user edits the chunk test-chunk in branch foo
THEN morph reports changes in foo in test:morphs only
WHEN creating file foo in test/test-chunk in branch foo
@@ -232,7 +232,7 @@ branch checkout.
GIVEN a workspace
AND a git server
WHEN the user creates a system branch called foo
- AND the user edits the chunk test-chunk in the stratum test-stratum in the system test-system in branch foo
+ AND the user edits the chunk test-chunk in branch foo
AND running shell command in each repo in foo
THEN morph ran command in test/morphs in foo
AND morph ran command in test/test-chunk in foo
@@ -257,8 +257,8 @@ unpetrify and verify that we have all the same refs as before.
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
+ AND in branch foo, system systems/test-system.morph refers to test-stratum without repo
+ AND in branch foo, system systems/test-system.morph refers to test-stratum without ref
Unpetrify must put the morphologies back in the same logical state they
were in before.
@@ -269,8 +269,8 @@ were in before.
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
+ AND in branch foo, system systems/test-system.morph refers to test-stratum without repo
+ AND in branch foo, system systems/test-system.morph refers to test-stratum without ref
Generating a manifest works
diff --git a/yarns/building.yarn b/yarns/building.yarn
index cc45df6..6b90ce6 100644
--- a/yarns/building.yarn
+++ b/yarns/building.yarn
@@ -5,5 +5,5 @@ Morph Building Tests
GIVEN a workspace
AND a git server
WHEN the user checks out the system branch called master
- AND the user creates an uncommitted system morphology called base-system for our architecture in system branch master
- THEN morph build the system base-system of the branch master
+ AND the user creates an uncommitted system morphology called systems/base-system.morph for our architecture in system branch master
+ THEN morph build the system systems/base-system.morph of the branch master
diff --git a/yarns/deployment.yarn b/yarns/deployment.yarn
index b30aa4c..3252647 100644
--- a/yarns/deployment.yarn
+++ b/yarns/deployment.yarn
@@ -5,7 +5,7 @@ Morph Deployment Tests
GIVEN a workspace
AND a git server
WHEN the user checks out the system branch called master
- AND the user attempts to deploy the system test-system in branch master
+ AND the user attempts to deploy the system systems/test-system.morph in branch master
THEN morph failed
AND the deploy error message includes the string "morph deploy is only supported for cluster morphologies"
@@ -13,13 +13,13 @@ Morph Deployment Tests
GIVEN a workspace
AND a git server
WHEN the user checks out the system branch called master
- GIVEN a cluster called test-cluster in system branch master
- AND a system in cluster test-cluster in branch master called test-system
- AND system test-system in cluster test-cluster in branch master builds test-system
- AND system test-system in cluster test-cluster in branch master has deployment type: tar
- AND system test-system in cluster test-cluster in branch master has deployment location: test.tar
- WHEN the user builds the system test-system in branch master
- AND the user attempts to deploy the cluster test-cluster in branch master
+ GIVEN a cluster called test-cluster.morph in system branch master
+ AND a system in cluster test-cluster.morph in branch master called test-system
+ AND system test-system in cluster test-cluster.morph in branch master builds systems/test-system.morph
+ AND system test-system in cluster test-cluster.morph in branch master has deployment type: tar
+ AND system test-system in cluster test-cluster.morph in branch master has deployment location: test.tar
+ WHEN the user builds the system systems/test-system.morph in branch master
+ AND the user attempts to deploy the cluster test-cluster.morph in branch master
THEN morph succeeded
Some deployment types support upgrades, but some do not and Morph needs to make
@@ -29,13 +29,13 @@ this clear.
GIVEN a workspace
AND a git server
WHEN the user checks out the system branch called master
- GIVEN a cluster called test-cluster in system branch master
- AND a system in cluster test-cluster in branch master called test-system
- AND system test-system in cluster test-cluster in branch master builds test-system
- AND system test-system in cluster test-cluster in branch master has deployment type: tar
- AND system test-system in cluster test-cluster in branch master has deployment location: test.tar
- WHEN the user builds the system test-system in branch master
- AND the user attempts to upgrade the cluster test-cluster in branch master
+ GIVEN a cluster called test-cluster.morph in system branch master
+ AND a system in cluster test-cluster.morph in branch master called test-system
+ AND system test-system in cluster test-cluster.morph in branch master builds systems/test-system.morph
+ AND system test-system in cluster test-cluster.morph in branch master has deployment type: tar
+ AND system test-system in cluster test-cluster.morph in branch master has deployment location: test.tar
+ WHEN the user builds the system systems/test-system.morph in branch master
+ AND the user attempts to upgrade the cluster test-cluster.morph in branch master
THEN morph failed
The rawdisk write extension supports both initial deployment and subsequent
@@ -48,15 +48,15 @@ the same code paths as a real upgrade.
GIVEN a workspace
AND a git server
WHEN the user checks out the system branch called master
- GIVEN a cluster called test-cluster in system branch master
- AND a system in cluster test-cluster in branch master called test-system
- AND system test-system in cluster test-cluster in branch master builds test-system
- AND system test-system in cluster test-cluster in branch master has deployment type: rawdisk
- AND system test-system in cluster test-cluster in branch master has deployment location: test.tar
- WHEN the user builds the system test-system in branch master
- AND the user attempts to deploy the cluster test-cluster in branch master with options test-system.DISK_SIZE=20M test-system.VERSION_LABEL=test1
+ GIVEN a cluster called test-cluster.morph in system branch master
+ AND a system in cluster test-cluster.morph in branch master called test-system
+ AND system test-system in cluster test-cluster.morph in branch master builds systems/test-system.morph
+ AND system test-system in cluster test-cluster.morph in branch master has deployment type: rawdisk
+ AND system test-system in cluster test-cluster.morph in branch master has deployment location: test.tar
+ WHEN the user builds the system systems/test-system.morph in branch master
+ AND the user attempts to deploy the cluster test-cluster.morph in branch master with options test-system.DISK_SIZE=20M test-system.VERSION_LABEL=test1
THEN morph succeeded
- WHEN the user attempts to upgrade the cluster test-cluster in branch master with options test-system.VERSION_LABEL=test2
+ WHEN the user attempts to upgrade the cluster test-cluster.morph in branch master with options test-system.VERSION_LABEL=test2
THEN morph succeeded
Nested deployments
@@ -76,23 +76,23 @@ It is convenient to be able to deploy one system inside another.
GIVEN a workspace
AND a git server
WHEN the user checks out the system branch called master
- GIVEN a cluster called test-cluster in system branch master
- AND a system in cluster test-cluster in branch master called test-system
- AND system test-system in cluster test-cluster in branch master builds test-system
- AND system test-system in cluster test-cluster in branch master has deployment type: tar
+ GIVEN a cluster called test-cluster.morph in system branch master
+ AND a system in cluster test-cluster.morph in branch master called test-system
+ AND system test-system in cluster test-cluster.morph in branch master builds systems/test-system.morph
+ AND system test-system in cluster test-cluster.morph in branch master has deployment type: tar
After the usual setup, we also add a subsystem to the cluster.
- GIVEN a subsystem in cluster test-cluster in branch master called test-system.sysroot
- AND subsystem test-system.sysroot in cluster test-cluster in branch master builds test-system
- AND subsystem test-system.sysroot in cluster test-cluster in branch master has deployment type: sysroot
+ GIVEN a subsystem in cluster test-cluster.morph in branch master called test-system.sysroot
+ AND subsystem test-system.sysroot in cluster test-cluster.morph in branch master builds systems/test-system.morph
+ AND subsystem test-system.sysroot in cluster test-cluster.morph in branch master has deployment type: sysroot
We specify the location as a file path, this is relative to the parent
system's extracted rootfs, before it is configured.
- AND subsystem test-system.sysroot in cluster test-cluster in branch master has deployment location: var/lib/sysroots/test-system
- WHEN the user builds the system test-system in branch master
- AND the user attempts to deploy the cluster test-cluster in branch master with options test-system.location="$DATADIR/test.tar"
+ AND subsystem test-system.sysroot in cluster test-cluster.morph in branch master has deployment location: var/lib/sysroots/test-system
+ WHEN the user builds the system systems/test-system.morph in branch master
+ AND the user attempts to deploy the cluster test-cluster.morph in branch master with options test-system.location="$DATADIR/test.tar"
THEN morph succeeded
Morph succeeding alone is not sufficient to check whether it actually
@@ -122,28 +122,28 @@ There's a few ways of creating an initramfs. We could:
GIVEN a workspace
AND a git server
WHEN the user checks out the system branch called master
- GIVEN a cluster called C in system branch master
- AND a system in cluster C in branch master called S
+ GIVEN a cluster called C.morph in system branch master
+ AND a system in cluster C.morph in branch master called S
2.2 needs a nested system that is deployed with the initramfs write
extension.
- GIVEN a subsystem in cluster C in branch master called S.I
- AND subsystem S.I in cluster C in branch master builds test-system
- AND subsystem S.I in cluster C in branch master has deployment type: initramfs
+ GIVEN a subsystem in cluster C.morph in branch master called S.I
+ AND subsystem S.I in cluster C.morph in branch master builds systems/test-system.morph
+ AND subsystem S.I in cluster C.morph in branch master has deployment type: initramfs
The nested system needs to be placed somewhere in the parent. The
traditional place for an initramfs is `/boot`.
- AND subsystem S.I in cluster C in branch master has deployment location: boot/initramfs.gz
+ AND subsystem S.I in cluster C.morph in branch master has deployment location: boot/initramfs.gz
1.1 and 2.2 need the write extension to configure the boot-loader to
use the produced initramfs. Only write extensions that involve creating a disk image care, so we'll use `rawdisk.write`.
- GIVEN system S in cluster C in branch master builds test-system
- AND system S in cluster C in branch master has deployment type: rawdisk
- AND system S in cluster C in branch master has deployment location: test.img
- AND system S in cluster C in branch master has deployment variable: DISK_SIZE=512M
+ GIVEN system S in cluster C.morph in branch master builds systems/test-system.morph
+ AND system S in cluster C.morph in branch master has deployment type: rawdisk
+ AND system S in cluster C.morph in branch master has deployment location: test.img
+ AND system S in cluster C.morph in branch master has deployment variable: DISK_SIZE=512M
Initramfs support is triggered by the `INITRAMFS_PATH` variable. It could have been made automatic, triggering the behaviour if `/boot/initramfs.gz` exists, but:
@@ -162,14 +162,14 @@ For all these reasons, despite there being redundancy in some cases,
we're going to set `INITRAMFS_PATH` to the same as the nested deployment's
location.
- GIVEN system S in cluster C in branch master has deployment variable: INITRAMFS_PATH=boot/initramfs.gz
+ GIVEN system S in cluster C.morph in branch master has deployment variable: INITRAMFS_PATH=boot/initramfs.gz
Fully testing that the system is bootable requires a lot more time,
infrastructure and dependencies, so we're just going to build it and
inspect the result of the deployment.
- WHEN the user builds the system test-system in branch master
- AND the user attempts to deploy the cluster C in branch master
+ WHEN the user builds the system systems/test-system.morph in branch master
+ AND the user attempts to deploy the cluster C.morph in branch master
THEN morph succeeded
AND file workspace/master/test/morphs/test.img exists
@@ -199,27 +199,27 @@ with only one definition.
GIVEN a workspace
AND a git server
WHEN the user checks out the system branch called master
- AND the user builds the system test-system in branch master
- GIVEN a cluster called test-cluster in system branch master
- AND a system in cluster test-cluster in branch master called test-system
- AND system test-system in cluster test-cluster in branch master builds test-system
- AND system test-system in cluster test-cluster in branch master has deployment type: tar
- AND system test-system in cluster test-cluster in branch master has deployment location: test-system.tar
+ AND the user builds the system systems/test-system.morph in branch master
+ GIVEN a cluster called test-cluster.morph in system branch master
+ AND a system in cluster test-cluster.morph in branch master called test-system
+ AND system test-system in cluster test-cluster.morph in branch master builds systems/test-system.morph
+ AND system test-system in cluster test-cluster.morph in branch master has deployment type: tar
+ AND system test-system in cluster test-cluster.morph in branch master has deployment location: test-system.tar
It is useful to group related deployments together, so we support adding
another deployment to the same cluster morphology.
- GIVEN a system in cluster test-cluster in branch master called second-system
- AND system second-system in cluster test-cluster in branch master builds test-system
- AND system second-system in cluster test-cluster in branch master has deployment type: tar
- AND system second-system in cluster test-cluster in branch master has deployment location: second-system.tar
+ GIVEN a system in cluster test-cluster.morph in branch master called second-system
+ AND system second-system in cluster test-cluster.morph in branch master builds systems/test-system.morph
+ AND system second-system in cluster test-cluster.morph in branch master has deployment type: tar
+ AND system second-system in cluster test-cluster.morph in branch master has deployment location: second-system.tar
When we don't tell `morph deploy` which system we want to deploy, all
of the systems in the cluster are deployed. Here a successful deployment
will have morph exit sucessfully and in the case of tarball deployments,
the tarballs for both the systems will be created.
- WHEN the user attempts to deploy the cluster test-cluster in branch master
+ WHEN the user attempts to deploy the cluster test-cluster.morph in branch master
THEN morph succeeded
AND file workspace/master/test/morphs/test-system.tar exists
AND file workspace/master/test/morphs/second-system.tar exists
@@ -230,7 +230,7 @@ deploying a whole distbuild network, and re-deploying only nodes that
have failed.
GIVEN the files workspace/master/test/morphs/test-system.tar and workspace/master/test/morphs/second-system.tar are removed
- WHEN the user attempts to deploy test-system from cluster test-cluster in branch master
+ WHEN the user attempts to deploy test-system from cluster test-cluster.morph in branch master
A successful deployment will have morph exit successfully, and in the
case of tarball deployments, only the tarball for the system we asked
@@ -245,20 +245,20 @@ subsystems to deploy as part of them.
We need to add a subsystem to the cluster to test this.
- GIVEN a subsystem in cluster test-cluster in branch master called test-system.sysroot
- AND subsystem test-system.sysroot in cluster test-cluster in branch master builds test-system
- AND subsystem test-system.sysroot in cluster test-cluster in branch master has deployment type: sysroot
+ GIVEN a subsystem in cluster test-cluster.morph in branch master called test-system.sysroot
+ AND subsystem test-system.sysroot in cluster test-cluster.morph in branch master builds systems/test-system.morph
+ AND subsystem test-system.sysroot in cluster test-cluster.morph in branch master has deployment type: sysroot
We specify the location as a file path, this is relative to the parent
system's extracted rootfs, before it is configured.
- AND subsystem test-system.sysroot in cluster test-cluster in branch master has deployment location: var/lib/sysroots/test-system
+ AND subsystem test-system.sysroot in cluster test-cluster.morph in branch master has deployment location: var/lib/sysroots/test-system
The system which contains a nested system is deployed the same as
before, we don't need to mention the nested deployment.
AND the file workspace/master/test/morphs/test-system.tar is removed
- WHEN the user attempts to deploy test-system from cluster test-cluster in branch master
+ WHEN the user attempts to deploy test-system from cluster test-cluster.morph in branch master
THEN morph succeeded
AND file workspace/master/test/morphs/test-system.tar exists
AND tarball workspace/master/test/morphs/test-system.tar contains var/lib/sysroots/test-system/baserock
@@ -266,7 +266,7 @@ before, we don't need to mention the nested deployment.
Morph will abort deployment if the system to deploy that is specified
on the command line is not defined in the morphology.
- WHEN the user attempts to deploy not-a-system from cluster test-cluster in branch master
+ WHEN the user attempts to deploy not-a-system from cluster test-cluster.morph in branch master
THEN morph failed
It is not valid to deploy a nested system on its own. If it becomes
@@ -274,5 +274,5 @@ desirable to deploy a system that is identical to a system that already
exists but is nested in another, it should be redefined as a top-level
deployment.
- WHEN the user attempts to deploy test-system.sysroot from cluster test-cluster in branch master
+ WHEN the user attempts to deploy test-system.sysroot from cluster test-cluster.morph in branch master
THEN morph failed
diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn
index b3e3ae7..eef878a 100644
--- a/yarns/implementations.yarn
+++ b/yarns/implementations.yarn
@@ -72,23 +72,23 @@ another to hold a chunk.
mkdir "$DATADIR/gits/morphs"
arch=$(run_morph print-architecture)
- cat << EOF > "$DATADIR/gits/morphs/test-system.morph"
+ install -m644 -D /dev/stdin << EOF "$DATADIR/gits/morphs/systems/test-system.morph"
name: test-system
kind: system
arch: $arch
strata:
- - name: test-stratum
- morph: test-stratum
+ - name: test-stratum
+ morph: strata/test-stratum.morph
EOF
- cat << EOF > "$DATADIR/gits/morphs/test-stratum.morph"
+ install -m644 -D /dev/stdin << EOF "$DATADIR/gits/morphs/strata/test-stratum.morph"
name: test-stratum
kind: stratum
chunks:
- name: test-chunk
repo: test:test-chunk
ref: master
- morph: test-chunk
+ morph: morph/test-chunk.morph
build-mode: test
build-depends: []
EOF
@@ -106,7 +106,7 @@ another to hold a chunk.
# dummy files in all the places that different kinds of files are
# usually installed. e.g. executables in `/bin` and `/usr/bin`
- cat << 'EOF' > "$DATADIR/gits/test-chunk/test-chunk.morph"
+ install -m644 -D /dev/stdin << 'EOF' "$DATADIR/gits/test-chunk/morph/test-chunk.morph"
name: test-chunk
kind: chunk
build-system: manual
@@ -274,7 +274,7 @@ have a morphology using the test architecture.
run_in "$DATADIR/gits/test-chunk" git commit -m Initial.
- cat << EOF > "$DATADIR/gits/morphs/build-essential.morph"
+ install -m644 -D /dev/stdin << EOF "$DATADIR/gits/morphs/strata/build-essential.morph"
name: build-essential
kind: stratum
chunks:
@@ -286,36 +286,37 @@ have a morphology using the test architecture.
build-depends: []
EOF
- cat << EOF > "$DATADIR/gits/morphs/core.morph"
+ install -m644 -D /dev/stdin << EOF "$DATADIR/gits/morphs/strata/core.morph"
name: core
kind: stratum
build-depends:
- - morph: build-essential
+ - morph: strata/build-essential.morph
chunks:
- name: test-chunk
repo: test:test-chunk
ref: master
- morph: test-chunk
+ morph: morph/test-chunk.morph
build-mode: test
build-depends: []
EOF
- cat << EOF > "$DATADIR/gits/morphs/$MATCH_1.morph"
+ name="$(basename "${MATCH_1%.*}")"
+ cat << EOF > "$DATADIR/gits/morphs/$MATCH_1"
arch: testarch
configuration-extensions: []
- description: A system called $MATCH_1 for test architecture
+ description: A system called $name for test architecture
kind: system
- name: $MATCH_1
+ name: $name
strata:
- name: build-essential
- morph: build-essential
+ morph: strata/build-essential.morph
- name: core
- morph: core
+ morph: strata/core.morph
EOF
- run_in "$DATADIR/gits/morphs" git add "build-essential.morph"
- run_in "$DATADIR/gits/morphs" git add "core.morph"
- run_in "$DATADIR/gits/morphs" git add "$MATCH_1.morph"
+ run_in "$DATADIR/gits/morphs" git add "strata/build-essential.morph"
+ run_in "$DATADIR/gits/morphs" git add "strata/core.morph"
+ run_in "$DATADIR/gits/morphs" git add "$MATCH_1"
run_in "$DATADIR/gits/morphs" git commit -m "Added $MATCH_1 and strata morphologies."
@@ -341,8 +342,8 @@ We also need to verify that a system branch has been checked out.
IMPLEMENTS THEN the system branch (\S+) is checked out
is_dir "$DATADIR/workspace/$MATCH_1/test/morphs"
- is_file "$DATADIR/workspace/$MATCH_1/test/morphs/test-system.morph"
- is_file "$DATADIR/workspace/$MATCH_1/test/morphs/test-stratum.morph"
+ is_file "$DATADIR/workspace/$MATCH_1/test/morphs/systems/test-system.morph"
+ is_file "$DATADIR/workspace/$MATCH_1/test/morphs/strata/test-stratum.morph"
We can create a new branch, off master.
@@ -411,20 +412,20 @@ Editing morphologies with `morph edit`.
IMPLEMENTS THEN in branch (\S+), stratum (\S+) refs (\S+) in (\S+)
"$SRCDIR/scripts/yaml-extract" \
- "$DATADIR/workspace/$MATCH_1/test/morphs/$MATCH_2.morph" \
+ "$DATADIR/workspace/$MATCH_1/test/morphs/$MATCH_2" \
chunks name="$MATCH_3" ref > "$DATADIR/ref.actual"
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"
+ "$SRCDIR/scripts/yaml-extract" \
+ "$DATADIR/workspace/$MATCH_1/test/morphs/$MATCH_3" \
+ "$field" name="$MATCH_4" "$MATCH_5" 2>&1 |
+ grep -qFe "Object does not contain $MATCH_5"
- IMPLEMENTS WHEN the user edits the chunk (\S+) in the stratum (\S+) in the system (\S+) in branch (\S+)
- cd "$DATADIR/workspace/$MATCH_4/test/morphs"
+ IMPLEMENTS WHEN the user edits the chunk (\S+) in branch (\S+)
+ cd "$DATADIR/workspace/$MATCH_2/test/morphs"
run_morph edit "$MATCH_1"
IMPLEMENTS THEN the edited chunk (\S+) has git branch (\S+)
@@ -441,15 +442,16 @@ print-architecture` to get a value appropriate for morph.
IMPLEMENTS WHEN the user creates an uncommitted system morphology called (\S+) for our architecture in system branch (\S+)
arch=$(morph print-architecture)
- cat << EOF > "$DATADIR/workspace/$MATCH_2/test/morphs/$MATCH_1.morph"
+ name="$(basename "${MATCH_1%.*}")"
+ install -m644 -D /dev/stdin << EOF "$DATADIR/workspace/$MATCH_2/test/morphs/$MATCH_1"
arch: $arch
configuration-extensions: []
- description: A system called $MATCH_1 for architectures $arch
+ description: A system called $name for architectures $arch
kind: system
- name: $MATCH_1
+ name: $name
strata:
- name: test-stratum
- morph: test-stratum
+ morph: strata/test-stratum.morph
EOF
Reporting status of checked out repositories:
@@ -509,7 +511,7 @@ Petrification and unpetrification:
IMPLEMENTS WHEN remembering all refs in (\S+)
cd "$DATADIR/workspace/$MATCH_1/test/morphs"
- list_refs *.morph > "$DATADIR/refs.remembered"
+ list_refs $(find . -type f) > "$DATADIR/refs.remembered"
IMPLEMENTS THEN (\S+) refs are as remembered
cd "$DATADIR/workspace/$MATCH_1/test/morphs"
@@ -524,13 +526,13 @@ Petrification and unpetrification:
#
# We would like to verify the result like this:
#
- # list_refs *.morph > "$DATADIR/refs.now"
+ # list_refs $(find . -type f) > "$DATADIR/refs.now"
# diff -u "$DATADIR/refs.remembered" "$DATADIR/refs.now"
#
# However, due to the bug, we have to do it in a more complicated
# manner.
- list_refs *.morph |
+ list_refs $(find . -type f) |
while read filename ref
do
orig=$(awk -v "f=$filename" '$1 == f { print $2 }' \
@@ -551,7 +553,7 @@ Petrification and unpetrification:
IMPLEMENTS THEN (\S+) is petrified
cd "$DATADIR/workspace/$MATCH_1/test/morphs"
- assert_morphologies_are_petrified "$MATCH_1" *.morph
+ assert_morphologies_are_petrified "$MATCH_1" $(find . -type f)
Generating a manifest.
@@ -804,15 +806,15 @@ Altering morphologies in their source repositories
IMPLEMENTS GIVEN system (\S+) uses (.+) from (\S+)
"$SRCDIR/scripts/edit-morph" set-system-artifact-depends \
- "$DATADIR/gits/morphs/$MATCH_1.morph" "$MATCH_3" "$MATCH_2"
- run_in "$DATADIR/gits/morphs" git add "$MATCH_1.morph"
+ "$DATADIR/gits/morphs/$MATCH_1" "$MATCH_3" "$MATCH_2"
+ run_in "$DATADIR/gits/morphs" git add "$MATCH_1"
run_in "$DATADIR/gits/morphs" git commit -m "Make $MATCH_1 only use $MATCH_2"
IMPLEMENTS GIVEN stratum (\S+) has match rules: (.*)
cd "$DATADIR/gits/morphs"
"$SRCDIR/scripts/edit-morph" set-stratum-match-rules \
- "$MATCH_1.morph" "$MATCH_2"
- git add "$MATCH_1.morph"
+ "$MATCH_1" "$MATCH_2"
+ git add "$MATCH_1"
git commit -m "Make $MATCH_1 match $MATCH_2"
Altering morphologies in the workspace
@@ -823,7 +825,7 @@ Altering morphologies in the workspace
IMPLEMENTS GIVEN stratum (\S+) in system branch (\S+) has match rules: (.*)
cd "$DATADIR/workspace/$MATCH_2/test/morphs"
"$SRCDIR/scripts/edit-morph" set-stratum-match-rules \
- "$MATCH_1.morph" "$MATCH_3"
+ "$MATCH_1" "$MATCH_3"
### Altering clusters ###
@@ -831,14 +833,14 @@ Altering morphologies in the workspace
name="$MATCH_1"
branch="$MATCH_2"
"$SRCDIR/scripts/edit-morph" cluster-init \
- "$DATADIR/workspace/$branch/test/morphs/$name.morph"
+ "$DATADIR/workspace/$branch/test/morphs/$name"
IMPLEMENTS GIVEN a (sub)?system in cluster (\S+) in branch (\S+) called (\S+)
cluster="$MATCH_2"
branch="$MATCH_3"
name="$MATCH_4"
"$SRCDIR/scripts/edit-morph" cluster-system-init \
- "$DATADIR/workspace/$branch/test/morphs/$cluster.morph" "$name"
+ "$DATADIR/workspace/$branch/test/morphs/$cluster" "$name"
IMPLEMENTS GIVEN (sub)?system (\S+) in cluster (\S+) in branch (\S+) builds (\S+)
name="$MATCH_2"
@@ -846,7 +848,7 @@ Altering morphologies in the workspace
branch="$MATCH_4"
morphology="$MATCH_5"
"$SRCDIR/scripts/edit-morph" cluster-system-set-morphology \
- "$DATADIR/workspace/$branch/test/morphs/$cluster.morph" "$name" \
+ "$DATADIR/workspace/$branch/test/morphs/$cluster" "$name" \
"$morphology"
IMPLEMENTS GIVEN (sub)?system (\S+) in cluster (\S+) in branch (\S+) has deployment type: (\S+)
@@ -855,7 +857,7 @@ Altering morphologies in the workspace
branch="$MATCH_4"
type="$MATCH_5"
"$SRCDIR/scripts/edit-morph" cluster-system-set-deploy-type \
- "$DATADIR/workspace/$branch/test/morphs/$cluster.morph" "$name" \
+ "$DATADIR/workspace/$branch/test/morphs/$cluster" "$name" \
"$type"
IMPLEMENTS GIVEN (sub)?system (\S+) in cluster (\S+) in branch (\S+) has deployment location: (\S+)
@@ -864,7 +866,7 @@ Altering morphologies in the workspace
branch="$MATCH_4"
location="$MATCH_5"
"$SRCDIR/scripts/edit-morph" cluster-system-set-deploy-location \
- "$DATADIR/workspace/$branch/test/morphs/$cluster.morph" "$name" \
+ "$DATADIR/workspace/$branch/test/morphs/$cluster" "$name" \
"$location"
IMPLEMENTS GIVEN (sub)?system (\S+) in cluster (\S+) in branch (\S+) has deployment variable: ([^=]+)=(.*)
@@ -874,5 +876,5 @@ Altering morphologies in the workspace
key="$MATCH_5"
val="$MATCH_6"
"$SRCDIR/scripts/edit-morph" cluster-system-set-deploy-variable \
- "$DATADIR/workspace/$branch/test/morphs/$cluster.morph" "$name" \
+ "$DATADIR/workspace/$branch/test/morphs/$cluster" "$name" \
"$key" "$val"
diff --git a/yarns/regression.yarn b/yarns/regression.yarn
index b0f4d11..e6fd2af 100644
--- a/yarns/regression.yarn
+++ b/yarns/regression.yarn
@@ -10,7 +10,7 @@ Testing if we can build after checking out from a tag.
GIVEN a workspace
AND a git server
WHEN the user checks out the system tag called test-tag
- THEN morph build the system test-system of the tag test-tag
+ THEN morph build the system systems/test-system.morph of the tag test-tag
Running `morph branch` when the branch directory exists doesn't
@@ -41,9 +41,9 @@ area, hence their results cannot be trusted.
SCENARIO building a system with only bootstrap chunks fails
GIVEN a workspace
AND a git server
- AND a system containing only bootstrap chunks called bootstrap-system
+ AND a system containing only bootstrap chunks called bootstrap-system.morph
WHEN the user checks out the system branch called master
- AND the user attempts to build the system bootstrap-system in branch master
+ AND the user attempts to build the system bootstrap-system.morph in branch master
THEN the build error message includes the string "No non-bootstrap chunks found"
When we started allowing multiple artifacts, a long-standing bug in
@@ -55,17 +55,17 @@ source it depended on.
SCENARIO changing the artifacts a system uses
GIVEN a workspace
AND a git server
- AND system test-system uses test-stratum-runtime from test-stratum
- AND stratum test-stratum has match rules: [{artifact: test-stratum-runtime, include: [.*-(bins|libs|locale)]}, {artifact: test-stratum-devel, include: [.*-(devel|doc|misc)]}]
+ AND system systems/test-system.morph uses test-stratum-runtime from test-stratum
+ AND stratum strata/test-stratum.morph has match rules: [{artifact: test-stratum-runtime, include: [.*-(bins|libs|locale)]}, {artifact: test-stratum-devel, include: [.*-(devel|doc|misc)]}]
WHEN the user checks out the system branch called master
- GIVEN a cluster called test-cluster in system branch master
- AND a system in cluster test-cluster in branch master called test-system
- AND system test-system in cluster test-cluster in branch master builds test-system
- AND system test-system in cluster test-cluster in branch master has deployment type: tar
- WHEN the user builds the system test-system in branch master
- GIVEN stratum test-stratum in system branch master has match rules: [{artifact: test-stratum-runtime, include: [.*-(bins|libs|misc)]}, {artifact: test-stratum-devel, include: [.*-(devel|doc|locale)]}]
- WHEN the user builds the system test-system in branch master
- AND the user deploys the cluster test-cluster in branch master with options test-system.location="$DATADIR/test.tar"
+ GIVEN a cluster called test-cluster.morph in system branch master
+ AND a system in cluster test-cluster.morph in branch master called test-system
+ AND system test-system in cluster test-cluster.morph in branch master builds systems/test-system.morph
+ AND system test-system in cluster test-cluster.morph in branch master has deployment type: tar
+ WHEN the user builds the system systems/test-system.morph in branch master
+ GIVEN stratum strata/test-stratum.morph in system branch master has match rules: [{artifact: test-stratum-runtime, include: [.*-(bins|libs|misc)]}, {artifact: test-stratum-devel, include: [.*-(devel|doc|locale)]}]
+ WHEN the user builds the system systems/test-system.morph in branch master
+ AND the user deploys the cluster test-cluster.morph in branch master with options test-system.location="$DATADIR/test.tar"
THEN tarball test.tar contains baserock/test-chunk-misc.meta
@@ -74,22 +74,23 @@ Implementations
IMPLEMENTS GIVEN a system containing only bootstrap chunks called (\S+)
arch=$(run_morph print-architecture)
- cat <<EOF >"$DATADIR/gits/morphs/$MATCH_1.morph"
- name: $MATCH_1
+ name="$(basename "${MATCH_1%.*}")"
+ install -m644 -D /dev/stdin <<EOF "$DATADIR/gits/morphs/$MATCH_1"
+ name: $name
kind: system
arch: $arch
strata:
- - morph: bootstrap-stratum
+ - morph: strata/bootstrap-stratum.morph
EOF
- cat << EOF > "$DATADIR/gits/morphs/bootstrap-stratum.morph"
+ install -m644 -D /dev/stdin << EOF "$DATADIR/gits/morphs/strata/bootstrap-stratum.morph"
name: bootstrap-stratum
kind: stratum
chunks:
- name: bootstrap-chunk
repo: test:test-chunk
ref: master
- morph: test-chunk
+ morph: morph/test-chunk.morph
build-mode: bootstrap
build-depends: []
EOF
diff --git a/yarns/splitting.yarn b/yarns/splitting.yarn
index ee587e1..4691b53 100644
--- a/yarns/splitting.yarn
+++ b/yarns/splitting.yarn
@@ -14,16 +14,16 @@ scenario that uses all of them, not relying on the default rules.
To test that all the fields are recognised, we set the new fields to
their default values.
- AND chunk test-chunk includes the default splitting rules
- AND stratum test-stratum includes the default splitting rules
- AND system test-system includes the default splitting rules
+ AND chunk morph/test-chunk.morph includes the default splitting rules
+ AND stratum strata/test-stratum.morph includes the default splitting rules
+ AND system systems/test-system.morph includes the default splitting rules
The default rules produce a system that is identical to not providing
them, and since this test is about validation, we don't care about the
result, so much as it succeeding to build something.
WHEN the user checks out the system branch called master
- THEN morph build the system test-system of the branch master
+ THEN morph build the system systems/test-system.morph of the branch master
Smaller systems
---------------
@@ -40,23 +40,24 @@ libraries.
The only change we need to make is to add a field to the system morphology
to select which artifact to use in the system.
- AND system test-system uses test-stratum-runtime from test-stratum
+ AND system systems/test-system.morph uses test-stratum-runtime from test-stratum
WHEN the user checks out the system branch called master
The best way to test that only using some stratum artifacts works is
to check which files the output has, so we deploy a tarball and inspect
its contents.
- GIVEN a cluster called test-cluster in system branch master
- AND a system in cluster test-cluster in branch master called test-system
- AND system test-system in cluster test-cluster in branch master builds test-system
- AND system test-system in cluster test-cluster in branch master has deployment type: tar
- WHEN the user builds the system test-system in branch master
- AND the user attempts to deploy the cluster test-cluster in branch master with options test-system.location="$DATADIR/test.tar"
+ GIVEN a cluster called test-cluster.morph in system branch master
+ AND a system in cluster test-cluster.morph in branch master called test-system
+ AND system test-system in cluster test-cluster.morph in branch master builds systems/test-system.morph
+ AND system test-system in cluster test-cluster.morph in branch master has deployment type: tar
+ WHEN the user builds the system systems/test-system.morph in branch master
+ AND the user attempts to deploy the cluster test-cluster.morph in branch master with options test-system.location="$DATADIR/test.tar"
The -runtime artifacts include executables and shared libraries.
- THEN tarball test.tar contains bin/test
+ THEN morph succeeded
+ AND tarball test.tar contains bin/test
AND tarball test.tar contains lib/libtest.so
The -devel artifacts include static libraries and documentation, so if
@@ -77,10 +78,10 @@ This GIVEN has a chunk in the stratum that never successfully builds,
so we know that if the system successfully builds, then we only built
chunks that were needed.
- AND stratum test-stratum has chunks that aren't used in test-stratum-minimal
- AND system test-system uses test-stratum-minimal from test-stratum
+ AND stratum strata/test-stratum.morph has chunks that aren't used in test-stratum-minimal
+ AND system systems/test-system.morph uses test-stratum-minimal from test-stratum
WHEN the user checks out the system branch called master
- THEN morph build the system test-system of the branch master
+ THEN morph build the system systems/test-system.morph of the branch master
Implementations
@@ -88,48 +89,49 @@ Implementations
IMPLEMENTS GIVEN chunk (\S+) includes the default splitting rules
# Append default products rules
- cat <<EOF >>"$DATADIR/gits/$MATCH_1/$MATCH_1.morph"
+ name="$(basename "${MATCH_1%.*}")"
+ cat <<EOF >>"$DATADIR/gits/$name/$MATCH_1"
products:
- - artifact: $MATCH_1-bins
+ - artifact: $name-bins
include: [ "(usr/)?s?bin/.*" ]
- - artifact: $MATCH_1-libs
+ - artifact: $name-libs
include:
- (usr/)?lib(32|64)?/lib[^/]*\.so(\.\d+)*
- (usr/)?libexec/.*
- - artifact: $MATCH_1-devel
+ - artifact: $name-devel
include:
- (usr/)?include/.*
- (usr/)?lib(32|64)?/lib.*\.a
- (usr/)?lib(32|64)?/lib.*\.la
- (usr/)?(lib(32|64)?|share)/pkgconfig/.*\.pc
- - artifact: $MATCH_1-doc
+ - artifact: $name-doc
include:
- (usr/)?share/doc/.*
- (usr/)?share/man/.*
- (usr/)?share/info/.*
- - artifact: $MATCH_1-locale
+ - artifact: $name-locale
include:
- (usr/)?share/locale/.*
- (usr/)?share/i18n/.*
- (usr/)?share/zoneinfo/.*
- - artifact: $MATCH_1-misc
+ - artifact: $name-misc
include: [ .* ]
EOF
- run_in "$DATADIR/gits/$MATCH_1" git add "$MATCH_1.morph"
- run_in "$DATADIR/gits/$MATCH_1" git commit -m 'Add default splitting rules'
+ run_in "$DATADIR/gits/$name" git add "$MATCH_1"
+ run_in "$DATADIR/gits/$name" git commit -m 'Add default splitting rules'
IMPLEMENTS GIVEN stratum (\S+) includes the default splitting rules
- # Append default products rules
- cat <<EOF >"$DATADIR/gits/morphs/$MATCH_1.morph"
- name: $MATCH_1
+ name=$(basename "${MATCH_1%.*}")
+ cat <<EOF >"$DATADIR/gits/morphs/$MATCH_1"
+ name: $name
kind: stratum
products:
- - artifact: $MATCH_1-devel
+ - artifact: $name-devel
include:
- .*-devel
- .*-debug
- .*-doc
- - artifact: $MATCH_1-runtime
+ - artifact: $name-runtime
include:
- .*-bins
- .*-libs
@@ -140,36 +142,33 @@ Implementations
- name: test-chunk
repo: test:test-chunk
ref: master
- morph: test-chunk
+ morph: morph/test-chunk.morph
build-mode: test
build-depends: []
artifacts:
- test-chunk-bins: $MATCH_1-runtime
- test-chunk-libs: $MATCH_1-runtime
- test-chunk-locale: $MATCH_1-runtime
- test-chunk-misc: $MATCH_1-runtime
- test-chunk-devel: $MATCH_1-devel
- test-chunk-doc: $MATCH_1-devel
+ test-chunk-bins: $name-runtime
+ test-chunk-libs: $name-runtime
+ test-chunk-locale: $name-runtime
+ test-chunk-misc: $name-runtime
+ test-chunk-devel: $name-devel
+ test-chunk-doc: $name-devel
EOF
- run_in "$DATADIR/gits/morphs" git add "$MATCH_1.morph"
+ run_in "$DATADIR/gits/morphs" git add "$MATCH_1"
run_in "$DATADIR/gits/morphs" git commit -m 'Add default splitting rules'
IMPLEMENTS GIVEN system (\S+) includes the default splitting rules
- cat << EOF > "$DATADIR/gits/morphs/$MATCH_1.morph"
- name: $MATCH_1
- kind: system
- arch: $(run_morph print-architecture)
+ cat << EOF >> "$DATADIR/gits/morphs/$MATCH_1"
strata:
- name: test-stratum
- morph: test-stratum
+ morph: strata/test-stratum.morph
artifacts:
- test-stratum-runtime
- test-stratum-devel
EOF
- run_in "$DATADIR/gits/morphs" git add "$MATCH_1.morph"
+ run_in "$DATADIR/gits/morphs" git add "$MATCH_1"
run_in "$DATADIR/gits/morphs" git commit -m 'Add default splitting rules'
- IMPLEMENTS GIVEN stratum (\S+) has chunks that aren't used in (\1-\S+)
+ IMPLEMENTS GIVEN stratum (\S+) has chunks that aren't used in (\S+)
# Create an extra chunk that will never successfully build
cat >"$DATADIR/gits/test-chunk/unbuildable-chunk.morph" <<EOF
name: unbuildable-chunk
@@ -182,9 +181,7 @@ Implementations
# Create a stratum that has an artifact that doesn't include any
# artifacts from unbuildable-chunk
- cat >"$DATADIR/gits/morphs/$MATCH_1.morph" <<EOF
- name: $MATCH_1
- kind: stratum
+ cat >>"$DATADIR/gits/morphs/$MATCH_1" <<EOF
products:
- artifact: $MATCH_2
include:
@@ -193,16 +190,16 @@ Implementations
- name: test-chunk
repo: test:test-chunk
ref: master
- morph: test-chunk
+ morph: morph/test-chunk.morph
build-mode: test
build-depends: []
- name: unbuildable-chunk
repo: test:test-chunk
ref: refs/heads/master
- morph: unbuildable-chunk
+ morph: unbuildable-chunk.morph
build-mode: test
build-depends:
- test-chunk
EOF
- run_in "$DATADIR/gits/morphs" git add "$MATCH_1.morph"
- run_in "$DATADIR/gits/morphs" git commit -m "add -$MATCH_2 to stratum"
+ run_in "$DATADIR/gits/morphs" git add "$MATCH_1"
+ run_in "$DATADIR/gits/morphs" git commit -m "add $MATCH_2 to stratum"