summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2011-12-01 10:34:10 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2011-12-01 10:34:10 +0000
commitc2c0f1016cc7334c2a7531e739ae14647be0b6fd (patch)
tree687012c9fade21bb5df1e9d6a546f97ad3ce8f51 /tests
parentc8a0c7a38234a75ef08b253c757761d9bf061342 (diff)
downloadmorph-c2c0f1016cc7334c2a7531e739ae14647be0b6fd.tar.gz
add a script to set up the git repository for tests
Diffstat (limited to 'tests')
-rwxr-xr-xtests/setup_once69
1 files changed, 69 insertions, 0 deletions
diff --git a/tests/setup_once b/tests/setup_once
new file mode 100755
index 00000000..b25b8125
--- /dev/null
+++ b/tests/setup_once
@@ -0,0 +1,69 @@
+#!/bin/sh
+#
+# Create a git repository for tests. The repository will contain a simple
+# "hello, world" C program, and two branches ("master", "farrokh"), with
+# the master branch containing just a README. The two branches are there
+# so that we can test building a branch that hasn't been checked out.
+# The branches are different so that we know that if the wrong branch
+# is uses, the build will fail.
+#
+# Copyright (C) 2011 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 -e
+
+repo="$DATADIR/repo"
+mkdir "$repo"
+cd "$repo"
+git init --quiet
+
+cat <<EOF > README
+This is a sample README.
+EOF
+git add README
+git commit --quiet -m "add README"
+
+git checkout --quiet -b farrokh
+
+cat <<EOF > hello.c
+#include <stdio.h>
+int main(void)
+{
+ puts("hello, world");
+ return 0;
+}
+EOF
+git add hello.c
+
+cat <<EOF > hello.morph
+{
+ "name": "hello",
+ "kind": "chunk",
+ "build-commands": [
+ "gcc -o hello hello.c"
+ ],
+ "install-commands": [
+ "install -d \\"\\\$DESTDIR\\"/bin",
+ "install hello \\"\\\$DESTDIR\\"/bin/hello"
+ ]
+}
+EOF
+git add hello.morph
+
+git commit --quiet -m "add a hello world program and morph"
+
+git checkout --quiet master
+