diff options
Diffstat (limited to 'yarns')
-rw-r--r-- | yarns/architecture.yarn | 2 | ||||
-rw-r--r-- | yarns/building.yarn | 6 | ||||
-rw-r--r-- | yarns/implementations.yarn | 49 | ||||
-rw-r--r-- | yarns/morph.shell-lib | 17 | ||||
-rw-r--r-- | yarns/regression.yarn | 50 |
5 files changed, 89 insertions, 35 deletions
diff --git a/yarns/architecture.yarn b/yarns/architecture.yarn index 038492cd..521575a3 100644 --- a/yarns/architecture.yarn +++ b/yarns/architecture.yarn @@ -4,7 +4,7 @@ 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 + AND a system called base-system-testarch 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 THEN morph failed diff --git a/yarns/building.yarn b/yarns/building.yarn index b78c69cd..5b6b29a0 100644 --- a/yarns/building.yarn +++ b/yarns/building.yarn @@ -5,7 +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-testarch for architecture testarch in system branch master - AND the user attempts to build the system base-system-testarch in branch master - THEN morph failed - AND the build error message includes the string "Did you forget to commit it?" + 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 of the repo test:morphs diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn index 6491b38e..132ce9b3 100644 --- a/yarns/implementations.yarn +++ b/yarns/implementations.yarn @@ -75,13 +75,6 @@ another to hold a chunk. morph: test-stratum EOF - cat << EOF > "$DATADIR/gits/morphs/simple-system.morph" - name: simple-system - kind: system - arch: $arch - strata: [] - EOF - cat << EOF > "$DATADIR/gits/morphs/test-stratum.morph" name: test-stratum kind: stratum @@ -90,7 +83,7 @@ another to hold a chunk. repo: test:test-chunk ref: master morph: test-chunk - build-mode: bootstrap + build-mode: test build-depends: [] EOF @@ -127,14 +120,21 @@ another to hold a chunk. mkdir "$DATADIR/cache" mkdir "$DATADIR/tmp" - IMPLEMENTS GIVEN a system called (\S+) for architecture (\S+) in the git server +We need a consistent value for the architecture in some tests, so we +have a morphology using the test architecture. + + IMPLEMENTS GIVEN a system called (\S+) for the test architecture in the git server cat << EOF > "$DATADIR/gits/morphs/$MATCH_1.morph" - arch: $MATCH_2 + arch: testarch configuration-extensions: [] - description: A system called $MATCH_1 for architectures $MATCH_2 + description: A system called $MATCH_1 for test architecture kind: system name: $MATCH_1 - strata: [] + strata: + - name: test-stratum + repo: test:morphs + ref: master + morph: test-stratum EOF run_in "$DATADIR/gits/morphs" git add "$MATCH_1.morph" run_in "$DATADIR/gits/morphs" git commit -m "Added $MATCH_1 morphology." @@ -268,14 +268,23 @@ Editing morphologies with `morph edit`. cd "$DATADIR/workspace/$MATCH_3" attempt_morph edit "$MATCH_2" "$MATCH_1" - IMPLEMENTS WHEN the user creates an uncommitted system morphology called (\S+) for architecture (\S+) in system branch (\S+) - cat << EOF > "$DATADIR/workspace/$MATCH_3/test:morphs/$MATCH_1.morph" - arch: $MATCH_2 +To produce buildable morphologies, we need them to be of the same +architecture as the machine doing the testing. This uses `morph +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" + arch: $arch configuration-extensions: [] - description: A system called $MATCH_1 for architectures $MATCH_2 + description: A system called $MATCH_1 for architectures $arch kind: system name: $MATCH_1 - strata: [] + strata: + - name: test-stratum + repo: test:morphs + ref: master + morph: test-stratum EOF Reporting status of checked out repositories: @@ -425,7 +434,7 @@ Generating a manifest. > "$DATADIR/baserock/hello_world.meta" { "artifact-name": "hello_world", - "cache-key": + "cache-key": "ab8d00a80298a842446ce23507cea6b4d0e34c7ddfa05c67f460318b04d21308", "kind": "chunk", "morphology": "hello_world.morph", @@ -440,7 +449,7 @@ Generating a manifest. IMPLEMENTS WHEN morph generates a manifest run_morph generate-manifest "$DATADIR/artifact.tar" > "$DATADIR/manifest" - + IMPLEMENTS THEN the manifest is generated # Generated manifest should contain the name of the repository @@ -554,4 +563,4 @@ Implementations for building systems IMPLEMENTS THEN morph build the system (\S+) of the (branch|tag) (\S+) of the repo (\S+) cd "$DATADIR/workspace/$MATCH_3/$MATCH_4" - run_morph build "$MATCH_1" + run_morph build "$MATCH_1" diff --git a/yarns/morph.shell-lib b/yarns/morph.shell-lib index 2981e6d9..66abd076 100644 --- a/yarns/morph.shell-lib +++ b/yarns/morph.shell-lib @@ -30,13 +30,16 @@ run_morph() { - "${SRCDIR:-.}"/morph \ - --cachedir-min-space=0 --tempdir-min-space=0 \ - --no-default-config --config "$DATADIR/morph.conf" "$@" \ - 2> "$DATADIR/result-$1" - local exit_code="$?" - cat "$DATADIR/result-$1" >&2 - return "$exit_code" + { + set +e + "${SRCDIR:-.}"/morph \ + --cachedir-min-space=0 --tempdir-min-space=0 \ + --no-default-config --config "$DATADIR/morph.conf" "$@" \ + 2> "$DATADIR/result-$1" + local exit_code="$?" + cat "$DATADIR/result-$1" >&2 + return "$exit_code" + } } diff --git a/yarns/regression.yarn b/yarns/regression.yarn index a17d2f87..eae01343 100644 --- a/yarns/regression.yarn +++ b/yarns/regression.yarn @@ -10,13 +10,13 @@ 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 simple-system of the tag test-tag of the repo test:morphs + THEN morph build the system test-system of the tag test-tag of the repo test:morphs Running `morph branch` when the branch directory exists doesn't remove the existing directory. - SCENARIO re-running 'morph branch' fails, original branch untouched + SCENARIO re-running 'morph branch' fails, original branch untouched GIVEN a workspace AND a git server WHEN the user creates a system branch called foo @@ -27,8 +27,52 @@ The branch is checked out correctly, now it should fail if the user executes WHEN the user attempts to create a system branch called foo THEN morph failed - AND the branch error message includes the string "File exists" + AND the branch error message includes the string "File exists" The branch still checked out. AND the system branch foo is checked out + + +It doesn't make much sense to be able to build a system with only +bootstrap chunks, since they will have been constructed without a staging +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 + WHEN the user checks out the system branch called master + AND the user attempts to build the system bootstrap-system in branch master + THEN the build error message includes the string "No non-bootstrap chunks found" + + +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 + kind: system + arch: $arch + strata: + - morph: bootstrap-stratum + repo: test:morphs + ref: master + EOF + + cat << EOF > "$DATADIR/gits/morphs/bootstrap-stratum.morph" + name: bootstrap-stratum + kind: stratum + chunks: + - name: bootstrap-chunk + repo: test:test-chunk + ref: master + morph: test-chunk + build-mode: bootstrap + build-depends: [] + EOF + + run_in "$DATADIR/gits/morphs" git add . + run_in "$DATADIR/gits/morphs" git commit -m "Add bootstrap-system" |