diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/update-gits-chunk.script | 23 | ||||
-rwxr-xr-x | tests/update-gits-stratum.script | 23 | ||||
-rwxr-xr-x | tests/update-gits-submodules.script | 24 |
3 files changed, 48 insertions, 22 deletions
diff --git a/tests/update-gits-chunk.script b/tests/update-gits-chunk.script index 54a8d9ed..55bdebd0 100755 --- a/tests/update-gits-chunk.script +++ b/tests/update-gits-chunk.script @@ -1,7 +1,4 @@ -#!/bin/sh -# -# Test that 'morph update-gits' updates every chunk listed on the -# command line +#!/bin/bash # # Copyright (C) 2012 Codethink Limited # @@ -18,16 +15,28 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# Test that 'morph update-gits' updates every chunk listed on the +# command line. + set -eu -# create an empty commit in a chunk repository +# Local repos do not get cached, so we need to fake some remote repositories +git daemon --port=9419 --pid-file="$DATADIR/git.pid" --reuseaddr \ + --export-all --base-path="$DATADIR" 2> /dev/null & +trap 'kill $(cat "$DATADIR/git.pid")' INT TERM ERR +REPO_ALIAS='test=git://localhost:9419/%s#git://localhost:9419/%s' + +# 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 test:chunk-repo farrokh hello +"$SRCDIR/scripts/test-morph" --repo-alias=$REPO_ALIAS update-gits \ + test:chunk-repo farrokh hello + +kill $(cat "$DATADIR/git.pid") -# check the top commit of the cached repo's farrokh branch +# Check the top commit of the cached repo's farrokh branch cd "$DATADIR/cache/gits/"*chunk?repo* test "$(git show-ref --hash refs/heads/farrokh)" = "$NEWREF" diff --git a/tests/update-gits-stratum.script b/tests/update-gits-stratum.script index 718f2547..04511563 100755 --- a/tests/update-gits-stratum.script +++ b/tests/update-gits-stratum.script @@ -1,7 +1,4 @@ -#!/bin/sh -# -# Test that 'morph update-gits' updates every chunk that depends on the -# strata listed on the command line +#!/bin/bash # # Copyright (C) 2012 Codethink Limited # @@ -18,16 +15,28 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# Test that 'morph update-gits' updates every chunk that depends on the +# strata listed on the command line. + set -eu -# create an empty commit in a chunk repository +# Local repos do not get cached, so we need to fake some remote repositories +git daemon --port=9419 --pid-file="$DATADIR/git.pid" --reuseaddr \ + --export-all --base-path="$DATADIR" 2> /dev/null & +trap 'kill $(cat "$DATADIR/git.pid")' INT TERM ERR +REPO_ALIAS='test=git://localhost:9419/%s#git://localhost:9419/%s' + +# 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 test:morphs-repo master hello-stratum +"$SRCDIR/scripts/test-morph" --repo-alias=$REPO_ALIAS update-gits \ + test:morphs-repo master hello-stratum + +kill $(cat "$DATADIR/git.pid") -# check the top commit of the cached repo's farrokh branch +# Check the top commit of the cached repo's farrokh branch cd "$DATADIR/cache/gits/"*chunk?repo* test "$(git show-ref --hash refs/heads/farrokh)" = "$NEWREF" diff --git a/tests/update-gits-submodules.script b/tests/update-gits-submodules.script index 49f4de62..ad5f220c 100755 --- a/tests/update-gits-submodules.script +++ b/tests/update-gits-submodules.script @@ -1,7 +1,4 @@ -#!/bin/sh -# -# Test that 'morph update-gits' caches all the submodules needed by -# a chunk. +#!/bin/bash # # Copyright (C) 2012 Codethink Limited # @@ -18,22 +15,33 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# Test that 'morph update-gits' caches all the submodules needed by +# a chunk. + set -eu -# create a repo to use as a submodule +# Local repos do not get cached, so we need to fake some remote repositories +git daemon --port=9419 --pid-file="$DATADIR/git.pid" --reuseaddr \ + --export-all --base-path="$DATADIR" 2> /dev/null & +trap 'kill $(cat "$DATADIR/git.pid")' INT TERM ERR +REPO_ALIAS='test=git://localhost:9419/%s#git://localhost:9419/%s' + +# Create a repo to use as a submodule submodule="$DATADIR/submodule-repo" "$SRCDIR/scripts/cmd-filter" git init --quiet "$submodule" "$SRCDIR/scripts/run-git-in" "$submodule" commit --quiet --allow-empty \ --allow-empty-message -m "" - -# create an empty commit in a chunk repository +# Create an empty commit in a chunk repository chunkrepo="$DATADIR/chunk-repo" "$SRCDIR/scripts/run-git-in" "$chunkrepo" checkout --quiet farrokh "$SRCDIR/scripts/run-git-in" "$chunkrepo" submodule --quiet add "$submodule" \ > /dev/null "$SRCDIR/scripts/run-git-in" "$chunkrepo" commit --quiet -m "add submodule" -"$SRCDIR/scripts/test-morph" update-gits test:morphs-repo master hello-stratum +"$SRCDIR/scripts/test-morph" --repo-alias=$REPO_ALIAS update-gits \ + test:morphs-repo master hello-stratum + +kill $(cat "$DATADIR/git.pid") test -d "$DATADIR/cache/gits/"*chunk?repo* && echo chunk-repo cached test -d "$DATADIR/cache/gits/"*morphs?repo* && echo morphs-repo cached |