diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2012-04-10 15:23:50 +0100 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2012-04-10 15:25:10 +0100 |
commit | fbe7fa09a83b6fdc720ff8b1e1afc94fd232963c (patch) | |
tree | 8728ed9774a75a458841067e109a23409fbd2f2d | |
parent | ff9f8dcfc1b44bd6462da221c6dd0ea6779bf223 (diff) | |
download | morph-fbe7fa09a83b6fdc720ff8b1e1afc94fd232963c.tar.gz |
tests: add tests for update-gits
-rwxr-xr-x | tests/update-gits-chunk.script | 33 | ||||
-rwxr-xr-x | tests/update-gits-stratum.script | 33 |
2 files changed, 66 insertions, 0 deletions
diff --git a/tests/update-gits-chunk.script b/tests/update-gits-chunk.script new file mode 100755 index 00000000..bece2699 --- /dev/null +++ b/tests/update-gits-chunk.script @@ -0,0 +1,33 @@ +#!/bin/sh +# +# Test that 'morph update-gits' updates every chunk listed on the +# command line +# +# 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. + +set -eu + +# create an empty commit in a chunk repository +cd "$DATADIR/chunk-repo" +git checkout --quiet farrokh +git commit --quiet --allow-empty --allow-empty-message -m "" +NEWREF="$(git show-ref --hash farrokh)" + +"$SRCDIR/scripts/test-morph" update-gits chunk-repo farrokh hello.morph + +# check the top commit of the cached repo's farrokh branch +cd "$DATADIR/cache/gits/"*chunk?repo* +test "$(git show-ref --hash refs/remotes/origin/farrokh)" = "$NEWREF" diff --git a/tests/update-gits-stratum.script b/tests/update-gits-stratum.script new file mode 100755 index 00000000..97d1e2c0 --- /dev/null +++ b/tests/update-gits-stratum.script @@ -0,0 +1,33 @@ +#!/bin/sh +# +# Test that 'morph update-gits' updates every chunk that depends on the +# strata listed on the command line +# +# 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. + +set -eu + +# create an empty commit in a chunk repository +cd "$DATADIR/chunk-repo" +git checkout --quiet farrokh +git commit --quiet --allow-empty --allow-empty-message -m "" +NEWREF="$(git show-ref --hash farrokh)" + +"$SRCDIR/scripts/test-morph" update-gits morphs-repo master hello-stratum.morph + +# check the top commit of the cached repo's farrokh branch +cd "$DATADIR/cache/gits/"*chunk?repo* +test "$(git show-ref --hash refs/remotes/origin/farrokh)" = "$NEWREF" |