summaryrefslogtreecommitdiff
path: root/tests.build
diff options
context:
space:
mode:
authorRichard Dale <richard.dale@codethink.co.uk>2013-05-21 11:11:04 +0100
committerRichard Dale <richard.dale@codethink.co.uk>2013-05-29 16:13:48 +0100
commit70f21759d03cfc930d26f8abac0d56a8279276b8 (patch)
tree54fd95dd8450536cc8c359498227c52ce5964a2d /tests.build
parent5a29d98c43fdb637947af893b8604b5d6adcd113 (diff)
downloadmorph-70f21759d03cfc930d26f8abac0d56a8279276b8.tar.gz
Add detection for cmake and qmake build systems
Add tests for cmake and qmake build systems
Diffstat (limited to 'tests.build')
-rwxr-xr-xtests.build/build-system-cmake.script59
-rw-r--r--tests.build/build-system-cmake.stdout8
-rwxr-xr-xtests.build/build-system-qmake.script61
-rw-r--r--tests.build/build-system-qmake.stdout8
4 files changed, 136 insertions, 0 deletions
diff --git a/tests.build/build-system-cmake.script b/tests.build/build-system-cmake.script
new file mode 100755
index 00000000..00b9ed23
--- /dev/null
+++ b/tests.build/build-system-cmake.script
@@ -0,0 +1,59 @@
+#!/bin/sh
+#
+# Copyright (C) 2011-2013 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.
+
+
+## Convert the hello-chunk project to something cmake-like, then
+## build it.
+
+set -eu
+
+chunkrepo="$DATADIR/chunk-repo"
+cd "$chunkrepo"
+
+git checkout --quiet farrokh
+
+cat <<'EOF' >CMakeLists.txt
+cmake_minimum_required(VERSION 2.8)
+project(hello)
+
+set(hello_SOURCES hello.c)
+add_executable(hello ${hello_SOURCES})
+install(TARGETS hello RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
+EOF
+
+git add CMakeLists.txt
+
+cat <<EOF > hello.morph
+{
+ "name": "hello",
+ "kind": "chunk",
+ "build-system": "cmake",
+ "install-commands": ["make DESTDIR=\"\$DESTDIR\" install"]
+}
+EOF
+git add hello.morph
+git commit --quiet -m "Convert hello to a cmake project"
+
+"$SRCDIR/scripts/test-morph" build-morphology \
+ test:morphs-repo master hello-system
+
+for chunk in "$DATADIR/cache/artifacts/"*.chunk.*
+do
+ echo "$chunk:" | sed 's/[^.]*//'
+ tar -tf "$chunk" | LC_ALL=C sort | sed '/^\.\/./s:^\./::'
+ echo
+done
diff --git a/tests.build/build-system-cmake.stdout b/tests.build/build-system-cmake.stdout
new file mode 100644
index 00000000..ccf80a86
--- /dev/null
+++ b/tests.build/build-system-cmake.stdout
@@ -0,0 +1,8 @@
+.chunk.hello:
+./
+baserock/
+baserock/hello.meta
+usr/
+usr/bin/
+usr/bin/hello
+
diff --git a/tests.build/build-system-qmake.script b/tests.build/build-system-qmake.script
new file mode 100755
index 00000000..c9175b99
--- /dev/null
+++ b/tests.build/build-system-qmake.script
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Copyright (C) 2011-2013 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.
+
+
+## Convert the hello-chunk project to something qmake-like, then
+## build it.
+
+set -eu
+
+chunkrepo="$DATADIR/chunk-repo"
+cd "$chunkrepo"
+
+git checkout --quiet farrokh
+
+cat <<'EOF' >hello.pro
+TEMPLATE = app
+TARGET = hello
+DEPENDPATH += .
+INCLUDEPATH += .
+
+SOURCES += hello.c
+hello.path = /usr/bin
+hello.files = hello
+INSTALLS += hello
+EOF
+git add hello.pro
+
+cat <<EOF > hello.morph
+{
+ "name": "hello",
+ "kind": "chunk",
+ "build-system": "qmake",
+ "install-commands": ["make INSTALL_ROOT=\"\$DESTDIR\" install"]
+}
+EOF
+git add hello.morph
+git commit --quiet -m "Convert hello to an qmake project"
+
+"$SRCDIR/scripts/test-morph" build-morphology \
+ test:morphs-repo master hello-system
+
+for chunk in "$DATADIR/cache/artifacts/"*.chunk.*
+do
+ echo "$chunk:" | sed 's/[^.]*//'
+ tar -tf "$chunk" | LC_ALL=C sort | sed '/^\.\/./s:^\./::'
+ echo
+done
diff --git a/tests.build/build-system-qmake.stdout b/tests.build/build-system-qmake.stdout
new file mode 100644
index 00000000..ccf80a86
--- /dev/null
+++ b/tests.build/build-system-qmake.stdout
@@ -0,0 +1,8 @@
+.chunk.hello:
+./
+baserock/
+baserock/hello.meta
+usr/
+usr/bin/
+usr/bin/hello
+