diff options
Diffstat (limited to 'yarns')
-rw-r--r-- | yarns/branches-workspaces.yarn | 57 | ||||
-rw-r--r-- | yarns/implementations.yarn | 103 | ||||
-rw-r--r-- | yarns/regression.yarn | 3 | ||||
-rw-r--r-- | yarns/splitting.yarn | 9 |
4 files changed, 52 insertions, 120 deletions
diff --git a/yarns/branches-workspaces.yarn b/yarns/branches-workspaces.yarn index 642beadd..7c85d6e0 100644 --- a/yarns/branches-workspaces.yarn +++ b/yarns/branches-workspaces.yarn @@ -39,7 +39,7 @@ existing workspace, initialising it should fail. WHEN the user attempts to initialise a workspace THEN morph failed -Checking out or branching system branches +Checking out system branches ----------------------------------------- Once we have a workspace, we can check out a system branch. @@ -50,6 +50,12 @@ Once we have a workspace, we can check out a system branch. WHEN the user checks out the system branch called master THEN the system branch master is checked out +Edit is probably not the best name for is, but we can use `morph edit` +to investigate chunks in existing branches. + + WHEN the user edits the chunk test-chunk in branch master + THEN the edited chunk test:test-chunk has git branch master + Checking out a system branch should fail, if the branch doesn't exist. SCENARIO checking out a system branch that doesn't exist @@ -58,6 +64,9 @@ Checking out a system branch should fail, if the branch doesn't exist. WHEN the user attempts to check out the system branch called foo THEN morph failed +Branching system branches +----------------------------------------- + We can, instead, create a new system branch, off master. SCENARIO branch off master @@ -142,19 +151,19 @@ current directory, things should fail. AND the user attempts to report the system branch from the directory . THEN morph failed -`morph show-branch-root` reports the URL (possibly aliases) of the -system branch root repository. It can be run inside a checkout, or -somewhere outside a checkout, where exactly one checkout exists below. +`morph show-branch-root` reports the path of the system branch root +repository. It can be run inside a checkout, or somewhere outside a +checkout, where exactly one checkout exists below. SCENARIO morph reports system branch root repository GIVEN a workspace AND a git server WHEN the user checks out the system branch called master AND the user reports the system branch root repository from the directory master - THEN the system branch root repository is reported as test:morphs + THEN the system branch root repository is reported as workspace/master/test/morphs WHEN the user reports the system branch root repository from the directory . - THEN the system branch root repository is reported as test:morphs + THEN the system branch root repository is reported as workspace/master/test/morphs However, it fails if run outside a checkout and there's no system branches checked out. @@ -178,7 +187,6 @@ 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 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 @@ -406,41 +414,6 @@ branch checkout. THEN morph ran command in test/morphs in foo AND morph ran command in test/test-chunk in foo -Explicit petrification ----------------------- - -We petrify branches explicitly (though this may later change so that -`morph branch` does it automatically). To test this, we create a branch, -petrify it, and verify that every ref looks like a SHA1. We then -unpetrify and verify that we have all the same refs as before. - - SCENARIO morph petrifies and unpetrifies - GIVEN a workspace - AND a git server - WHEN the user creates a system branch called foo - AND the user pushes the system branch called foo to the git server - 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 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. - - 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 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 SCENARIO morph generates a manifest diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn index a28fda54..d2e72ccf 100644 --- a/yarns/implementations.yarn +++ b/yarns/implementations.yarn @@ -67,7 +67,28 @@ another to hold a chunk. # Create a directory for all the git repositories. mkdir "$DATADIR/gits" - # Create a repo for the system and stratum morphologies. + # Create the chunk repository. + + mkdir "$DATADIR/gits/test-chunk" + + run_in "$DATADIR/gits/test-chunk" git init . + cat > "$DATADIR/gits/test-chunk/test-bin" <<'EOF' + #!/bin/sh + echo Hello World + EOF + cat > "$DATADIR/gits/test-chunk/test.h" <<'EOF' + int foo(void); + EOF + cat > "$DATADIR/gits/test-chunk/test.pc" <<'EOF' + prefix=/usr + includedir=${prefix}/include + Name: test + Cflags: -I{includedir} + EOF + run_in "$DATADIR/gits/test-chunk" git add . + run_in "$DATADIR/gits/test-chunk" git commit --allow-empty -m Initial. + + # Create a repo for the morphologies. mkdir "$DATADIR/gits/morphs" @@ -88,15 +109,12 @@ another to hold a chunk. - name: test-chunk repo: test:test-chunk morph: test-chunk.morph - ref: master + unpetrify-ref: master + ref: $(run_in "$DATADIR/gits/test-chunk" git rev-parse master) build-mode: test build-depends: [] EOF - # Create the chunk repository. - - mkdir "$DATADIR/gits/test-chunk" - # To verify that chunk splitting works, we have a chunk that installs # dummy files in all the places that different kinds of files are # usually installed. e.g. executables in `/bin` and `/usr/bin` @@ -240,23 +258,6 @@ another to hold a chunk. run_in "$DATADIR/gits/morphs" git commit -m Initial. run_in "$DATADIR/gits/morphs" git tag -a "test-tag" -m "Tagging test-tag" - run_in "$DATADIR/gits/test-chunk" git init . - cat > "$DATADIR/gits/test-chunk/test-bin" <<'EOF' - #!/bin/sh - echo Hello World - EOF - cat > "$DATADIR/gits/test-chunk/test.h" <<'EOF' - int foo(void); - EOF - cat > "$DATADIR/gits/test-chunk/test.pc" <<'EOF' - prefix=/usr - includedir=${prefix}/include - Name: test - Cflags: -I{includedir} - EOF - run_in "$DATADIR/gits/test-chunk" git add . - run_in "$DATADIR/gits/test-chunk" git commit --allow-empty -m Initial. - # Create the Morph configuration file so we can access the repos # using test:foo URL aliases. @@ -293,7 +294,8 @@ have a morphology using the test architecture. - name: stage1-chunk morph: stage1-chunk.morph repo: test:test-chunk - ref: master + ref: $(run_in "$DATADIR/gits/test-chunk" git rev-parse master) + unpetrify-ref: master build-mode: bootstrap build-depends: [] EOF @@ -307,7 +309,8 @@ have a morphology using the test architecture. - name: test-chunk morph: test-chunk.morph repo: test:test-chunk - ref: master + unpetrify-ref: master + ref: $(run_in "$DATADIR/gits/test-chunk" git rev-parse master) build-mode: test build-depends: [] EOF @@ -416,7 +419,7 @@ Report system branch root repository. else attempt_morph show-branch-root > "$@"; fi IMPLEMENTS THEN the system branch root repository is reported as (.*) - echo "$MATCH_1" > "$DATADIR/branch-root.actual" + echo "$DATADIR/$MATCH_1" > "$DATADIR/branch-root.actual" diff -u "$DATADIR/branch-root.actual" "$DATADIR/branch-root.reported" Editing morphologies with `morph edit`. @@ -518,54 +521,6 @@ Running shell command in each checked out repository: grep -Fx "$MATCH_1" "$DATADIR/morph.stdout" grep -Fx "$DATADIR/workspace/$MATCH_2/$MATCH_1" "$DATADIR/morph.stdout" -Petrification and unpetrification: - - IMPLEMENTS WHEN remembering all refs in (\S+) - cd "$DATADIR/workspace/$MATCH_1/test/morphs" - list_refs $(find . -type f) > "$DATADIR/refs.remembered" - - IMPLEMENTS THEN (\S+) refs are as remembered - cd "$DATADIR/workspace/$MATCH_1/test/morphs" - - # FIXME: petrify/unpetrify doesn't work quite right at this time: - # petrify can change a ref to a stratum to point at the system - # branch, but does it without adding an unpetrify-ref, and so - # unpetrify doesn't undo the change. We ignore this bug for the - # time being, in order to make the test suite pass. When the - # petrification code has been cleaned up to not be so hairy, - # we'll fix the test and the code. - # - # We would like to verify the result like this: - # - # 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 $(find . -type f) | - while read filename ref - do - orig=$(awk -v "f=$filename" '$1 == f { print $2 }' \ - "$DATADIR/refs.remembered") - if [ "$orig" != "$ref" ] && [ "$ref" != "$MATCH_1" ] - then - die "Un-petrified ref: $filename $ref (should be $orig)" - fi - done - - IMPLEMENTS WHEN petrifying (\S+) - cd "$DATADIR/workspace/$MATCH_1/test/morphs" - run_morph petrify - - IMPLEMENTS WHEN unpetrifying (\S+) - cd "$DATADIR/workspace/$MATCH_1/test/morphs" - run_morph unpetrify - - IMPLEMENTS THEN (\S+) is petrified - cd "$DATADIR/workspace/$MATCH_1/test/morphs" - assert_morphologies_are_petrified "$MATCH_1" $(find . -type f) - Generating a manifest. IMPLEMENTS GIVEN a system artifact diff --git a/yarns/regression.yarn b/yarns/regression.yarn index e5b3d875..6f499d90 100644 --- a/yarns/regression.yarn +++ b/yarns/regression.yarn @@ -90,7 +90,8 @@ Implementations - name: bootstrap-chunk morph: bootstrap-chunk.morph repo: test:test-chunk - ref: master + unpetrify-ref: master + ref: $(run_in "$DATADIR/gits/test-chunk" git rev-parse master) build-mode: bootstrap build-depends: [] EOF diff --git a/yarns/splitting.yarn b/yarns/splitting.yarn index 1b67a881..d4b942d8 100644 --- a/yarns/splitting.yarn +++ b/yarns/splitting.yarn @@ -141,7 +141,8 @@ Implementations chunks: - name: test-chunk repo: test:test-chunk - ref: master + unpetrify-ref: master + ref: $(run_in "$DATADIR/gits/test-chunk" git rev-parse master) morph: test-chunk.morph build-mode: test build-depends: [] @@ -189,13 +190,15 @@ Implementations chunks: - name: test-chunk repo: test:test-chunk - ref: master morph: test-chunk.morph + unpetrify-ref: master + ref: $(run_in "$DATADIR/gits/test-chunk" git rev-parse master) build-mode: test build-depends: [] - name: unbuildable-chunk repo: test:test-chunk - ref: refs/heads/master + unpetrify-ref: refs/heads/master + ref: $(run_in "$DATADIR/gits/test-chunk" git rev-parse master) morph: unbuildable-chunk.morph build-mode: test build-depends: |