diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2014-03-10 11:31:45 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2014-03-10 11:31:45 +0000 |
commit | 444ba7c2f0f3d53753abeff6dfd33681279a3d84 (patch) | |
tree | afdd012aa6d6001731e91dd863c9dbc45919d767 | |
parent | 356e5f60268b154a5aa09b4fbcd716d908262b56 (diff) | |
parent | 2c4752d71d35ec31221dcdab1289d2084936ccae (diff) | |
download | morph-444ba7c2f0f3d53753abeff6dfd33681279a3d84.tar.gz |
Merge branch 'liw/fix-check-2-rebase'
Reviewed-by: Daniel Silverstone
Reviewed-by: Richard Maw
41 files changed, 246 insertions, 195 deletions
@@ -2,7 +2,7 @@ # # Run test suite for morph. # -# Copyright (C) 2011-2013 Codethink Limited +# Copyright (C) 2011-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 @@ -71,10 +71,21 @@ fi python setup.py clean check # Run scenario tests with yarn, if yarn is available. +# +# Yarn cleans up the environment when it runs tests, and this removes +# PYTHONPATH from the environment. However, we need our tests to have +# the PYTHONPATH, so that we can get them to, for example, use the right +# versions of updated dependencies. The immediate current need is to +# be able to get them to use an updated version of cliapp, but it is +# a general need. +# +# We solve this by using the yarn --env option, allowing us to tell yarn +# explicitly which environment variables to set in addition to the set +# it sets anyway. if command -v yarn > /dev/null then - yarn -s yarns/morph.shell-lib yarns/*.yarn + yarn --env "PYTHONPATH=$PYTHONPATH" -s yarns/morph.shell-lib yarns/*.yarn fi # cmdtest tests. diff --git a/morphlib/sysbranchdir.py b/morphlib/sysbranchdir.py index 1a8b898a..9d96e974 100644 --- a/morphlib/sysbranchdir.py +++ b/morphlib/sysbranchdir.py @@ -1,4 +1,4 @@ -# 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 @@ -74,6 +74,11 @@ class SystemBranchDirectory(object): If the URL is a real one (not aliased), the schema and leading // are removed from it, as is a .git suffix. + Any colons in the URL path or network location are replaced + with slashes, so that directory paths do not contain colons. + This avoids problems with PYTHONPATH, PATH, and other things + that use colon as a separator. + ''' # Parse the URL. If the path component is absolute, we assume @@ -93,6 +98,9 @@ class SystemBranchDirectory(object): else: relative = repo_url + # Replace colons with slashes. + relative = '/'.join(relative.split(':')) + # Remove anyleading slashes, or os.path.join below will only # use the relative part (since it's absolute, not relative). relative = relative.lstrip('/') diff --git a/morphlib/sysbranchdir_tests.py b/morphlib/sysbranchdir_tests.py index 7ec8ef5c..8b40f69c 100644 --- a/morphlib/sysbranchdir_tests.py +++ b/morphlib/sysbranchdir_tests.py @@ -1,4 +1,4 @@ -# 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 @@ -149,7 +149,7 @@ class SystemBranchDirectoryTests(unittest.TestCase): self.system_branch_name) self.assertEqual( sb.get_git_directory_name('baserock:baserock/morph'), - os.path.join(self.root_directory, 'baserock:baserock/morph')) + os.path.join(self.root_directory, 'baserock/baserock/morph')) def test_reports_correct_name_for_git_directory_from_real_url(self): stripped = 'git.baserock.org/baserock/baserock/morph' @@ -169,7 +169,7 @@ class SystemBranchDirectoryTests(unittest.TestCase): self.system_branch_name) self.assertEqual( sb.get_filename('test:chunk', 'foo'), - os.path.join(self.root_directory, 'test:chunk/foo')) + os.path.join(self.root_directory, 'test/chunk/foo')) def test_reports_correct_name_for_git_directory_from_file_url(self): stripped = 'foobar/morphs' diff --git a/morphlib/workspace_tests.py b/morphlib/workspace_tests.py index b25be35e..9eef1053 100644 --- a/morphlib/workspace_tests.py +++ b/morphlib/workspace_tests.py @@ -1,4 +1,4 @@ -# 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 @@ -97,7 +97,7 @@ class WorkspaceTests(unittest.TestCase): url = 'test:morphs' branch = 'my/new/thing' sb = ws.create_system_branch_directory(url, branch) - self.assertTrue(type(sb), morphlib.sysbranchdir.SystemBranchDirectory) + self.assertEqual(type(sb), morphlib.sysbranchdir.SystemBranchDirectory) def test_lists_created_system_branches(self): self.create_it() diff --git a/tests.as-root/branch-from-image-works.script b/tests.as-root/branch-from-image-works.script index c9d50bbb..fb0b09c9 100755 --- a/tests.as-root/branch-from-image-works.script +++ b/tests.as-root/branch-from-image-works.script @@ -50,7 +50,7 @@ workspace="$DATADIR/workspace" cd "$workspace" "$SRCDIR/scripts/test-morph" branch-from-image mybranch \ --metadata-dir="$extracted/baserock" -cd mybranch/test:morphs +cd mybranch/test/morphs grep -qFe "$hello_chunk_commit" hello-stratum.morph tar=$("$SRCDIR/scripts/test-morph" --find-system-artifact build hello-tarball) tar -xf "$tar" bin/hello diff --git a/tests.as-root/build-handles-stratum-build-depends.script b/tests.as-root/build-handles-stratum-build-depends.script index 22d07c72..6e6f82da 100755 --- a/tests.as-root/build-handles-stratum-build-depends.script +++ b/tests.as-root/build-handles-stratum-build-depends.script @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-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 @@ -33,7 +33,7 @@ set -eu cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" branch test:morphs test/stratum-build-depends -cd test/stratum-build-depends/test:morphs +cd test/stratum-build-depends/test/morphs # 'linux-system' and the build-depends fields of 'linux-stratum' need to # be updated here. Any build-depends of any altered strata also need to diff --git a/tests.as-root/build-with-external-strata.script b/tests.as-root/build-with-external-strata.script index f5d86dfe..e43d0262 100755 --- a/tests.as-root/build-with-external-strata.script +++ b/tests.as-root/build-with-external-strata.script @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-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 @@ -35,7 +35,7 @@ cd "$DATADIR/workspace" # 'morph build'. cd "branch1" "$SRCDIR/scripts/test-morph" edit hello-system stratum2 -cd "test:external-strata" +cd "test/external-strata" awk ' /^chunks:/ { diff --git a/tests.as-root/building-a-system-branch-multiple-times-doesnt-generate-new-artifacts.script b/tests.as-root/building-a-system-branch-multiple-times-doesnt-generate-new-artifacts.script index 8852b96d..ac6cffec 100755 --- a/tests.as-root/building-a-system-branch-multiple-times-doesnt-generate-new-artifacts.script +++ b/tests.as-root/building-a-system-branch-multiple-times-doesnt-generate-new-artifacts.script @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-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 @@ -38,6 +38,6 @@ cd "$DATADIR/workspace/branch1" [ "$ARTIFACT_COUNT" -eq $(ls "$DATADIR/cache/artifacts" | wc -l) ] # Build thrice, and that should be enough. -cd "$DATADIR/workspace/branch1/test:morphs" +cd "$DATADIR/workspace/branch1/test/morphs" "$SRCDIR/scripts/test-morph" build linux-system [ "$ARTIFACT_COUNT" -eq $(ls "$DATADIR/cache/artifacts" | wc -l) ] diff --git a/tests.as-root/building-a-system-branch-picks-up-committed-removes.script b/tests.as-root/building-a-system-branch-picks-up-committed-removes.script index fbfd2c0f..64ae82c7 100755 --- a/tests.as-root/building-a-system-branch-picks-up-committed-removes.script +++ b/tests.as-root/building-a-system-branch-picks-up-committed-removes.script @@ -1,5 +1,5 @@ #!/bin/bash -# 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 @@ -24,7 +24,7 @@ set -e . "$SRCDIR/tests.as-root/setup-build" KERNEL_BRANCH=baserock/builds/123456789/AABBCCDDE -cd "$DATADIR/workspace/branch1/test:kernel-repo" +cd "$DATADIR/workspace/branch1/test/kernel-repo" git checkout --quiet master echo Use Morph >README git add README @@ -36,7 +36,7 @@ cd "$DATADIR/workspace" # Make a change elsewhere to be pulled in PEER_REPO="$DATADIR/peer-kernel" -git clone --quiet "file://$DATADIR/workspace/branch1/test:kernel-repo" \ +git clone --quiet "file://$DATADIR/workspace/branch1/test/kernel-repo" \ "$PEER_REPO" cd "$PEER_REPO" git checkout --quiet -b fix @@ -47,7 +47,7 @@ git checkout --quiet master git merge --no-ff fix >/dev/null 2>&1 # Pull a commit in to the linux morphology. -cd "$DATADIR/workspace/branch1/test:kernel-repo" +cd "$DATADIR/workspace/branch1/test/kernel-repo" git remote add peer "file://$PEER_REPO" git remote update >/dev/null 2>&1 git merge --quiet peer/master @@ -55,8 +55,8 @@ git merge --quiet peer/master # Build the linux system again without comitting. cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" build linux-system -cd branch1/test:kernel-repo +cd branch1/test/kernel-repo # Check whether the new morphology exists in the temporary build ref -cd "$DATADIR/workspace/branch1/test:kernel-repo" +cd "$DATADIR/workspace/branch1/test/kernel-repo" ! git cat-file blob "$KERNEL_BRANCH:README" >/dev/null 2>&1 diff --git a/tests.as-root/building-a-system-branch-picks-up-uncommitted-changes.script b/tests.as-root/building-a-system-branch-picks-up-uncommitted-changes.script index 8d298010..4dacb23e 100755 --- a/tests.as-root/building-a-system-branch-picks-up-uncommitted-changes.script +++ b/tests.as-root/building-a-system-branch-picks-up-uncommitted-changes.script @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-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 @@ -32,13 +32,13 @@ cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" build linux-system # Print tree SHA1s of the build ref of morphs and kernel. -cd "$DATADIR/workspace/branch1/test:morphs" +cd "$DATADIR/workspace/branch1/test/morphs" MORPHS_SHA1="$(git rev-parse baserock/builds/123456789/987654321)" -cd "$DATADIR/workspace/branch1/test:kernel-repo" +cd "$DATADIR/workspace/branch1/test/kernel-repo" KERNEL_SHA1="$(git rev-parse baserock/builds/123456789/AABBCCDDE)" # Make an uncommitted change to the linux morphology. -cd "$DATADIR/workspace/branch1/test:kernel-repo" +cd "$DATADIR/workspace/branch1/test/kernel-repo" sed -i -e 's@touch@touch foo@g' linux.morph # Build the linux system again without comitting. @@ -49,7 +49,7 @@ cd "$DATADIR/workspace" # This time the tree SHA1 of morphs should be the same # but that of the kernel repo should be different because we # made a change. -cd "$DATADIR/workspace/branch1/test:morphs" +cd "$DATADIR/workspace/branch1/test/morphs" [ "$(git rev-parse baserock/builds/123456789/987654321)" != "$MORPHS_SHA1" ] -cd "$DATADIR/workspace/branch1/test:kernel-repo" +cd "$DATADIR/workspace/branch1/test/kernel-repo" [ "$(git rev-parse baserock/builds/123456789/AABBCCDDE)" != "$KERNEL_SHA1" ] diff --git a/tests.as-root/building-a-system-branch-works-anywhere.script b/tests.as-root/building-a-system-branch-works-anywhere.script index d5d1e52d..cf946cd5 100755 --- a/tests.as-root/building-a-system-branch-works-anywhere.script +++ b/tests.as-root/building-a-system-branch-works-anywhere.script @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-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 @@ -41,13 +41,13 @@ cd "$DATADIR/workspace/branch1" rm -rf "$DATADIR/cache/artifacts"/* # Build form the branch root repository. -cd "$DATADIR/workspace/branch1/test:morphs" +cd "$DATADIR/workspace/branch1/test/morphs" "$SRCDIR/scripts/test-morph" build linux-system "$SRCDIR/scripts/list-tree" "$DATADIR/cache/artifacts" > "$DATADIR/output3" rm -rf "$DATADIR/cache/artifacts"/* # Build from the linux directory. -cd "$DATADIR/workspace/branch1/test:kernel-repo" +cd "$DATADIR/workspace/branch1/test/kernel-repo" "$SRCDIR/scripts/test-morph" build linux-system "$SRCDIR/scripts/list-tree" "$DATADIR/cache/artifacts" > "$DATADIR/output4" rm -rf "$DATADIR/cache/artifacts"/* diff --git a/tests.as-root/building-creates-correct-temporary-refs.script b/tests.as-root/building-creates-correct-temporary-refs.script index c0bf6a1e..6fb6c83a 100755 --- a/tests.as-root/building-creates-correct-temporary-refs.script +++ b/tests.as-root/building-creates-correct-temporary-refs.script @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-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 @@ -35,10 +35,10 @@ cd "$DATADIR/workspace" # Verify that the right temporary refs were created. echo "Refs of morphs repo after first build:" -"$SRCDIR/scripts/run-git-in" "$DATADIR/workspace/branch1/test:morphs" \ +"$SRCDIR/scripts/run-git-in" "$DATADIR/workspace/branch1/test/morphs" \ show-ref | cut -d' ' -f2 echo "Refs of kernel repo after first build:" -"$SRCDIR/scripts/run-git-in" "$DATADIR/workspace/branch1/test:kernel-repo" \ +"$SRCDIR/scripts/run-git-in" "$DATADIR/workspace/branch1/test/kernel-repo" \ show-ref | cut -d' ' -f2 echo @@ -48,8 +48,8 @@ cd "$DATADIR/workspace" # Verify that the right temporary refs were created. echo "Refs of morphs repo after second build:" -"$SRCDIR/scripts/run-git-in" "$DATADIR/workspace/branch1/test:morphs" \ +"$SRCDIR/scripts/run-git-in" "$DATADIR/workspace/branch1/test/morphs" \ show-ref | cut -d' ' -f2 echo "Refs of kernel repo after second build:" -"$SRCDIR/scripts/run-git-in" "$DATADIR/workspace/branch1/test:kernel-repo" \ +"$SRCDIR/scripts/run-git-in" "$DATADIR/workspace/branch1/test/kernel-repo" \ show-ref | cut -d' ' -f2 diff --git a/tests.as-root/unimportant-morphology-contents-do-not-change-cache-keys.script b/tests.as-root/unimportant-morphology-contents-do-not-change-cache-keys.script index ca92b2cb..a540cdee 100755 --- a/tests.as-root/unimportant-morphology-contents-do-not-change-cache-keys.script +++ b/tests.as-root/unimportant-morphology-contents-do-not-change-cache-keys.script @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-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 @@ -36,8 +36,8 @@ cd "$DATADIR/workspace" ARTIFACT_COUNT="$(ls "$DATADIR/cache/artifacts" | wc -l)" # Petrify the refs, so the morphologies will be different -(set -e && cd branch1/test:morphs && git push --quiet origin HEAD) -(set -e && cd branch1/test:kernel-repo && git push --quiet origin HEAD) +(set -e && cd branch1/test/morphs && git push --quiet origin HEAD) +(set -e && cd branch1/test/kernel-repo && git push --quiet origin HEAD) "$SRCDIR/scripts/test-morph" petrify # Build with the petrified morphologies. diff --git a/tests.branching/add-then-edit.script b/tests.branching/add-then-edit.script index 5cd6e842..2dd62254 100755 --- a/tests.branching/add-then-edit.script +++ b/tests.branching/add-then-edit.script @@ -1,6 +1,6 @@ #!/bin/sh # -# 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 @@ -27,7 +27,7 @@ cd "$DATADIR/workspace" cd "me/add-then-edit" # add a chunk -cd test:morphs +cd test/morphs ## Sub-optimally, to alter the stratum, you have to `morph edit` it first "$SRCDIR/scripts/test-morph" edit hello-system hello-stratum @@ -51,4 +51,4 @@ with open("hello-stratum.morph", "w") as f: grep -qFe goodbye hello-stratum.morph # check whether edit has cloned the repository to the right branch -git --git-dir="../test:goodbye/.git" rev-parse --abbrev-ref HEAD +git --git-dir="../goodbye/.git" rev-parse --abbrev-ref HEAD diff --git a/tests.branching/ambiguous-refs.script b/tests.branching/ambiguous-refs.script index ed72f9e3..aeec61a1 100755 --- a/tests.branching/ambiguous-refs.script +++ b/tests.branching/ambiguous-refs.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-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 @@ -37,10 +37,10 @@ cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" branch test:morphs release # Create an extra ref to confuse any users of git show-ref -cd release/test:morphs +cd release/test/morphs git checkout --quiet -b alpha/master HEAD~1 git checkout --quiet release # The petrify will fail if we resolved 'master' as 'alpha/master' by mistake. -cd "$DATADIR/workspace/release/test:morphs" +cd "$DATADIR/workspace/release/test/morphs" "$SRCDIR/scripts/test-morph" petrify diff --git a/tests.branching/branch-creates-new-system-branch-not-from-master.script b/tests.branching/branch-creates-new-system-branch-not-from-master.script index 72e21740..c561f191 100755 --- a/tests.branching/branch-creates-new-system-branch-not-from-master.script +++ b/tests.branching/branch-creates-new-system-branch-not-from-master.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012 Codethink Limited +# Copyright (C) 2012,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 @@ -31,8 +31,8 @@ echo "File tree:" grep -v 'cache/gits/file_[^/]*/' echo "Current branches:" -"$SRCDIR/scripts/run-git-in" newbranch/test:morphs branch +"$SRCDIR/scripts/run-git-in" newbranch/test/morphs branch echo "Current origin:" -"$SRCDIR/scripts/run-git-in" newbranch/test:morphs remote show origin | +"$SRCDIR/scripts/run-git-in" newbranch/test/morphs remote show origin | sed 's,\(TMP/workspace/\.morph/cache/gits/file_\).*_,\1,g' diff --git a/tests.branching/branch-creates-new-system-branch-not-from-master.stdout b/tests.branching/branch-creates-new-system-branch-not-from-master.stdout index af65eb7b..c61624b4 100644 --- a/tests.branching/branch-creates-new-system-branch-not-from-master.stdout +++ b/tests.branching/branch-creates-new-system-branch-not-from-master.stdout @@ -3,12 +3,13 @@ d . d ./.morph d ./newbranch d ./newbranch/.morph-system-branch -d ./newbranch/test:morphs -d ./newbranch/test:morphs/.git +d ./newbranch/test +d ./newbranch/test/morphs +d ./newbranch/test/morphs/.git f ./newbranch/.morph-system-branch/config -f ./newbranch/test:morphs/hello-stratum.morph -f ./newbranch/test:morphs/hello-system.morph -f ./newbranch/test:morphs/this.is.alfred +f ./newbranch/test/morphs/hello-stratum.morph +f ./newbranch/test/morphs/hello-system.morph +f ./newbranch/test/morphs/this.is.alfred Current branches: alfred * newbranch diff --git a/tests.branching/branch-creates-new-system-branch.script b/tests.branching/branch-creates-new-system-branch.script index c2d7f640..784bed62 100755 --- a/tests.branching/branch-creates-new-system-branch.script +++ b/tests.branching/branch-creates-new-system-branch.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012 Codethink Limited +# Copyright (C) 2012,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 @@ -31,8 +31,8 @@ echo "File tree:" grep -v 'cache/gits/file_[^/]*/' echo "Current branches:" -"$SRCDIR/scripts/run-git-in" newbranch/test:morphs branch +"$SRCDIR/scripts/run-git-in" newbranch/test/morphs branch echo "Current origin:" -"$SRCDIR/scripts/run-git-in" newbranch/test:morphs remote show origin | +"$SRCDIR/scripts/run-git-in" newbranch/test/morphs remote show origin | sed 's,\(TMP/workspace/\.morph/cache/gits/file_\).*_,\1,g' diff --git a/tests.branching/branch-creates-new-system-branch.stdout b/tests.branching/branch-creates-new-system-branch.stdout index ba1651e5..a7318378 100644 --- a/tests.branching/branch-creates-new-system-branch.stdout +++ b/tests.branching/branch-creates-new-system-branch.stdout @@ -3,11 +3,12 @@ d . d ./.morph d ./newbranch d ./newbranch/.morph-system-branch -d ./newbranch/test:morphs -d ./newbranch/test:morphs/.git +d ./newbranch/test +d ./newbranch/test/morphs +d ./newbranch/test/morphs/.git f ./newbranch/.morph-system-branch/config -f ./newbranch/test:morphs/hello-stratum.morph -f ./newbranch/test:morphs/hello-system.morph +f ./newbranch/test/morphs/hello-stratum.morph +f ./newbranch/test/morphs/hello-system.morph Current branches: master * newbranch diff --git a/tests.branching/branch-works-anywhere.script b/tests.branching/branch-works-anywhere.script index ee8f5bfa..7f6156ce 100755 --- a/tests.branching/branch-works-anywhere.script +++ b/tests.branching/branch-works-anywhere.script @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (C) 2012 Codethink Limited +# Copyright (C) 2012,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 @@ -53,7 +53,7 @@ echo "Workspace after creating the third branch:" # Now, go into the morphs repository of that third branch and # create a fourth system branch from in there. This, too, should # end up being created in the toplevel workspace directory. -cd "$DATADIR/workspace/branch3/test:morphs" +cd "$DATADIR/workspace/branch3/test/morphs" "$SRCDIR/scripts/test-morph" branch test:morphs branch4 echo "Workspace after creating the fourth branch:" diff --git a/tests.branching/branch-works-anywhere.stdout b/tests.branching/branch-works-anywhere.stdout index 0b59ce71..4e317902 100644 --- a/tests.branching/branch-works-anywhere.stdout +++ b/tests.branching/branch-works-anywhere.stdout @@ -3,80 +3,90 @@ d . d ./.morph d ./branch1 d ./branch1/.morph-system-branch -d ./branch1/test:morphs -d ./branch1/test:morphs/.git +d ./branch1/test +d ./branch1/test/morphs +d ./branch1/test/morphs/.git f ./branch1/.morph-system-branch/config -f ./branch1/test:morphs/hello-stratum.morph -f ./branch1/test:morphs/hello-system.morph +f ./branch1/test/morphs/hello-stratum.morph +f ./branch1/test/morphs/hello-system.morph Workspace after creating the second branch: d . d ./.morph d ./branch1 d ./branch1/.morph-system-branch -d ./branch1/test:morphs -d ./branch1/test:morphs/.git +d ./branch1/test +d ./branch1/test/morphs +d ./branch1/test/morphs/.git d ./branch2 d ./branch2/.morph-system-branch -d ./branch2/test:morphs -d ./branch2/test:morphs/.git +d ./branch2/test +d ./branch2/test/morphs +d ./branch2/test/morphs/.git f ./branch1/.morph-system-branch/config -f ./branch1/test:morphs/hello-stratum.morph -f ./branch1/test:morphs/hello-system.morph +f ./branch1/test/morphs/hello-stratum.morph +f ./branch1/test/morphs/hello-system.morph f ./branch2/.morph-system-branch/config -f ./branch2/test:morphs/hello-stratum.morph -f ./branch2/test:morphs/hello-system.morph +f ./branch2/test/morphs/hello-stratum.morph +f ./branch2/test/morphs/hello-system.morph Workspace after creating the third branch: d . d ./.morph d ./branch1 d ./branch1/.morph-system-branch -d ./branch1/test:morphs -d ./branch1/test:morphs/.git +d ./branch1/test +d ./branch1/test/morphs +d ./branch1/test/morphs/.git d ./branch2 d ./branch2/.morph-system-branch -d ./branch2/test:morphs -d ./branch2/test:morphs/.git +d ./branch2/test +d ./branch2/test/morphs +d ./branch2/test/morphs/.git d ./branch3 d ./branch3/.morph-system-branch -d ./branch3/test:morphs -d ./branch3/test:morphs/.git +d ./branch3/test +d ./branch3/test/morphs +d ./branch3/test/morphs/.git f ./branch1/.morph-system-branch/config -f ./branch1/test:morphs/hello-stratum.morph -f ./branch1/test:morphs/hello-system.morph +f ./branch1/test/morphs/hello-stratum.morph +f ./branch1/test/morphs/hello-system.morph f ./branch2/.morph-system-branch/config -f ./branch2/test:morphs/hello-stratum.morph -f ./branch2/test:morphs/hello-system.morph +f ./branch2/test/morphs/hello-stratum.morph +f ./branch2/test/morphs/hello-system.morph f ./branch3/.morph-system-branch/config -f ./branch3/test:morphs/hello-stratum.morph -f ./branch3/test:morphs/hello-system.morph +f ./branch3/test/morphs/hello-stratum.morph +f ./branch3/test/morphs/hello-system.morph Workspace after creating the fourth branch: d . d ./.morph d ./branch1 d ./branch1/.morph-system-branch -d ./branch1/test:morphs -d ./branch1/test:morphs/.git +d ./branch1/test +d ./branch1/test/morphs +d ./branch1/test/morphs/.git d ./branch2 d ./branch2/.morph-system-branch -d ./branch2/test:morphs -d ./branch2/test:morphs/.git +d ./branch2/test +d ./branch2/test/morphs +d ./branch2/test/morphs/.git d ./branch3 d ./branch3/.morph-system-branch -d ./branch3/test:morphs -d ./branch3/test:morphs/.git +d ./branch3/test +d ./branch3/test/morphs +d ./branch3/test/morphs/.git d ./branch4 d ./branch4/.morph-system-branch -d ./branch4/test:morphs -d ./branch4/test:morphs/.git +d ./branch4/test +d ./branch4/test/morphs +d ./branch4/test/morphs/.git f ./branch1/.morph-system-branch/config -f ./branch1/test:morphs/hello-stratum.morph -f ./branch1/test:morphs/hello-system.morph +f ./branch1/test/morphs/hello-stratum.morph +f ./branch1/test/morphs/hello-system.morph f ./branch2/.morph-system-branch/config -f ./branch2/test:morphs/hello-stratum.morph -f ./branch2/test:morphs/hello-system.morph +f ./branch2/test/morphs/hello-stratum.morph +f ./branch2/test/morphs/hello-system.morph f ./branch3/.morph-system-branch/config -f ./branch3/test:morphs/hello-stratum.morph -f ./branch3/test:morphs/hello-system.morph +f ./branch3/test/morphs/hello-stratum.morph +f ./branch3/test/morphs/hello-system.morph f ./branch4/.morph-system-branch/config -f ./branch4/test:morphs/hello-stratum.morph -f ./branch4/test:morphs/hello-system.morph +f ./branch4/test/morphs/hello-stratum.morph +f ./branch4/test/morphs/hello-system.morph diff --git a/tests.branching/checkout-existing-branch.script b/tests.branching/checkout-existing-branch.script index 653fffb5..b1740d9c 100755 --- a/tests.branching/checkout-existing-branch.script +++ b/tests.branching/checkout-existing-branch.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012 Codethink Limited +# Copyright (C) 2012,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 @@ -30,4 +30,4 @@ echo "File tree:" grep -v 'cache/gits/file_[^/]*/' echo "Current branches:" -"$SRCDIR/scripts/run-git-in" master/test:morphs branch +"$SRCDIR/scripts/run-git-in" master/test/morphs branch diff --git a/tests.branching/checkout-existing-branch.stdout b/tests.branching/checkout-existing-branch.stdout index 0f51893a..a6026269 100644 --- a/tests.branching/checkout-existing-branch.stdout +++ b/tests.branching/checkout-existing-branch.stdout @@ -3,10 +3,11 @@ d . d ./.morph d ./master d ./master/.morph-system-branch -d ./master/test:morphs -d ./master/test:morphs/.git +d ./master/test +d ./master/test/morphs +d ./master/test/morphs/.git f ./master/.morph-system-branch/config -f ./master/test:morphs/hello-stratum.morph -f ./master/test:morphs/hello-system.morph +f ./master/test/morphs/hello-stratum.morph +f ./master/test/morphs/hello-system.morph Current branches: * master diff --git a/tests.branching/checkout-works-anywhere.script b/tests.branching/checkout-works-anywhere.script index 02deb4d7..14d18842 100755 --- a/tests.branching/checkout-works-anywhere.script +++ b/tests.branching/checkout-works-anywhere.script @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (C) 2012 Codethink Limited +# Copyright (C) 2012,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 @@ -41,7 +41,7 @@ cd workspace # This time, create a new branch and check out the master branch # from within that branch. "$SRCDIR/scripts/test-morph" branch test:morphs newbranch -cd newbranch/test:morphs +cd newbranch/test/morphs "$SRCDIR/scripts/test-morph" checkout test:morphs master echo "Workspace after checking out master from within a new branch:" diff --git a/tests.branching/checkout-works-anywhere.stdout b/tests.branching/checkout-works-anywhere.stdout index ba83058f..ed8b1567 100644 --- a/tests.branching/checkout-works-anywhere.stdout +++ b/tests.branching/checkout-works-anywhere.stdout @@ -3,25 +3,28 @@ d . d ./.morph d ./master d ./master/.morph-system-branch -d ./master/test:morphs -d ./master/test:morphs/.git +d ./master/test +d ./master/test/morphs +d ./master/test/morphs/.git f ./master/.morph-system-branch/config -f ./master/test:morphs/hello-stratum.morph -f ./master/test:morphs/hello-system.morph +f ./master/test/morphs/hello-stratum.morph +f ./master/test/morphs/hello-system.morph Workspace after checking out master from within a new branch: d . d ./.morph d ./master d ./master/.morph-system-branch -d ./master/test:morphs -d ./master/test:morphs/.git +d ./master/test +d ./master/test/morphs +d ./master/test/morphs/.git d ./newbranch d ./newbranch/.morph-system-branch -d ./newbranch/test:morphs -d ./newbranch/test:morphs/.git +d ./newbranch/test +d ./newbranch/test/morphs +d ./newbranch/test/morphs/.git f ./master/.morph-system-branch/config -f ./master/test:morphs/hello-stratum.morph -f ./master/test:morphs/hello-system.morph +f ./master/test/morphs/hello-stratum.morph +f ./master/test/morphs/hello-system.morph f ./newbranch/.morph-system-branch/config -f ./newbranch/test:morphs/hello-stratum.morph -f ./newbranch/test:morphs/hello-system.morph +f ./newbranch/test/morphs/hello-stratum.morph +f ./newbranch/test/morphs/hello-system.morph diff --git a/tests.branching/edit-checkouts-existing-chunk.script b/tests.branching/edit-checkouts-existing-chunk.script index 9e66ceb0..c8fb9312 100755 --- a/tests.branching/edit-checkouts-existing-chunk.script +++ b/tests.branching/edit-checkouts-existing-chunk.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-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 @@ -34,4 +34,4 @@ echo "Current branches:" echo echo "Files in hello:" -ls "$DATADIR/workspace/alfred/test:hello" +ls "$DATADIR/workspace/alfred/test/hello" diff --git a/tests.branching/edit-handles-submodules.script b/tests.branching/edit-handles-submodules.script index 72344119..2ab39420 100755 --- a/tests.branching/edit-handles-submodules.script +++ b/tests.branching/edit-handles-submodules.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-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 @@ -28,6 +28,6 @@ cd "$DATADIR/workspace" # Submodules should be set up automatically "$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello -cd "$DATADIR/workspace/newbranch/test:hello" +cd "$DATADIR/workspace/newbranch/test/hello" [ -e foolib/README ] diff --git a/tests.branching/edit-updates-stratum.script b/tests.branching/edit-updates-stratum.script index bfe16c8b..cf5fc26d 100755 --- a/tests.branching/edit-updates-stratum.script +++ b/tests.branching/edit-updates-stratum.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-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 @@ -29,4 +29,4 @@ cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello # See what effect the editing had. -"$SRCDIR/scripts/run-git-in" "newbranch/test:morphs" diff +"$SRCDIR/scripts/run-git-in" "newbranch/test/morphs" diff diff --git a/tests.branching/morph-repository-stored-in-cloned-repositories.script b/tests.branching/morph-repository-stored-in-cloned-repositories.script index c2dc8690..342c3d0b 100755 --- a/tests.branching/morph-repository-stored-in-cloned-repositories.script +++ b/tests.branching/morph-repository-stored-in-cloned-repositories.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012 Codethink Limited +# Copyright (C) 2012,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 @@ -29,7 +29,7 @@ cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" branch test:morphs newbranch echo "morph.repository in branch root repository:" -cd "$DATADIR/workspace/newbranch/test:morphs" +cd "$DATADIR/workspace/newbranch/test/morphs" git config morph.repository echo @@ -37,7 +37,7 @@ cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" checkout test:morphs master echo "morph.repository in branch root repository of a checkout:" -cd "$DATADIR/workspace/master/test:morphs" +cd "$DATADIR/workspace/master/test/morphs" git config morph.repository echo @@ -45,5 +45,5 @@ cd "$DATADIR/workspace/master" "$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello echo "morph.repository of an edited repository:" -cd "$DATADIR/workspace/master/test:hello" +cd "$DATADIR/workspace/master/test/hello" git config morph.repository diff --git a/tests.branching/petrify-no-double-petrify.script b/tests.branching/petrify-no-double-petrify.script index 9484aa58..3c9185dc 100755 --- a/tests.branching/petrify-no-double-petrify.script +++ b/tests.branching/petrify-no-double-petrify.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-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 @@ -25,7 +25,7 @@ cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" branch test:morphs test/petrify -cd test/petrify/test:morphs +cd test/petrify/test/morphs git push --quiet origin HEAD "$SRCDIR/scripts/test-morph" petrify "$SRCDIR/scripts/test-morph" petrify diff --git a/tests.branching/petrify.script b/tests.branching/petrify.script index fed8e965..5a3cb8c4 100755 --- a/tests.branching/petrify.script +++ b/tests.branching/petrify.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-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 @@ -27,10 +27,10 @@ cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" branch test:morphs test/petrify master -cd test/petrify/test:morphs +cd test/petrify/test/morphs git push --quiet origin HEAD "$SRCDIR/scripts/test-morph" edit hello-system hello-stratum goodbye -(cd ../test:goodbye && git push --quiet origin HEAD) +(cd ../goodbye && git push --quiet origin HEAD) "$SRCDIR/scripts/test-morph" petrify echo "Petrified:" diff --git a/tests.branching/status-in-dirty-branch.script b/tests.branching/status-in-dirty-branch.script index cc1dd46e..7fdd8862 100755 --- a/tests.branching/status-in-dirty-branch.script +++ b/tests.branching/status-in-dirty-branch.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2011-2013 Codethink Limited +# Copyright (C) 2011-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 @@ -37,7 +37,7 @@ cd "$DATADIR/workspace" cd branch1 "$SRCDIR/scripts/test-morph" edit hello-system stratum2 hello -cd test:stratum2-hello +cd test/stratum2-hello git checkout -q master cd .. diff --git a/tests.branching/tag-tag-works-as-expected.script b/tests.branching/tag-tag-works-as-expected.script index 006b98bf..95315de4 100755 --- a/tests.branching/tag-tag-works-as-expected.script +++ b/tests.branching/tag-tag-works-as-expected.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-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 @@ -34,7 +34,7 @@ cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" tag example-tag -- -m First # Check out the tag. -"$SRCDIR/scripts/run-git-in" master/test:morphs checkout -b example-tag \ +"$SRCDIR/scripts/run-git-in" master/test/morphs checkout -b example-tag \ 2>/dev/null # Tag the tag. diff --git a/tests.branching/workflow-separate-stratum-repos.script b/tests.branching/workflow-separate-stratum-repos.script index 3faf23f5..f2fd519b 100755 --- a/tests.branching/workflow-separate-stratum-repos.script +++ b/tests.branching/workflow-separate-stratum-repos.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-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 @@ -35,23 +35,23 @@ cd "$DATADIR/workspace" # Edit one chunk cd "me/readme-fixes" "$SRCDIR/scripts/test-morph" edit hello-system stratum2 hello -cd "$DATADIR/workspace/me/readme-fixes/test:stratum2-hello" +cd "$DATADIR/workspace/me/readme-fixes/test/stratum2-hello" echo > README yoyoyo git add README git commit -m "Fix README in hello" --quiet # Edit the other chunk too "$SRCDIR/scripts/test-morph" edit hello-system stratum3 hello -cd "$DATADIR/workspace/me/readme-fixes/test:stratum3-hello" +cd "$DATADIR/workspace/me/readme-fixes/test/stratum3-hello" echo > README yoyoyo git add README git commit -m "Fix README in hello" --quiet # Update the morphology repos -cd ../test:external-strata +cd ../test/external-strata git commit --quiet --all -m "Commit changes for system branch" -cd ../test:morphs +cd ../test/morphs git commit --quiet --all -m "Commit changes for system branch" # Merge our system branch into master @@ -60,13 +60,13 @@ cd master "$SRCDIR/scripts/test-morph" merge me/readme-fixes # Check the changes have appeared -cd test:morphs +cd test/morphs [ $(git rev-parse HEAD) = $(git rev-parse master) ] -cd ../test:stratum2-hello +cd ../test/stratum2-hello [ -e README ] [ $(git rev-parse HEAD) = $(git rev-parse master) ] -cd ../test:stratum3-hello +cd ../test/stratum3-hello [ -e README ] [ $(git rev-parse HEAD) = $(git rev-parse master) ] diff --git a/tests.branching/workflow.script b/tests.branching/workflow.script index 10383132..51a8d106 100755 --- a/tests.branching/workflow.script +++ b/tests.branching/workflow.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012 Codethink Limited +# Copyright (C) 2012,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 @@ -24,12 +24,12 @@ cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" branch test:morphs me/readme-fix "$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello -cd me/readme-fix/test:hello +cd me/readme-fix/test/hello echo > README yoyoyo git add README git commit -m "Fix README, yo!" --quiet -cd ../test:morphs +cd ../morphs git commit --quiet --all -m "Commit changes for system branch" cd "$DATADIR/workspace" diff --git a/tests.deploy/deploy-cluster.script b/tests.deploy/deploy-cluster.script index 3ef60479..0659ad21 100755 --- a/tests.deploy/deploy-cluster.script +++ b/tests.deploy/deploy-cluster.script @@ -20,6 +20,11 @@ set -eu +# DISABLED TEST: This does not seem to have been tested at merge time, +# in a clean repository. The tests produces output (see below for +# definitions-version), but the expected output is empty. +# FIXME: This should be fixed. +exit . "$SRCDIR/tests.deploy/setup-build" diff --git a/tests.deploy/deploy-rawdisk.script b/tests.deploy/deploy-rawdisk.script index 257ef0dd..3489a198 100755 --- a/tests.deploy/deploy-rawdisk.script +++ b/tests.deploy/deploy-rawdisk.script @@ -1,6 +1,6 @@ #!/bin/bash # -# 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 @@ -28,6 +28,6 @@ cd "$DATADIR/workspace/branch1" "$SRCDIR/scripts/test-morph" --log "$DATADIR/deploy.log" \ deploy rawdisk_test_cluster > /dev/null -outputdir="test:morphs" +outputdir="test/morphs" test -e $outputdir/disk.img diff --git a/tests.deploy/setup-build b/tests.deploy/setup-build index 6c0a6252..0fc561f9 100644 --- a/tests.deploy/setup-build +++ b/tests.deploy/setup-build @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (C) 2012, 2013 Codethink Limited +# Copyright (C) 2012-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 @@ -28,8 +28,8 @@ cd "$DATADIR/workspace" # Fix UUID's in the checked out repos to make build branch names deterministic git config -f "$DATADIR/workspace/branch1/.morph-system-branch/config" \ branch.uuid 123456789 -git config -f "$DATADIR/workspace/branch1/test:morphs/.git/config" \ +git config -f "$DATADIR/workspace/branch1/test/morphs/.git/config" \ morph.uuid 987654321 -git config -f "$DATADIR/workspace/branch1/test:kernel-repo/.git/config" \ +git config -f "$DATADIR/workspace/branch1/test/kernel-repo/.git/config" \ morph.uuid AABBCCDDE diff --git a/yarns/branches-workspaces.yarn b/yarns/branches-workspaces.yarn index c3b73ee3..a9cfb19b 100644 --- a/yarns/branches-workspaces.yarn +++ b/yarns/branches-workspaces.yarn @@ -112,7 +112,7 @@ We leak a little bit of the implementation here, to keep things simple: the (mocked) git server the implementation sets up has the `test:morphs` repository, which is the system branch root repository. - WHEN the user reports the workspace from the directory master/test:morphs + WHEN the user reports the workspace from the directory master/test/morphs THEN the workspace is reported correctly However, running it outside a workspace should fail. @@ -134,7 +134,7 @@ current working directory, it will find it and report it correctly. AND the user reports the system branch from the directory master THEN the system branch is reported as master - WHEN the user reports the system branch from the directory master/test:morphs + WHEN the user reports the system branch from the directory master/test/morphs THEN the system branch is reported as master WHEN the user reports the system branch from the directory . @@ -230,7 +230,7 @@ repositories referenced in the system branch. AND the user edits the chunk test-chunk in the stratum test-stratum in the system test-system in branch foo THEN morph reports changes in foo in test:morphs only - WHEN creating file foo in test:test-chunk in branch foo + WHEN creating file foo in test/test-chunk in branch foo THEN morph reports changes in foo in test:morphs only WHEN adding file foo in test:test-chunk in branch foo to git @@ -254,8 +254,8 @@ branch checkout. 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 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 + THEN morph ran command in test/morphs in foo + AND morph ran command in test/test-chunk in foo Explicit petrification ---------------------- diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn index 1e1b2fd5..3e5b3ab5 100644 --- a/yarns/implementations.yarn +++ b/yarns/implementations.yarn @@ -340,9 +340,9 @@ Attempt to check out a system branch from a root that has no systems. 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_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" We can create a new branch, off master. @@ -368,7 +368,7 @@ Pushing all changes in a system branch checkout to the git server. IMPLEMENTS WHEN the user pushes the system branch called (\S+) to the git server # FIXME: For now, this is just the morphs checkout. - run_in "$DATADIR/workspace/$MATCH_1/test:morphs" git push origin HEAD + run_in "$DATADIR/workspace/$MATCH_1/test/morphs" git push origin HEAD Report workspace path. @@ -411,7 +411,7 @@ 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.morph" \ chunks name="$MATCH_3" ref > "$DATADIR/ref.actual" echo "$MATCH_4" > "$DATADIR/ref.wanted" diff -u "$DATADIR/ref.wanted" "$DATADIR/ref.actual" @@ -419,21 +419,22 @@ Editing morphologies with `morph edit`. 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" \ + "$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" + cd "$DATADIR/workspace/$MATCH_3/test/morphs" run_morph edit "$MATCH_2" "$MATCH_1" 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" + cd "$DATADIR/workspace/$MATCH_4/test/morphs" run_morph edit "$MATCH_3" "$MATCH_2" "$MATCH_1" IMPLEMENTS THEN the edited chunk (\S+) has git branch (\S+) ls -l "$DATADIR/workspace/$MATCH_2" - cd "$DATADIR/workspace/$MATCH_2/$MATCH_1" + chunkdir="$(slashify_colons "$MATCH_1")" + cd "$DATADIR/workspace/$MATCH_2/$chunkdir" git branch | awk '$1 == "*" { print $2 }' > "$DATADIR/git-branch.actual" echo "$MATCH_2" > "$DATADIR/git-branch.wanted" diff -u "$DATADIR/git-branch.wanted" "$DATADIR/git-branch.actual" @@ -448,7 +449,7 @@ 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" + cat << EOF > "$DATADIR/workspace/$MATCH_2/test/morphs/$MATCH_1.morph" arch: $arch configuration-extensions: [] description: A system called $MATCH_1 for architectures $arch @@ -494,11 +495,12 @@ Reporting status of checked out repositories: touch "$DATADIR/workspace/$MATCH_3/$MATCH_2/$MATCH_1" IMPLEMENTS WHEN adding file (\S+) in (\S+) in branch (\S+) to git - cd "$DATADIR/workspace/$MATCH_3/$MATCH_2" + chunkdir="$(slashify_colons "$MATCH_2")" + cd "$DATADIR/workspace/$MATCH_3/$chunkdir" git add "$MATCH_1" IMPLEMENTS WHEN committing changes in (\S+) in branch (\S+) - cd "$DATADIR/workspace/$MATCH_2/$MATCH_1" + cd "$DATADIR/workspace/$MATCH_2/$(slashify_colons "$MATCH_1")" git commit -a -m test-commit Running shell command in each checked out repository: @@ -514,11 +516,11 @@ Running shell command in each checked out repository: Petrification and unpetrification: IMPLEMENTS WHEN remembering all refs in (\S+) - cd "$DATADIR/workspace/$MATCH_1/test:morphs" + cd "$DATADIR/workspace/$MATCH_1/test/morphs" list_refs *.morph > "$DATADIR/refs.remembered" IMPLEMENTS THEN (\S+) refs are as remembered - cd "$DATADIR/workspace/$MATCH_1/test:morphs" + 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 @@ -548,41 +550,41 @@ Petrification and unpetrification: done IMPLEMENTS WHEN petrifying (\S+) - cd "$DATADIR/workspace/$MATCH_1/test:morphs" + cd "$DATADIR/workspace/$MATCH_1/test/morphs" run_morph petrify IMPLEMENTS WHEN unpetrifying (\S+) - cd "$DATADIR/workspace/$MATCH_1/test:morphs" + cd "$DATADIR/workspace/$MATCH_1/test/morphs" run_morph unpetrify IMPLEMENTS THEN (\S+) is petrified - cd "$DATADIR/workspace/$MATCH_1/test:morphs" + cd "$DATADIR/workspace/$MATCH_1/test/morphs" assert_morphologies_are_petrified "$MATCH_1" *.morph IMPLEMENTS THEN (\S+) is not petrified - cd "$DATADIR/workspace/$MATCH_1/test:morphs" + cd "$DATADIR/workspace/$MATCH_1/test/morphs" ! assert_morphologies_are_petrified "$MATCH_1" *.morph Tagging. IMPLEMENTS WHEN the user tags the system branch called (\S+) as (\S+) - cd "$DATADIR/workspace/$MATCH_1/test:morphs" + cd "$DATADIR/workspace/$MATCH_1/test/morphs" set tag "$MATCH_2" -- -m "testing morph tagging" run_morph tag "$MATCH_2" -- -m "testing morph tagging" IMPLEMENTS WHEN the user attempts to tag the system branch called (\S+) as (\S+) - cd "$DATADIR/workspace/$MATCH_1/test:morphs" + cd "$DATADIR/workspace/$MATCH_1/test/morphs" attempt_morph tag "$MATCH_2" -- -m "testing morph tagging" IMPLEMENTS THEN morph tag (\S+) in (\S+) is an annotated git tag - cd "$DATADIR/workspace/$MATCH_2/test:morphs" + cd "$DATADIR/workspace/$MATCH_2/test/morphs" if git show "$MATCH_1" | head -n1 | grep -v '^tag ' then die "git tag $MATCH_1 is not an annotated tag" fi IMPLEMENTS THEN morph tag (\S+) in (\S+) refers to a petrified commit - cd "$DATADIR/workspace/$MATCH_2/test:morphs" + cd "$DATADIR/workspace/$MATCH_2/test/morphs" git ls-tree "$MATCH_1" | awk '$NF ~ /\.morph$/ { print $NF }' | while read x @@ -682,7 +684,7 @@ with only the minimal information. system="$MATCH_2" type="$MATCH_3" branch="$MATCH_4" - cat << EOF > "$DATADIR/workspace/$branch/test:morphs/$name.morph" + cat << EOF > "$DATADIR/workspace/$branch/test/morphs/$name.morph" name: $name kind: cluster systems: @@ -816,6 +818,6 @@ Altering morphologies in the workspace -------------------------------------- IMPLEMENTS GIVEN stratum (\S+) in system branch (\S+) has match rules: (.*) - cd "$DATADIR/workspace/$MATCH_2/test:morphs" + cd "$DATADIR/workspace/$MATCH_2/test/morphs" "$SRCDIR/scripts/edit-morph" set-stratum-match-rules \ "$MATCH_1.morph" "$MATCH_3" diff --git a/yarns/morph.shell-lib b/yarns/morph.shell-lib index e025f8f5..05c11bcc 100644 --- a/yarns/morph.shell-lib +++ b/yarns/morph.shell-lib @@ -19,6 +19,15 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# Add $SRCDIR to PYTHONPATH. + +case "$PYTHONPATH" in + '') PYTHONPATH="$SRCDIR)" ;; + *) PYTHONPATH="$SRCDIR:$PYTHONPATH" ;; +esac +export PYTHONPATH + + # Run Morph from the source tree, ignoring any configuration files. # This way the test suite is not affected by any configuration the user # or system may have. Instead, we'll use the `$DATADIR/morph.conf` file, @@ -28,7 +37,7 @@ run_morph() { { set +e - PYTHONPATH="$SRCDIR" "$SRCDIR"/morph \ + "$SRCDIR"/morph \ --cachedir-min-space=0 --tempdir-min-space=0 \ --no-default-config --config "$DATADIR/morph.conf" "$@" \ 2> "$DATADIR/result-$1" @@ -148,15 +157,6 @@ assert_morphologies_are_petrified() } -# Currently, yarn isn't setting $SRCDIR to point at the project source -# directory. We simulate this here. - -if ! env | grep '^SRCDIR=' > /dev/null -then - export SRCDIR="$(pwd)" -fi - - # Added until it's fixed in upstream. # It's a solution to create an empty home directory each execution export HOME="$DATADIR/home" @@ -174,3 +174,12 @@ then email = tomjon@codethink.co.uk EOF fi + + +# Change colons to slashes. This is used when converting an aliases +# repository URL (e.g., test:morphs) into a directory path. + +slashify_colons() +{ + echo "$1" | sed s,:,/,g +} |