From fa5c470ad5dd3a3416217363983eb3795ef53c79 Mon Sep 17 00:00:00 2001 From: Adam Coldrick Date: Sun, 12 Apr 2015 11:32:31 +0000 Subject: Add a test for `morph get-repo` Change-Id: Ie0ac708946c3b1d65d2022638c02d6a2d288ad9d --- yarns/branches-workspaces.yarn | 30 ++++++++++++++++++++++++++++++ yarns/implementations.yarn | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/yarns/branches-workspaces.yarn b/yarns/branches-workspaces.yarn index 27bddff5..6ccbe28f 100644 --- a/yarns/branches-workspaces.yarn +++ b/yarns/branches-workspaces.yarn @@ -212,6 +212,36 @@ fields when referring to strata, when it didn't before. AND in branch foo, system systems/test-system.morph refers to core without ref FINALLY the git server is shut down +`morph get-repo` can be used to just clone and checkout a repository, +without changing the morphologies in definitions. + + SCENARIO morph get-repo checks out a repository + GIVEN a workspace + AND a git server + WHEN the user creates a system branch called foo + AND the user gets the repo for chunk test-chunk in branch foo + THEN morph succeeded + AND the repo for chunk test-chunk was cloned into the system branch foo + +We can also specify the directory to clone the repo into. + + WHEN the user gets the repo for chunk test-chunk from branch foo in directory foo + THEN morph succeeded + AND the repo for chunk test-chunk was cloned into the directory foo + +A ref to checkout can also be specified. + + WHEN the user gets the repo for chunk test-chunk from branch foo in directory bar at ref master + THEN morph succeeded + AND the repo for chunk test-chunk was cloned into the directory bar + AND the repo in directory bar has HEAD master + +This should not work if the directory already exists. + + WHEN the user attempts to get the repo for chunk test-chunk from branch foo in directory foo + THEN morph failed + FINALLY the git server is shut down + Temporary Build Branch behaviour -------------------------------- diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn index faae44a8..e11a95b8 100644 --- a/yarns/implementations.yarn +++ b/yarns/implementations.yarn @@ -561,6 +561,43 @@ Editing morphologies with `morph edit`. echo "$MATCH_2" > "$DATADIR/git-branch.wanted" diff -u "$DATADIR/git-branch.wanted" "$DATADIR/git-branch.actual" +Cloning chunk repos with `morph get-repo`. + + IMPLEMENTS WHEN the user gets the repo for chunk (\S+) in branch (\S+) + cd "$DATADIR/workspace/$MATCH_2/test/morphs" + run_morph get-repo "$MATCH_1" + + IMPLEMENTS WHEN the user (gets|attempts to get) the repo for chunk (\S+) from branch (\S+) in directory (\S+) + cd "$DATADIR/workspace/$MATCH_3/test/morphs" + if [ $MATCH_1 == gets ]; then + run_morph get-repo "$MATCH_2" "$DATADIR/$MATCH_3"; + else + attempt_morph get-repo "$MATCH_2" "$DATADIR/$MATCH_3"; + fi + + IMPLEMENTS WHEN the user gets the repo for chunk (\S+) from branch (\S+) in directory (\S+) at ref (\S+) + cd "$DATADIR/workspace/$MATCH_2/test/morphs" + run_morph get-repo "$MATCH_1" "$DATADIR/$MATCH_3" --ref "$MATCH_4" + + IMPLEMENTS THEN the repo for chunk (\S+) was cloned into the system branch (\S+) + if [[ -d "$DATADIR/workspace/$MATCH_2/test/$MATCH_1" ]]; then + exit 0 + fi + exit 1 + + IMPLEMENTS THEN the repo for chunk (\S+) was cloned into the directory (\S+) + if [[ -d "$DATADIR/$MATCH_2" ]]; then + exit 0 + fi + exit 1 + + IMPLEMENTS THEN the repo in directory (\S+) has HEAD (\S+) + cd "$DATADIR/$MATCH_1" + if [ "$MATCH_2" == `git rev-parse --abbrev-ref HEAD` ]; then + exit 0 + fi + exit 1 + 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. -- cgit v1.2.1