From 67d36b0273cd1b9e449ff0de4ba045173bdc153c Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Fri, 24 Apr 2015 21:58:05 -0400 Subject: [PATCH] Move Autotest makefile bits into includable snippet. This all seems reasonably generic, so let's make it available for use elsewhere. --- Makefile.am | 48 +-------------------------------- snippet/autotest.mk | 65 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 47 deletions(-) create mode 100644 snippet/autotest.mk diff --git a/Makefile.am b/Makefile.am index 6f5e776..ecfc28c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,50 +18,4 @@ t_packtests64_SOURCES = t/packtests64.c src/pack.c src/tap.c EXTRA_DIST = SUFFIXES = -check-local: check-autotest -check-autotest: testsuite - $(SHELL) testsuite $(TESTSUITEFLAGS) -.PHONY: check-autotest - -clean-local: clean-autotest -clean-autotest: - test ! -f testsuite || $(SHELL) testsuite --clean -.PHONY: clean-autotest - -maintainer-clean-local: maintainer-clean-autotest -maintainer-clean-autotest: - rm -f testsuite package.m4 -.PHONY: maintainerclean-autotest - -package.m4: - $(AM_V_GEN) :; { \ - printf 'm4_define([%s], [%s])\n' \ - AT_PACKAGE_NAME '$(PACKAGE_NAME)' \ - AT_PACKAGE_TARNAME '$(PACKAGE_TARNAME)' \ - AT_PACKAGE_VERSION '$(PACKAGE_VERSION)' \ - AT_PACKAGE_STRING '$(PACKAGE_STRING)' \ - AT_PACKAGE_BUGREPORT '$(PACKAGE_BUGREPORT)' \ - AT_PACKAGE_URL '$(PACKAGE_URL)' \ - ; } >$@.tmp - $(AM_V_at) mv -f $@.tmp $@ - -testsuite: testsuite.at package.m4 -if !HAVE_AUTOTEST - @:; { \ - printf 'ERROR: Autotest was not available at configure time.\n'; \ - printf 'You should only need it if you modified the test suite.\n'; \ - printf 'Autotest is part of autom4te, included in the GNU\n'; \ - printf 'Autoconf package: \n'; \ - } 1>&2 - @false -endif - $(AM_V_GEN) $(AUTOTEST) $(ATFLAGS) -p m4_include -o $@.tmp testsuite.at - $(AM_V_at) :; { \ - $(AUTOTEST) $(ATFLAGS) -t m4_include:'$@: $$1' testsuite.at; \ - $(AUTOTEST) $(ATFLAGS) -t m4_include:'$$1:' testsuite.at; \ - } >$(DEPDIR)/$(@F).P - $(AM_V_at) mv -f $@.tmp $@ - -EXTRA_DIST += testsuite testsuite.at package.m4 - -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/testsuite.P@am__quote@ +include $(top_srcdir)/snippet/autotest.mk diff --git a/snippet/autotest.mk b/snippet/autotest.mk new file mode 100644 index 0000000..b2baa2d --- /dev/null +++ b/snippet/autotest.mk @@ -0,0 +1,65 @@ +# Copyright © 2015 Nick Bowler +# +# Automake fragment to hook up a basic Autotest test suite into the build. +# It is expected that a testsuite.at file exists in $(srcdir). The +# testsuite will be output to $(builddir)/testsuite. +# +# You must define the AUTOTEST variable to the Autotest program (normally, +# this is autom4te -l autotest). The DX_PROG_AUTOTEST macro can be used +# to set this automatically. You must also define the HAVE_AUTOTEST Automake +# conditional which controls whether the testsuite-generating rules are +# enabled. If DX_PROG_AUTOTEST is used, this may be set like: +# +# DX_PROG_AUTOTEST +# AM_CONDITIONAL([HAVE_AUTOTEST], [test x"$dx_cv_autotest_works" = x"yes"]) +# +# License WTFPL2: Do What The Fuck You Want To Public License, version 2. +# This is free software: you are free to do what the fuck you want to. +# There is NO WARRANTY, to the extent permitted by law. + +check-local: check-autotest +check-autotest: testsuite + $(SHELL) testsuite $(TESTSUITEFLAGS) +.PHONY: check-autotest + +clean-local: clean-autotest +clean-autotest: + test ! -f testsuite || $(SHELL) testsuite --clean +.PHONY: clean-autotest + +maintainer-clean-local: maintainer-clean-autotest +maintainer-clean-autotest: + rm -f testsuite package.m4 +.PHONY: maintainerclean-autotest + +package.m4: + $(AM_V_GEN) :; { \ + printf 'm4_define([%s], [%s])\n' \ + AT_PACKAGE_NAME '$(PACKAGE_NAME)' \ + AT_PACKAGE_TARNAME '$(PACKAGE_TARNAME)' \ + AT_PACKAGE_VERSION '$(PACKAGE_VERSION)' \ + AT_PACKAGE_STRING '$(PACKAGE_STRING)' \ + AT_PACKAGE_BUGREPORT '$(PACKAGE_BUGREPORT)' \ + AT_PACKAGE_URL '$(PACKAGE_URL)' \ + ; } >$@.tmp + $(AM_V_at) mv -f $@.tmp $@ + +testsuite: testsuite.at package.m4 +if !HAVE_AUTOTEST + @:; { \ + printf 'ERROR: Autotest was not available at configure time.\n'; \ + printf 'You should only need it if you modified the test suite.\n'; \ + printf 'Autotest is part of autom4te, included in the GNU\n'; \ + printf 'Autoconf package: \n'; \ + } 1>&2 + @false +endif + $(AM_V_GEN) $(AUTOTEST) $(ATFLAGS) -p m4_include -o $@.tmp testsuite.at + $(AM_V_at) :; { \ + $(AUTOTEST) $(ATFLAGS) -t m4_include:'$@: $$1' testsuite.at; \ + $(AUTOTEST) $(ATFLAGS) -t m4_include:'$$1:' testsuite.at; \ + } >$(DEPDIR)/$(@F).P + $(AM_V_at) mv -f $@.tmp $@ + +EXTRA_DIST += testsuite testsuite.at package.m4 +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/testsuite.P@am__quote@ -- 2.43.0