From c42e0573b88ecf439b4e2013ceddbaddf87eb1df Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Wed, 25 Apr 2012 13:50:51 +0000 Subject: 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 --- tests/update-gits-submodules.script | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 tests/update-gits-submodules.script (limited to 'tests/update-gits-submodules.script') 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 -- cgit v1.2.1