summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/run-git-in25
-rwxr-xr-xtests.branching/setup55
2 files changed, 80 insertions, 0 deletions
diff --git a/scripts/run-git-in b/scripts/run-git-in
new file mode 100755
index 00000000..55bc3ecd
--- /dev/null
+++ b/scripts/run-git-in
@@ -0,0 +1,25 @@
+#!/bin/sh
+# 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.
+
+
+# Run git in a given directory.
+
+
+set -eu
+
+cd "$1"
+shift
+exec git "$@"
diff --git a/tests.branching/setup b/tests.branching/setup
index cb1c2f4a..61f966e2 100755
--- a/tests.branching/setup
+++ b/tests.branching/setup
@@ -16,7 +16,62 @@
# Set up $DATADIR.
+#
+# - an empty morph mine directory
+# - a git repository called "morphs" for fake system, stratum morphologies
+# - a git repository calle "hello" for a dummy chunk
set -eu
+
+# Create an empty directory to be used as a morph mine
mkdir "$DATADIR/mine"
+
+
+# Create a fake morphs repository
+mkdir "$DATADIR/morphs"
+
+cat <<EOF > "$DATADIR/morphs/hello-system.chunk"
+{
+ "name": "hello-system",
+ "kind": "system",
+ "disk-size": "1G",
+ "strata": [
+ "hello-stratum"
+ ]
+}
+EOF
+
+cat <<EOF > "$DATADIR/morphs/hello-stratum.chunk"
+{
+ "name": "hello-stratum",
+ "kind": "stratum",
+ "sources": [
+ {
+ "name": "hello",
+ "ref": "master"
+ }
+ ]
+}
+EOF
+
+scripts/run-git-in "$DATADIR/morphs" init
+scripts/run-git-in "$DATADIR/morphs" add .
+scripts/run-git-in "$DATADIR/morphs" commit -m initial
+
+
+# Create a dummy chunk repository
+mkdir "$DATADIR/hello"
+
+cat <<EOF > "$DATADIR/hello/hello.chunk"
+{
+ "name": "hello",
+ "kind": "chunk",
+ "build-system": "dummy"
+}
+EOF
+
+scripts/run-git-in "$DATADIR/hello" init
+scripts/run-git-in "$DATADIR/hello" add .
+scripts/run-git-in "$DATADIR/hello" commit -m initial
+