diff options
Diffstat (limited to 'tests.branching')
-rwxr-xr-x | tests.branching/ambiguous-refs.script | 46 | ||||
-rwxr-xr-x | tests.branching/build-after-petrify.script | 31 | ||||
-rwxr-xr-x | tests.branching/petrify-no-double-petrify.script | 34 | ||||
-rw-r--r-- | tests.branching/petrify-no-double-petrify.stdout | 9 | ||||
-rwxr-xr-x | tests.branching/petrify.script | 42 | ||||
-rw-r--r-- | tests.branching/petrify.stdout | 31 |
6 files changed, 193 insertions, 0 deletions
diff --git a/tests.branching/ambiguous-refs.script b/tests.branching/ambiguous-refs.script new file mode 100755 index 00000000..aeec61a1 --- /dev/null +++ b/tests.branching/ambiguous-refs.script @@ -0,0 +1,46 @@ +#!/bin/sh +# +# 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 +# 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. + + +## Guard against a bug that occurs if 'git show-ref' is used to resolve refs +## instead of 'git rev-parse --verify': show-ref returns a list of partial +## matches sorted alphabetically, so any code using it may resolve refs +## incorrectly. + +set -eu + +. "$SRCDIR/scripts/fix-committer-info" + +cd "$DATADIR/morphs" +git mv hello-stratum.morph goodbye-stratum.morph +sed -e '/morph: hello-stratum/s/hello-stratum/goodbye-stratum/' \ + -i hello-system.morph + +git commit --quiet -am "Rename hello-system" + +cd "$DATADIR/workspace" +"$SRCDIR/scripts/test-morph" init +"$SRCDIR/scripts/test-morph" branch test:morphs release + +# Create an extra ref to confuse any users of git show-ref +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" +"$SRCDIR/scripts/test-morph" petrify diff --git a/tests.branching/build-after-petrify.script b/tests.branching/build-after-petrify.script new file mode 100755 index 00000000..d3b75f07 --- /dev/null +++ b/tests.branching/build-after-petrify.script @@ -0,0 +1,31 @@ +#!/bin/sh +# +# Copyright (C) 2013 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. + + +## Verify systems can be built after "morph petrify" + +set -eu + +. "$SRCDIR/tests.branching/setup-second-chunk" + +cd "$DATADIR/workspace" +"$SRCDIR/scripts/test-morph" init +"$SRCDIR/scripts/test-morph" branch test:morphs test/build-petrify master + +"$SRCDIR/scripts/test-morph" petrify + +"$SRCDIR/scripts/test-morph" build hello-system diff --git a/tests.branching/petrify-no-double-petrify.script b/tests.branching/petrify-no-double-petrify.script new file mode 100755 index 00000000..3c9185dc --- /dev/null +++ b/tests.branching/petrify-no-double-petrify.script @@ -0,0 +1,34 @@ +#!/bin/sh +# +# 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 +# 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. + + +## It should be impossible to lose the original refs, or we risk making +## unpetrify impossible. + +set -eu + +cd "$DATADIR/workspace" +"$SRCDIR/scripts/test-morph" init +"$SRCDIR/scripts/test-morph" branch test:morphs test/petrify + +cd test/petrify/test/morphs +git push --quiet origin HEAD +"$SRCDIR/scripts/test-morph" petrify +"$SRCDIR/scripts/test-morph" petrify +"$SRCDIR/scripts/test-morph" petrify + +cat hello-stratum.morph diff --git a/tests.branching/petrify-no-double-petrify.stdout b/tests.branching/petrify-no-double-petrify.stdout new file mode 100644 index 00000000..50da61ba --- /dev/null +++ b/tests.branching/petrify-no-double-petrify.stdout @@ -0,0 +1,9 @@ +name: hello-stratum +kind: stratum +chunks: +- name: hello + repo: test:hello + ref: 293fa0b08f0382c63181c36b6efa602876aa8c87 + unpetrify-ref: master + build-depends: [] + build-mode: test diff --git a/tests.branching/petrify.script b/tests.branching/petrify.script new file mode 100755 index 00000000..f8e7c1e9 --- /dev/null +++ b/tests.branching/petrify.script @@ -0,0 +1,42 @@ +#!/bin/sh +# +# 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 +# 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. + + +## Verify "morph petrify", and ensure it doesn't petrify chunks that have +## already been edited. + +set -eu + +. "$SRCDIR/tests.branching/setup-second-chunk" + +cd "$DATADIR/workspace" +"$SRCDIR/scripts/test-morph" init +"$SRCDIR/scripts/test-morph" branch test:morphs test/petrify master + +cd test/petrify/test/morphs +git push --quiet origin HEAD +"$SRCDIR/scripts/test-morph" edit goodbye +(cd ../goodbye && git push --quiet origin HEAD) + +"$SRCDIR/scripts/test-morph" petrify +echo "Petrified:" +cat hello-stratum.morph + +"$SRCDIR/scripts/test-morph" unpetrify +echo +echo "Unpetrified:" +cat hello-stratum.morph diff --git a/tests.branching/petrify.stdout b/tests.branching/petrify.stdout new file mode 100644 index 00000000..f9f35342 --- /dev/null +++ b/tests.branching/petrify.stdout @@ -0,0 +1,31 @@ +Petrified: +name: hello-stratum +kind: stratum +chunks: +- name: hello + repo: test:hello + ref: 293fa0b08f0382c63181c36b6efa602876aa8c87 + unpetrify-ref: master + build-depends: [] + build-mode: test +- name: goodbye + repo: test:goodbye + ref: 717c4a523fb5a94ca2f0a61e665fbc2da6a1f6ac + unpetrify-ref: test/petrify + build-depends: [] + build-mode: test + +Unpetrified: +name: hello-stratum +kind: stratum +chunks: +- name: hello + repo: test:hello + ref: master + build-depends: [] + build-mode: test +- name: goodbye + repo: test:goodbye + ref: test/petrify + build-depends: [] + build-mode: test |