diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2012-10-29 16:02:42 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2012-10-29 18:19:26 +0000 |
commit | 1342bf9006f28a08d1b32dc8218717ebda701dc2 (patch) | |
tree | 0872d902b6ad4af6c4e238a28bc0c01624c62e0b /tests.branching | |
parent | 9e4159ba97862c78a9cfa3e3816f18c708ccba5e (diff) | |
download | morph-1342bf9006f28a08d1b32dc8218717ebda701dc2.tar.gz |
Split merge tests out from the other branching tests
Merge is by far the most complex of the branching and merging commands.
Diffstat (limited to 'tests.branching')
28 files changed, 3 insertions, 764 deletions
diff --git a/tests.branching/merge-conflict-chunks.script b/tests.branching/merge-conflict-chunks.script deleted file mode 100755 index 547f6b62..00000000 --- a/tests.branching/merge-conflict-chunks.script +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/sh -# Copyright (C) 2012 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -# When conflicts occur outside the root morphs repository, 'morph merge' -# should keep going until the end and report the list of failed repos. - -set -eu - -# Disable test on versions of Python before 2.7. -if ! python --version 2>&1 | grep '^Python 2\.[78]' > /dev/null -then - cat "$SRCDIR/tests.branching/merge-conflict-chunks.stdout" - cat "$SRCDIR/tests.branching/merge-conflict-chunks.stderr" >&2 - exit 0 -fi - -. "$SRCDIR/tests.branching/setup-3rd-party-strata" - -# Create stable branch to merge TO -"$SRCDIR/scripts/test-morph" branch baserock:morphs test/stable -cd test/stable/baserock:morphs -git push --quiet origin test/stable - -# Create feature branch to merge FROM -"$SRCDIR/scripts/test-morph" branch baserock:morphs test/feature test/stable - -add_text_in_repo() { - REPO="$1" - TEXT="$2" - - cd "$1" - echo $TEXT > conflict.txt - git add conflict.txt - git commit --quiet --message "Add some text" - cd - > /dev/null -} - -# Sow the seeds of conflict -cd "$DATADIR/workspace/test/stable" -"$SRCDIR/scripts/test-morph" edit hello-system stratum2 hello -"$SRCDIR/scripts/test-morph" edit hello-system stratum3 hello -add_text_in_repo "baserock:stratum2-hello" "xyzzy" -add_text_in_repo "baserock:stratum3-hello" "xyzzy" - -cd "$DATADIR/workspace/test/feature" -"$SRCDIR/scripts/test-morph" edit hello-system stratum2 hello -"$SRCDIR/scripts/test-morph" edit hello-system stratum3 hello -add_text_in_repo "baserock:stratum2-hello" "plugh" -add_text_in_repo "baserock:stratum3-hello" "plover" - -# This should not be necessary, one day -cd "$DATADIR/workspace/test/stable/baserock:morphs" -git commit --quiet --all --message "Commit refs for branch" -cd "$DATADIR/workspace/test/stable/baserock:external-strata" -git commit --quiet --all --message "Commit refs for branch" - -cd "$DATADIR/workspace/test/feature/baserock:morphs" -git commit --quiet --all --message "Commit refs for branch" -cd "$DATADIR/workspace/test/feature/baserock:external-strata" -git commit --quiet --all --message "Commit refs for branch" - -# Merge changes from test/feature to test/stable -cd "$DATADIR/workspace/test/stable" -"$SRCDIR/scripts/test-morph" merge test/feature || true - -# Check that the repos are all clean -for repo in "baserock:morphs" "baserock:external-strata" \ - "baserock:stratum2-hello" "baserock:stratum3-hello"; do - cd "$DATADIR/workspace/test/stable/$repo" - git status --porcelain - [ $(git rev-parse HEAD) = $(git rev-parse test/stable) ] -done diff --git a/tests.branching/merge-conflict-chunks.stderr b/tests.branching/merge-conflict-chunks.stderr deleted file mode 100644 index 57aafa5a..00000000 --- a/tests.branching/merge-conflict-chunks.stderr +++ /dev/null @@ -1 +0,0 @@ -ERROR: merge errors were encountered. Please manually merge the target ref into test/feature in the remote system branch in each case, and then repeat the 'morph merge' operation. diff --git a/tests.branching/merge-conflict-chunks.stdout b/tests.branching/merge-conflict-chunks.stdout deleted file mode 100644 index bf6d3828..00000000 --- a/tests.branching/merge-conflict-chunks.stdout +++ /dev/null @@ -1,4 +0,0 @@ -Merge conflicts in baserock:stratum2-hello: - conflict.txt -Merge conflicts in baserock:stratum3-hello: - conflict.txt diff --git a/tests.branching/merge-conflict-stratum.exit b/tests.branching/merge-conflict-stratum.exit deleted file mode 100644 index d00491fd..00000000 --- a/tests.branching/merge-conflict-stratum.exit +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests.branching/merge-conflict-stratum.script b/tests.branching/merge-conflict-stratum.script deleted file mode 100755 index ff00f364..00000000 --- a/tests.branching/merge-conflict-stratum.script +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/sh -# Copyright (C) 2012 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -# Simple merge conflict handling test. - -set -eu - -# Disable test on versions of Python before 2.7. -if ! python --version 2>&1 | grep '^Python 2\.[78]' > /dev/null -then - cat "$SRCDIR/tests.branching/merge-conflict-stratum.stdout" - cat "$SRCDIR/tests.branching/merge-conflict-stratum.stderr" >&2 - exit 1 -fi - -cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" init - -# Create stable branch to merge TO -"$SRCDIR/scripts/test-morph" branch baserock:morphs test/stable -cd test/stable/baserock:morphs -git push --quiet origin test/stable - -# Create feature branch to merge FROM -"$SRCDIR/scripts/test-morph" branch baserock:morphs test/feature test/stable - -# Need 2 chunks! - -# Make a change in TO -cd "$DATADIR/workspace/test/stable" -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum -cd baserock:morphs -cat <<EOF > "hello-stratum.morph" -{ - "name": "hello-stratum", - "kind": "stratum", - "chunks": [ - { - "name": "hello-runtime", - "repo": "baserock:hello", - "ref": "master", - "morph": "hello", - "build-depends": [] - }, - { - "name": "hello-devel", - "repo": "baserock:hello", - "ref": "master", - "morph": "hello", - "build-depends": [] - } - ] -} -EOF -git commit --quiet --all -m "Split up 'hello' chunk into runtime and devel" - -# Make a change in FROM that isn't very mergable -cd "$DATADIR/workspace/test/feature" -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum -cd baserock:morphs -cat <<EOF > "hello-stratum.morph" -{ - "name": "hello-stratum", - "kind": "stratum", - "chunks": [ - { - "name": "hello-devel", - "repo": "baserock:hello", - "ref": "master", - "morph": "hello", - "build-depends": [] - }, - { - "name": "hello-runtime", - "repo": "baserock:hello", - "ref": "master", - "morph": "hello", - "build-depends": [] - } - ] -} -EOF -git commit --quiet --all -m "Split up 'hello' chunk into devel and runtime" - -# Merge changes from test/feature to test/stable - we expect failure -cd "$DATADIR/workspace/test/stable" -"$SRCDIR/scripts/test-morph" merge test/feature diff --git a/tests.branching/merge-conflict-stratum.stderr b/tests.branching/merge-conflict-stratum.stderr deleted file mode 100644 index 57aafa5a..00000000 --- a/tests.branching/merge-conflict-stratum.stderr +++ /dev/null @@ -1 +0,0 @@ -ERROR: merge errors were encountered. Please manually merge the target ref into test/feature in the remote system branch in each case, and then repeat the 'morph merge' operation. diff --git a/tests.branching/merge-conflict-stratum.stdout b/tests.branching/merge-conflict-stratum.stdout deleted file mode 100644 index cce0973c..00000000 --- a/tests.branching/merge-conflict-stratum.stdout +++ /dev/null @@ -1,2 +0,0 @@ -Merge conflicts in baserock:morphs: - hello-stratum.morph diff --git a/tests.branching/merge-error-cases.script b/tests.branching/merge-error-cases.script deleted file mode 100755 index e802f139..00000000 --- a/tests.branching/merge-error-cases.script +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# Copyright (C) 2012 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -# Check "morph merge" gives reasonable error messages - -set -eu - -# Create system branch. -cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" init - -"$SRCDIR/scripts/test-morph" checkout baserock:morphs master -cd master - -# 'From' branch is not checked out (and also doesn't exist, but that -# problem can only be detected when 'morph checkout' is run) -"$SRCDIR/scripts/test-morph" merge baserock/newbranch || true diff --git a/tests.branching/merge-error-cases.stderr b/tests.branching/merge-error-cases.stderr deleted file mode 100644 index 6a9cc8a9..00000000 --- a/tests.branching/merge-error-cases.stderr +++ /dev/null @@ -1 +0,0 @@ -ERROR: branch baserock/newbranch must be checked out before it can be merged diff --git a/tests.branching/merge-handles-unmergable-cases.exit b/tests.branching/merge-handles-unmergable-cases.exit deleted file mode 100644 index d00491fd..00000000 --- a/tests.branching/merge-handles-unmergable-cases.exit +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests.branching/merge-handles-unmergable-cases.script b/tests.branching/merge-handles-unmergable-cases.script deleted file mode 100755 index e1ba5f9e..00000000 --- a/tests.branching/merge-handles-unmergable-cases.script +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# Copyright (C) 2012 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -# Things that "morph merge" isn't expected to handle (but shouldn't crash) - -set -eu - -cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" init -"$SRCDIR/scripts/test-morph" checkout baserock:morphs master -"$SRCDIR/scripts/test-morph" branch baserock:morphs test/unmergable - -cd "$DATADIR/workspace/test/unmergable/baserock:morphs" -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum -sed -ie 's/"kind": "stratum"/"kind": "chunk"/' hello-stratum.morph -git commit --quiet --all -m "Unmergeable because kind has changed" - -cd "$DATADIR/workspace/master/baserock:morphs" -"$SRCDIR/scripts/test-morph" merge test/unmergable diff --git a/tests.branching/merge-handles-unmergable-cases.stderr b/tests.branching/merge-handles-unmergable-cases.stderr deleted file mode 100644 index ff6539a7..00000000 --- a/tests.branching/merge-handles-unmergable-cases.stderr +++ /dev/null @@ -1 +0,0 @@ -ERROR: merge conflict: "kind" of morphology hello-system.hello-stratum changed from stratum to chunk diff --git a/tests.branching/merge-not-to-master.script b/tests.branching/merge-not-to-master.script deleted file mode 100755 index 824e89b6..00000000 --- a/tests.branching/merge-not-to-master.script +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/sh -# Copyright (C) 2012 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -# Check that "morph merge" merges a system branch into a newly created -# system branch - -set -eu - -# Disable test on versions of Python before 2.7. -if ! python --version 2>&1 | grep '^Python 2\.[78]' > /dev/null -then - exit 0 -fi - -cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" init - -# Create stable branch to merge TO -"$SRCDIR/scripts/test-morph" branch baserock:morphs test/stable -cd test/stable/baserock:morphs -git push --quiet origin test/stable - -# Create feature branch to merge FROM -"$SRCDIR/scripts/test-morph" branch baserock:morphs test/feature test/stable -cd "$DATADIR/workspace/test/feature" - -# Edit hello in FROM -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello -cd baserock:hello -touch newfile.txt -git add newfile.txt -git commit -m foo --quiet - -# Commit in morphs repo -# FIXME: this should become unnecessary since only the refs have -# changed. -cd ../baserock:morphs -git commit --all --quiet -m "Update morph refs for test/feature" - -# Merge changes back to test/stable -cd "$DATADIR/workspace" -cd test/stable -"$SRCDIR/scripts/test-morph" merge test/feature - -# Check results: changes to 'hello' should have been merged back to -# test/stable. -cd baserock:hello -[ -e newfile.txt ] - -# Make sure all changes are committed and to the correct branch ('hello' -# was built from 'master' before branching, so the changes should be -# merged back to 'master'). -git status --short -[ $(git rev-parse master) = $(git rev-parse HEAD) ] - -# Changes here should be on test/stable. -cd ../baserock:morphs -git status --short -[ $(git rev-parse test/stable) = $(git rev-parse HEAD) ] - -# Make sure all refs to the merged branch have gone. -! grep "\"ref\": \"test/feature\"" *.morph diff --git a/tests.branching/merge-warns-if-merging-petrified-morphologies.script b/tests.branching/merge-warns-if-merging-petrified-morphologies.script deleted file mode 100755 index 12e726ed..00000000 --- a/tests.branching/merge-warns-if-merging-petrified-morphologies.script +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# Copyright (C) 2012 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -# If the user merges a petrified branch into an unpetrified branch, -# we should warn them. - -set -eu - -cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" init -"$SRCDIR/scripts/test-morph" checkout baserock:morphs master -"$SRCDIR/scripts/test-morph" branch baserock:morphs test/petrified - -cd "$DATADIR/workspace/test/petrified/baserock:morphs" -"$SRCDIR/scripts/test-morph" petrify -git commit --quiet --all -m "Petrify branch" - -cd "$DATADIR/workspace/master/baserock:morphs" -"$SRCDIR/scripts/test-morph" merge test/petrified diff --git a/tests.branching/merge-warns-if-merging-petrified-morphologies.stdout b/tests.branching/merge-warns-if-merging-petrified-morphologies.stdout deleted file mode 100644 index 65985486..00000000 --- a/tests.branching/merge-warns-if-merging-petrified-morphologies.stdout +++ /dev/null @@ -1 +0,0 @@ -WARNING: chunk "hello-system.hello-stratum.hello" is now petrified diff --git a/tests.branching/merge-with-chunk-renamed.script b/tests.branching/merge-with-chunk-renamed.script deleted file mode 100755 index 06969b70..00000000 --- a/tests.branching/merge-with-chunk-renamed.script +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh -# Copyright (C) 2012 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -# "morph merge" should pull changes from a chunk even if its name was changed -# in the branch - -set -eu - -# Disable test on versions of Python before 2.7. -if ! python --version 2>&1 | grep '^Python 2\.[78]' > /dev/null -then - exit 0 -fi - -# Create system branch. -cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" init -"$SRCDIR/scripts/test-morph" branch baserock:morphs baserock/newbranch - -# Rename the chunk, and then commit a seperate change -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello -cd baserock/newbranch/baserock:hello - -cat hello.morph | sed -e 's/"name": "hello"/"name": "goodbye"/' > goodbye.morph -git rm -q hello.morph -git add goodbye.morph -git commit -m "Rename chunk" --quiet - -touch newfile.txt -git add newfile.txt -git commit -m "Add new file" --quiet - -# Update stratum to point at the renamed chunk -cd ../baserock:morphs -sed -ie 's/"name": "hello"/"name": "goodbye"/' hello-stratum.morph -git commit --all --quiet -m "Update morph refs for baserock/newbranch" - -# Merge changes back to master -cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" checkout baserock:morphs master -cd master -"$SRCDIR/scripts/test-morph" merge baserock/newbranch - -# Morph should have realised that 'goodbye' is not a new chunk, -# and pulled in the changes from 'hello' in the old branch -cd baserock:hello -[ ! -e hello.morph ] -[ -e goodbye.morph ] -[ -e newfile.txt ] diff --git a/tests.branching/merge-with-chunk-repo-moved.exit b/tests.branching/merge-with-chunk-repo-moved.exit deleted file mode 100644 index d00491fd..00000000 --- a/tests.branching/merge-with-chunk-repo-moved.exit +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests.branching/merge-with-chunk-repo-moved.script b/tests.branching/merge-with-chunk-repo-moved.script deleted file mode 100755 index d14d586f..00000000 --- a/tests.branching/merge-with-chunk-repo-moved.script +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -# Copyright (C) 2012 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -# "morph merge" should detect changes in a repo that was added as part of the -# branch and warn the user that the changes will not be merged automatically - -set -eu - -# Disable test on versions of Python before 2.7. -if ! python --version 2>&1 | grep '^Python 2\.[78]' > /dev/null -then - cat "$SRCDIR/tests.branching/merge-with-chunk-repo-moved.stderr" >&2 - exit 1 -fi - -# Create system branch. -cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" init -"$SRCDIR/scripts/test-morph" branch baserock:morphs baserock/newbranch - -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello - -# Chunk moves to a new location (we manually update the ref back to master -# here, so 'morph edit' can create a system branch in the new repo from it). -git clone -q "$DATADIR/hello" "$DATADIR/hello-lorried" -cd "$DATADIR/workspace/baserock/newbranch/baserock:morphs" -sed -e 's/"repo": "baserock:hello"/"repo": "baserock:hello-lorried"/' \ - -e 's/"ref": "baserock\/newbranch"/"ref": "master"/' \ - -i hello-stratum.morph -git commit -q --all -m "'hello' repository has moved" - -# Now we further edit the chunk, just for fun. -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello -cd "$DATADIR/workspace/baserock/newbranch/baserock:hello-lorried" -touch newfile.txt -git add newfile.txt -git commit -m "Add new file" --quiet - -cd "$DATADIR/workspace/baserock/newbranch/baserock:morphs" -git commit -q --all -m "Update system branch refs" - -# Try to merge changes back to master (should fail, because we don't support -# adding chunks inside branches yet). -cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" checkout baserock:morphs master -cd master -"$SRCDIR/scripts/test-morph" merge baserock/newbranch diff --git a/tests.branching/merge-with-chunk-repo-moved.stderr b/tests.branching/merge-with-chunk-repo-moved.stderr deleted file mode 100644 index 95fe61e6..00000000 --- a/tests.branching/merge-with-chunk-repo-moved.stderr +++ /dev/null @@ -1 +0,0 @@ -ERROR: chunk hello was added within this branch and subsequently edited. This is not yet supported: refusing to merge. diff --git a/tests.branching/merge-with-stratum-renamed.exit b/tests.branching/merge-with-stratum-renamed.exit deleted file mode 100644 index d00491fd..00000000 --- a/tests.branching/merge-with-stratum-renamed.exit +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests.branching/merge-with-stratum-renamed.script b/tests.branching/merge-with-stratum-renamed.script deleted file mode 100755 index 6daac566..00000000 --- a/tests.branching/merge-with-stratum-renamed.script +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# Copyright (C) 2012 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -# "morph merge" should deal with stratum renames; currently it doesn't deal -# very well, but at least we don't crash. - -set -eu - -# Disable test on versions of Python before 2.7. -if ! python --version 2>&1 | grep '^Python 2\.[78]' > /dev/null -then - cat "$SRCDIR/tests.branching/merge-with-stratum-renamed.stderr" 1>&2 - exit 1 -fi - -# Create system branch. -cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" init -"$SRCDIR/scripts/test-morph" branch baserock:morphs baserock/newbranch - -# The user may 'morph edit hello-system hello-stratum hello' and commit here: -# we currently silently ignore her changes on merge, because we don't -# associate hello-stratum and goodbye-stratum at all. - -# Rename the stratum -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum -cd baserock/newbranch/baserock:morphs - -sed -e 's/"morph": "hello-stratum"/"morph": "goodbye-stratum"/'\ - -i hello-system.morph -sed -e 's/"name": "hello-stratum"/"name": "goodbye-stratum"/' \ - hello-stratum.morph > goodbye-stratum.morph -git rm -q hello-stratum.morph -git add goodbye-stratum.morph -git commit -q --all -m "Rename hello-stratum to goodbye-stratum" - -# The user may 'morph edit hello-system goodbye-stratum hello' and commit -# here, too: same problem. - -# Merge changes back to master (this should fail, because we don't support -# adding strata inside branches yet). -cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" checkout baserock:morphs master -cd master -"$SRCDIR/scripts/test-morph" merge baserock/newbranch diff --git a/tests.branching/merge-with-stratum-renamed.stderr b/tests.branching/merge-with-stratum-renamed.stderr deleted file mode 100644 index ff408036..00000000 --- a/tests.branching/merge-with-stratum-renamed.stderr +++ /dev/null @@ -1 +0,0 @@ -ERROR: goodbye-stratum.morph was not found in TMP/workspace/master/baserock:morphs at ref 804a475402fb6ded64a2749c7adf5b33c7c8ce1e diff --git a/tests.branching/merge.script b/tests.branching/merge.script deleted file mode 100755 index d73e4835..00000000 --- a/tests.branching/merge.script +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -# Copyright (C) 2012 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -# Check that "morph merge" merges a system branch into master - -set -eu - -# Disable test on versions of Python before 2.7. -if ! python --version 2>&1 | grep '^Python 2\.[78]' > /dev/null -then - cat "$SRCDIR/tests.branching/merge.stdout" - exit 0 -fi - -# Create system branch. -cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" init -"$SRCDIR/scripts/test-morph" branch baserock:morphs baserock/newbranch - -# Make a change to a chunk. -cd baserock/newbranch -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello -cd baserock:hello -touch newfile.txt -git add newfile.txt -git commit -m foo --quiet -git push --quiet origin baserock/newbranch - -# Commit in morphs repo -cd ../baserock:morphs -git commit --all --quiet -m "Update morph refs for baserock/newbranch" - -# Merge changes back to master -cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" checkout baserock:morphs master -cd master -"$SRCDIR/scripts/test-morph" merge baserock/newbranch - -# Check results. -cd baserock:hello -git status --short # make sure all changes are committed -[ -e newfile.txt ] # make sure the new file is there - -# Make sure all refs to the merged branch have gone. -cd ../baserock:morphs -! grep "\"ref\": \"baserock/newbranch\"" *.morph - -# The only change here was the branch refs, which have now been -# changed back - so there should not be any new commits. -echo "Commit message for baserock:morphs" -git cat-file commit HEAD | tail -n 1 - -echo -echo "Commit message for baserock:hello" -cd ../baserock:hello -git cat-file commit HEAD | tail -n 1 diff --git a/tests.branching/merge.stdout b/tests.branching/merge.stdout deleted file mode 100644 index 6806f75a..00000000 --- a/tests.branching/merge.stdout +++ /dev/null @@ -1,5 +0,0 @@ -Commit message for baserock:morphs -initial - -Commit message for baserock:hello -Merge system branch 'baserock/newbranch' diff --git a/tests.branching/setup-3rd-party-strata b/tests.branching/setup-3rd-party-strata deleted file mode 100644 index 49eca394..00000000 --- a/tests.branching/setup-3rd-party-strata +++ /dev/null @@ -1,136 +0,0 @@ -#!/bin/sh -# Copyright (C) 2012 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -# Create strata outside the main morphologies repository, which is useful -# for the more complex workflow tests. - - -. "$SRCDIR/scripts/fix-committer-info" - -create_chunk() { - REPO="$1" - NAME="$2" - - mkdir "$1" - ln -s "$1" "$1.git" - cd "$1" - - cat <<EOF > "$1/$2.morph" -{ - "name": "$2", - "kind": "chunk", - "build-system": "dummy" -} -EOF - - git init --quiet - git add . - git commit --quiet -m "Initial commit" -} - -write_stratum_morph() { - REPO="$1" - NAME="$2" - -cat <<EOF > "$1/$2.morph" -{ - "name": "$2", - "kind": "stratum", - "chunks": [ - { - "name": "hello", - "repo": "baserock:$2-hello", - "ref": "master", - "build-depends": [] - } - ] -} -EOF -} - -# Create two more strata outside the baserock:morphs repository - -EXTERNAL_STRATA_REPO="$DATADIR/external-strata" -mkdir "$EXTERNAL_STRATA_REPO" -ln -s "$EXTERNAL_STRATA_REPO" "$EXTERNAL_STRATA_REPO".git -cd "$EXTERNAL_STRATA_REPO" - -git init --quiet . - -write_stratum_morph "$EXTERNAL_STRATA_REPO" "stratum2" -write_stratum_morph "$EXTERNAL_STRATA_REPO" "stratum3" - -git add . -git commit --quiet -m "Initial commit" - -# To make life harder, both chunks have the same name too - -create_chunk "$DATADIR/stratum2-hello" "hello" -create_chunk "$DATADIR/stratum3-hello" "hello" - -# Update hello-system to include them ... using a system branch! Since the -# strata refs are 'master' not 'me/add-external-strata' this does not cause -# problems with merging. - -cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" init -"$SRCDIR/scripts/test-morph" branch baserock:morphs me/add-external-strata - -cd "$DATADIR/workspace/me/add-external-strata/baserock:morphs" - -cat <<EOF > "hello-system.morph" -{ - "name": "hello-system", - "kind": "system", - "system-kind": "syslinux-disk", - "arch": "x86_64", - "disk-size": "1G", - "strata": [ - { - "morph": "hello-stratum", - "repo": "baserock:morphs", - "ref": "master" - }, - { - "morph": "stratum2", - "repo": "baserock:external-strata", - "ref": "master" - }, - { - "morph": "stratum3", - "repo": "baserock:external-strata", - "ref": "master" - } - ] -} -EOF -git commit --quiet --all -m "Add two more external strata" - -# Merge to master -cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" checkout baserock:morphs master -cd master/baserock:morphs -"$SRCDIR/scripts/test-morph" merge me/add-external-strata - -# In reality the user would do: 'git push origin master' here, -# but since our remote repo is non-bare we must cheat a bit. -# We should consider a separate fixture for the workflow tests. -cd "$DATADIR/morphs" -git pull -q \ - "file://$DATADIR/workspace/master/baserock:morphs" master - -cd "$DATADIR/workspace" diff --git a/tests.branching/status-in-dirty-branch.script b/tests.branching/status-in-dirty-branch.script index 36ed781d..beb58ced 100755 --- a/tests.branching/status-in-dirty-branch.script +++ b/tests.branching/status-in-dirty-branch.script @@ -19,7 +19,7 @@ set -eu -. "$SRCDIR/tests.branching/setup-3rd-party-strata" +. "$SRCDIR/scripts/setup-3rd-party-strata" cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" branch baserock:morphs test diff --git a/tests.branching/workflow-petrify.script b/tests.branching/workflow-petrify.script index d83eb06b..ac8b233e 100755 --- a/tests.branching/workflow-petrify.script +++ b/tests.branching/workflow-petrify.script @@ -28,7 +28,7 @@ then exit 0 fi -. "$SRCDIR/tests.branching/setup-3rd-party-strata" +. "$SRCDIR/scripts/setup-3rd-party-strata" cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" branch baserock:morphs test/petrify diff --git a/tests.branching/workflow-separate-stratum-repos.script b/tests.branching/workflow-separate-stratum-repos.script index d8be404c..6f77672e 100755 --- a/tests.branching/workflow-separate-stratum-repos.script +++ b/tests.branching/workflow-separate-stratum-repos.script @@ -22,7 +22,7 @@ set -eu -. "$SRCDIR/tests.branching/setup-3rd-party-strata" +. "$SRCDIR/scripts/setup-3rd-party-strata" # Make a change to the system # FIXME: we should try and build it, too |