Scatter the useful files into subdirectories by theme.
[cfd] / build / autotest.am
diff --git a/build/autotest.am b/build/autotest.am
new file mode 100644 (file)
index 0000000..c99ce19
--- /dev/null
@@ -0,0 +1,97 @@
+### -*-makefile-*-
+###
+### Build script for test framework
+###
+### (c) 2008 Straylight/Edgeware
+###
+
+###----- Licensing notice ---------------------------------------------------
+###
+### This file is part of the Common Files Distribution (`common').
+###
+### `Common' 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 2 of the License, or
+### (at your option) any later version.
+###
+### `Common' 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 `common'; if not, write to the Free Software Foundation,
+### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+EXTRA_DIST =
+CLEANFILES =
+DISTCLEANFILES =
+MAINTAINERCLEANFILES =
+
+###--------------------------------------------------------------------------
+### The test suite.
+
+check-local: atconfig run-tests
+       ./run-tests $(TEST_ARGS)
+
+###--------------------------------------------------------------------------
+### Building the test suite.
+
+## testsuite
+all_autotest_TESTS      = $(autotest_TESTS) $(nodist_autotest_TESTS)
+TESTDEPS                = testsuite.at Makefile.in $(all_autotest_TESTS)
+CLEANFILES             += testsuite.log
+DISTCLEANFILES         += atconfig
+MAINTAINERCLEANFILES   += $(srcdir)/testsuite
+EXTRA_DIST             += testsuite.at testsuite $(autotest_TESTS)
+
+$(srcdir)/testsuite: $(TESTDEPS)
+       $(AM_V_GEN)$(AUTOM4TE) --language=autotest \
+               -I$(srcdir) $@.at -o $@.new && mv $@.new $@
+
+clean-local: clean-testsuite-dir
+.PHONY: clean-testsuite-dir
+clean-testsuite-dir:
+       -rm -rf testsuite.dir
+
+## run-tests
+CLEANFILES             += run-tests
+
+run-tests: Makefile $(srcdir)/testsuite
+       $(AM_V_GEN) \
+       { echo '#! /bin/sh';                                               \
+         echo 'exec $(SHELL) $(srcdir)/testsuite "$$@"';                  \
+       } >$@.new && chmod +x $@.new && mv $@.new $@
+
+###--------------------------------------------------------------------------
+### Infrastructure for the test suite build process.
+
+## tests.m4
+TESTDEPS               += $(srcdir)/tests.m4
+MAINTAINERCLEANFILES   += $(srcdir)/tests.m4
+EXTRA_DIST             += tests.m4
+
+$(srcdir)/tests.m4: Makefile.in
+       $(AM_V_GEN) \
+       for i in $(all_autotest_TESTS); do \
+         echo $$i | sed \
+           -e 's:^$(top_srcdir):$(top_builddir):' \
+           -e 's:\(.*\)/\([^/]*\)$$:TESTS([\1], [\2]):'; \
+       done >$@.new && mv $@.new $@
+
+## package.m4
+TESTDEPS               += $(srcdir)/package.m4
+MAINTAINERCLEANFILES   += $(srcdir)/package.m4
+EXTRA_DIST             += package.m4
+
+$(srcdir)/package.m4: $(top_srcdir)/configure.ac
+       $(AM_V_GEN) \
+       { echo '### package information';                                  \
+         echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])';      \
+         echo 'm4_define([AT_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])';   \
+         echo 'm4_define([AT_PACKAGE_VERSION],   [@PACKAGE_VERSION@])';   \
+         echo 'm4_define([AT_PACKAGE_STRING],    [@PACKAGE_STRING@])';    \
+         echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
+       } >$@.new && mv $@.new $@
+
+###----- That's all, folks --------------------------------------------------