summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-08-15 21:41:09 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-08-15 21:41:09 (EDT)
commitb64a9234e2a15ab92f7fdc06a65ad5f0734c0856 (patch)
tree7930659cb8bf3e3be5898371befb4be3b0d4028c
parent3ec7db9002a139aacda4dbffe598de784951ef08 (diff)
Set up testsuite
-rw-r--r--Makefile.am4
-rw-r--r--tests/common.sh34
-rw-r--r--tests/local.mk1
3 files changed, 38 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 796f1d0..9c20240 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,6 +20,7 @@ include $(top_srcdir)/lib/local.mk
include $(top_srcdir)/lib/cmd/local.mk
include $(top_srcdir)/lib/profiles/local.mk
include $(top_srcdir)/locale/local.mk
+include $(top_srcdir)/tests/local.mk
bin_SCRIPTS = $(bin_sources:.sh=)
pkgdata_SCRIPTS = $(pkgdata_sources:.sh=.sm)
@@ -41,7 +42,8 @@ EXTRA_DIST = \
$(pkgdata_sources) \
$(pkgdatacmd_sources) \
$(pkgdataprofile_sources) \
- $(locale_sources)
+ $(locale_sources) \
+ tests/common.sh
SUFFIXES = .sh .sm
diff --git a/tests/common.sh b/tests/common.sh
new file mode 100644
index 0000000..0efb208
--- /dev/null
+++ b/tests/common.sh
@@ -0,0 +1,34 @@
+# ProteanOS Development Kit
+# tests/common.sh
+# Common testsuite functions
+#
+# Copyright (C) 2013-2014 Patrick "P. J." McDermott
+#
+# 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, either version 3 of the License, or
+# (at your option) any later version.
+#
+# 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, see <http://www.gnu.org/licenses/>.
+
+use()
+{
+ local module="${1}"
+ local dir=
+
+ dir='lib'
+
+ if [ -f "${dir}/${module}.sm" ]; then
+ . "${dir}/${module}.sm"
+ else
+ printf '%s: Error: Failed to load module "%s": %s\n' \
+ "${0##*/}" "${module}" 'no such file or directory' >&2
+ exit 2
+ fi
+}
diff --git a/tests/local.mk b/tests/local.mk
new file mode 100644
index 0000000..d938299
--- /dev/null
+++ b/tests/local.mk
@@ -0,0 +1 @@
+TESTS =