diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2012-04-25 13:50:51 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2012-04-25 13:50:51 +0000 |
commit | c42e0573b88ecf439b4e2013ceddbaddf87eb1df (patch) | |
tree | 488978fced497485c4cbd2356c5cd7c620a9f88e /tests | |
parent | 61c374740609c3cec65fecc57ad993e49f3b6b2c (diff) | |
download | morph-c42e0573b88ecf439b4e2013ceddbaddf87eb1df.tar.gz |
tests: add test for update-gits caching submodules
The test creates a repository with an empty commit to be a submodule,
alters the chunk to have this repository as a submodule, then after
building checks whether each of the repositories have been cached.
This is tested by testing if the repositories are in there rather than
listing all the repositories because the normalisation fails when the
URIs have been mangled
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/update-gits-submodules.script | 39 | ||||
-rw-r--r-- | tests/update-gits-submodules.stdout | 3 |
2 files changed, 42 insertions, 0 deletions
diff --git a/tests/update-gits-submodules.script b/tests/update-gits-submodules.script new file mode 100755 index 00000000..1cdd917e --- /dev/null +++ b/tests/update-gits-submodules.script @@ -0,0 +1,39 @@ +#!/bin/sh +# +# Test that 'morph update-gits' caches all the submodules needed by +# a chunk. +# +# 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 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 +chunkrepo="$DATADIR/chunk-repo" +"$SRCDIR/scripts/run-git-in" "$chunkrepo" checkout --quiet farrokh +"$SRCDIR/scripts/run-git-in" "$chunkrepo" submodule --quiet add "$submodule" +"$SRCDIR/scripts/run-git-in" "$chunkrepo" commit --quiet -m "add submodule" + +"$SRCDIR/scripts/test-morph" update-gits morphs-repo master hello-stratum.morph + +test -d "$DATADIR/cache/gits/"*chunk?repo* && echo chunk-repo cached +test -d "$DATADIR/cache/gits/"*morphs?repo* && echo morphs-repo cached +test -d "$DATADIR/cache/gits/"*submodule?repo* && echo submodule-repo cached diff --git a/tests/update-gits-submodules.stdout b/tests/update-gits-submodules.stdout new file mode 100644 index 00000000..5b20a81e --- /dev/null +++ b/tests/update-gits-submodules.stdout @@ -0,0 +1,3 @@ +chunk-repo cached +morphs-repo cached +submodule-repo cached |