From b64a9234e2a15ab92f7fdc06a65ad5f0734c0856 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 15 Aug 2014 21:41:09 -0400 Subject: Set up testsuite --- 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 . + +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 = -- cgit v0.9.1