Rombobjörn

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Persson <Bjorn@Rombobjörn.se>2013-12-16 17:27:40 +0100
committerBjörn Persson <Bjorn@Rombobjörn.se>2013-12-16 17:27:40 +0100
commit940fef353e6551f721651db79cb135219191ad9e (patch)
tree0d306bc8c671dd6691cbddb587a0bb57f87a1dad
parentdc755a6e32254c6d58157a410bf41912b5a16ad0 (diff)
the beginning of a testsuite
-rw-r--r--Makefile23
-rw-r--r--testsuite/inputs/clean7
-rw-r--r--testsuite/inputs/default_build6
-rw-r--r--testsuite/inputs/distclean7
-rw-r--r--testsuite/locations/separate3
-rw-r--r--testsuite/locations/space3
-rwxr-xr-xtestsuite/run_tests58
-rw-r--r--testsuite/sources/empty/Makefile1
8 files changed, 108 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..4a59d3b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,23 @@
+# Makefile for running Comfignat's testsuite
+# Copyright 2013 B. Persson, Bjorn@Rombobeorn.se
+#
+# This material is provided as is, with absolutely no warranty expressed
+# or implied. Any use is at your own risk.
+#
+# Permission is hereby granted to use or copy this makefile
+# for any purpose, provided the above notices are retained on all copies.
+# Permission to modify the code and to distribute modified code is granted,
+# provided the above notices are retained, and a notice that the code was
+# modified is included with the above copyright notice.
+
+
+include comfignat.mk
+
+check:
+ "${srcdir}/testsuite/run_tests" "${srcdir}" "${builddir}"
+
+clean::
+ rm -Rf "${builddir}/testruns"
+
+base:
+ echo "You don't build Comfignat. This makefile is for the testsuite."
diff --git a/testsuite/inputs/clean b/testsuite/inputs/clean
new file mode 100644
index 0000000..ab322cc
--- /dev/null
+++ b/testsuite/inputs/clean
@@ -0,0 +1,7 @@
+cd "${srcdir}"
+if [ "${relative_builddir}" != . ] ; then
+ make configure builddir="${relative_builddir}"
+ cd "${relative_builddir}"
+fi
+make
+make clean
diff --git a/testsuite/inputs/default_build b/testsuite/inputs/default_build
new file mode 100644
index 0000000..7ff31f7
--- /dev/null
+++ b/testsuite/inputs/default_build
@@ -0,0 +1,6 @@
+cd "${srcdir}"
+if [ "${relative_builddir}" != . ] ; then
+ make configure builddir="${relative_builddir}"
+ cd "${relative_builddir}"
+fi
+make
diff --git a/testsuite/inputs/distclean b/testsuite/inputs/distclean
new file mode 100644
index 0000000..6e1119b
--- /dev/null
+++ b/testsuite/inputs/distclean
@@ -0,0 +1,7 @@
+cd "${srcdir}"
+if [ "${relative_builddir}" != . ] ; then
+ make configure builddir="${relative_builddir}"
+ cd "${relative_builddir}"
+fi
+make
+make distclean
diff --git a/testsuite/locations/separate b/testsuite/locations/separate
new file mode 100644
index 0000000..a2fc7f1
--- /dev/null
+++ b/testsuite/locations/separate
@@ -0,0 +1,3 @@
+srcdir=parent/source
+builddir=build
+relative_builddir=../../build
diff --git a/testsuite/locations/space b/testsuite/locations/space
new file mode 100644
index 0000000..577c5e3
--- /dev/null
+++ b/testsuite/locations/space
@@ -0,0 +1,3 @@
+srcdir="name with whitespace"
+builddir=${srcdir}
+relative_builddir=.
diff --git a/testsuite/run_tests b/testsuite/run_tests
new file mode 100755
index 0000000..dfdfe75
--- /dev/null
+++ b/testsuite/run_tests
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+# Comfignat's testsuite
+# Copyright 2013 B. Persson, Bjorn@Rombobeorn.se
+#
+# This material is provided as is, with absolutely no warranty expressed
+# or implied. Any use is at your own risk.
+#
+# Permission is hereby granted to use or copy this program
+# for any purpose, provided the above notices are retained on all copies.
+# Permission to modify the code and to distribute modified code is granted,
+# provided the above notices are retained, and a notice that the code was
+# modified is included with the above copyright notice.
+
+
+# It is hoped that this program will work in any Posix-compliant shell.
+
+set -e
+
+outer_srcdir="$1"
+outer_builddir="$2"
+
+passed=0
+failed=0
+
+Comfignat_overriding_absolute_builddir=
+Comfignat_overriding_absolute_objdir=
+Comfignat_overriding_absolute_stagedir=
+
+rm -Rf "${outer_builddir}"/testruns
+
+for source_directory in "${outer_srcdir}"/testsuite/sources/* ; do
+ for location_file in "${outer_srcdir}"/testsuite/locations/* ; do
+ for input_script in "${outer_srcdir}"/testsuite/inputs/* ; do
+ test_name=$(basename "${source_directory}")+$(basename "${location_file}")+$(basename "${input_script}")
+ testrundir="${outer_builddir}"/testruns/"${test_name}"
+ mkdir -p "${testrundir}"
+ cd "${testrundir}"
+ . "${location_file}"
+ mkdir -p "${srcdir}" "${builddir}"
+ cp -RHp "${source_directory}"/* "${srcdir}"
+ cp -p "${outer_srcdir}"/comfignat.* "${srcdir}"
+ export srcdir builddir relative_builddir
+ if sh -e "${input_script}" >output 2>&1 ; then
+ verdict=PASSED
+ passed=$((passed + 1))
+ else
+ verdict=FAILED
+ failed=$((failed + 1))
+ fi
+ echo "${test_name}: ${verdict}"
+ done
+ done
+done
+
+echo
+echo "passed: ${passed}, failed: ${failed}"
+exit ${failed}
diff --git a/testsuite/sources/empty/Makefile b/testsuite/sources/empty/Makefile
new file mode 100644
index 0000000..7bfdf9f
--- /dev/null
+++ b/testsuite/sources/empty/Makefile
@@ -0,0 +1 @@
+include comfignat.mk