build: Inline perl prototypes in sources
[automake.git] / t / Makefile.inc
blob6b3b62feddfdfb12d3f706f1a5e33f6c9d8d17fa
1 ## Included by top-level Makefile for Automake.
3 ## Copyright (C) 1995-2017 Free Software Foundation, Inc.
4 ##
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 2, or (at your option)
8 ## any later version.
9 ##
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 ## ------------ ##
19 ##  Testsuite.  ##
20 ## ------------ ##
22 # Run the tests with a proper shell detected at configure time.
23 LOG_COMPILER = ./pre-inst-env $(AM_TEST_RUNNER_SHELL)
25 TEST_EXTENSIONS = .pl .sh .tap
26 SH_LOG_COMPILER = $(LOG_COMPILER)
27 TAP_LOG_COMPILER = $(LOG_COMPILER)
28 PL_LOG_COMPILER = ./pre-inst-env $(PERL)
29 AM_PL_LOG_FLAGS = -Mstrict -w
31 TAP_LOG_DRIVER = AM_TAP_AWK='$(AWK)' $(SHELL) $(srcdir)/lib/tap-driver.sh
33 AM_TAP_LOG_DRIVER_FLAGS = --merge
35 EXTRA_DIST += %D%/README %D%/ax/is %D%/ax/is_newest %D%/ax/deltree.pl
38 ## Will be updated later.
39 TESTS =
41 # Some testsuite-influential variables should be overridable from the
42 # test scripts, but not from the environment.
43 # Keep this in sync with the similar list in ax/runtest.in.
44 AM_TESTS_ENVIRONMENT = \
45   for v in \
46     required \
47     am_test_protocol \
48     am_serial_tests \
49     am_test_prefer_config_shell \
50     am_original_AUTOMAKE \
51     am_original_ACLOCAL \
52     am_test_lib_sourced \
53     test_lib_sourced \
54   ; do \
55     eval test x"\$${$$v}" = x || unset $$v; \
56   done;
57 # We want warning messages and explanations for skipped tests to go to
58 # the console if possible, so set up 'stderr_fileno_' properly.
59 AM_TESTS_FD_REDIRECT = 9>&2
60 AM_TESTS_ENVIRONMENT += stderr_fileno_=9; export stderr_fileno_;
62 # For sourcing of extra "shell libraries" by our test scripts.  As per
63 # POSIX, sourcing a file with '.' will cause it to be looked up in $PATH
64 # in case it is given with a relative name containing no slashes.
65 AM_TESTS_ENVIRONMENT += \
66   if test $(srcdir) != .; then \
67     PATH='$(abs_srcdir)/%D%/ax$(PATH_SEPARATOR)'$$PATH; \
68   fi; \
69   PATH='$(abs_builddir)/%D%/ax$(PATH_SEPARATOR)'$$PATH; \
70   export PATH;
72 # Hand-written tests.
74 include $(srcdir)/%D%/list-of-tests.mk
76 TESTS += $(handwritten_TESTS)
77 EXTRA_DIST += $(handwritten_TESTS)
79 # Automatically-generated tests wrapping hand-written ones.
80 # Also, automatically-computed dependencies for tests.
82 include $(srcdir)/%D%/testsuite-part.am
84 TESTS += $(generated_TESTS)
85 EXTRA_DIST += $(generated_TESTS)
87 $(srcdir)/%D%/testsuite-part.am:
88         $(AM_V_at)rm -f %D%/testsuite-part.tmp $@
89         $(AM_V_GEN)$(PERL) $(srcdir)/gen-testsuite-part \
90           --srcdir $(srcdir) > %D%/testsuite-part.tmp
91         $(AM_V_at)chmod a-w %D%/testsuite-part.tmp
92         $(AM_V_at)mv -f %D%/testsuite-part.tmp $@
93 EXTRA_DIST += gen-testsuite-part
95 # The dependecies declared here are not truly complete, but such
96 # completeness would cause more issues than it would solve.  See
97 # automake bug#11347.
98 $(generated_TESTS): $(srcdir)/gen-testsuite-part
99 $(srcdir)/%D%/testsuite-part.am: $(srcdir)/gen-testsuite-part
100 $(srcdir)/%D%/testsuite-part.am: Makefile.am
102 # Hand-written tests for stuff in 'contrib/'.
103 include $(srcdir)/contrib/%D%/Makefile.inc
104 TESTS += $(contrib_TESTS)
105 EXTRA_DIST += $(contrib_TESTS)
107 # Static dependencies valid for each test case (also further
108 # extended later).  Note that use 'noinst_' rather than 'check_'
109 # as the prefix, because we really want them to be built by
110 # "make all".  This makes it easier to run the test cases by
111 # hand after having simply configured and built the package.
113 dist_noinst_DATA += \
114   %D%/ax/test-init.sh \
115   %D%/ax/test-lib.sh \
116   %D%/ax/am-test-lib.sh \
117   %D%/ax/tap-functions.sh
119 # Few more static dependencies.
120 %D%/distcheck-missing-m4.log: %D%/ax/distcheck-hook-m4.am
121 %D%/distcheck-outdated-m4.log: %D%/ax/distcheck-hook-m4.am
122 EXTRA_DIST += %D%/ax/distcheck-hook-m4.am
124 %D%/ax/test-defs.sh: %D%/ax/test-defs.in Makefile
125         $(AM_V_at)rm -f $@ $@-t
126         $(AM_V_at)$(MKDIR_P) %D%/ax
127         $(AM_V_GEN)in=%D%/ax/test-defs.in \
128           && $(do_subst) <$(srcdir)/$$in >$@-t
129         $(generated_file_finalize)
130 EXTRA_DIST += %D%/ax/test-defs.in
131 CLEANFILES += %D%/ax/test-defs.sh
132 nodist_noinst_DATA += %D%/ax/test-defs.sh
134 %D%/ax/shell-no-trail-bslash: %D%/ax/shell-no-trail-bslash.in Makefile
135         $(AM_V_at)rm -f $@ $@-t
136         $(AM_V_GEN)in=%D%/ax/shell-no-trail-bslash.in \
137           && $(MKDIR_P) %D%/ax \
138           && $(do_subst) <$(srcdir)/$$in >$@-t \
139           && chmod a+x $@-t
140         $(generated_file_finalize)
141 EXTRA_DIST += %D%/ax/shell-no-trail-bslash.in
142 CLEANFILES += %D%/ax/shell-no-trail-bslash
143 nodist_noinst_SCRIPTS += %D%/ax/shell-no-trail-bslash
145 %D%/ax/cc-no-c-o: %D%/ax/cc-no-c-o.in Makefile
146         $(AM_V_at)rm -f $@ $@-t
147         $(AM_V_GEN)in=%D%/ax/cc-no-c-o.in \
148           && $(MKDIR_P) %D%/ax \
149           && $(do_subst) <$(srcdir)/$$in >$@-t \
150           && chmod a+x $@-t
151         $(generated_file_finalize)
152 EXTRA_DIST += %D%/ax/cc-no-c-o.in
153 CLEANFILES += %D%/ax/cc-no-c-o
154 nodist_noinst_SCRIPTS += %D%/ax/cc-no-c-o
156 runtest: %D%/ax/runtest.in Makefile
157         $(AM_V_at)rm -f $@ $@-t
158         $(AM_V_GEN)in=%D%/ax/runtest.in \
159           && $(MKDIR_P) %D%/ax \
160           && $(do_subst) <$(srcdir)/$$in >$@-t \
161           && chmod a+x $@-t
162         $(generated_file_finalize)
163 EXTRA_DIST += %D%/ax/runtest.in
164 CLEANFILES += runtest
165 nodist_noinst_SCRIPTS += runtest
167 # If two test scripts have the same basename, they will end up sharing
168 # the same log file, leading to all sort of undefined and undesired
169 # behaviours.
170 check-no-repeated-test-name:
171         @LC_ALL=C; export LC_ALL; \
172          lst='$(TEST_LOGS)'; for log in $$lst; do echo $$log; done \
173            | sort | uniq -c | awk '($$1 > 1) { print }' \
174            | sed 's/\.log$$//' | grep . >&2 \
175            && { \
176              echo $@: test names listed above are duplicated >&2; \
177              exit 1; \
178            }; :
179 check-local: check-no-repeated-test-name
180 .PHONY: check-no-repeated-test-name
182 # Check that our test cases are syntactically correct.
183 # See automake bug#11898.
184 check-tests-syntax:
185         @st=0; \
186         err () { echo "$@: $$*" >&2; st=1; }; \
187 ## The user might do something like "make check TESTS=t/foo" or
188 ## "make check TESTS_LOGS=t/foo.log" and expect (say) the test
189 ## 't/foo.sh' to be run; this has worked well until today, and
190 ## we want to continue supporting this use case.
191         bases=`for log in : $(TEST_LOGS); do echo $$log; done \
192           | sed -e '/^:$$/d' -e 's/\.log$$//'`; \
193         for bas in $$bases; do \
194           for suf in sh tap pl; do \
195             tst=$$bas.$$suf; \
196 ## Emulate VPATH search.
197             if test -f $$tst; then \
198               break; \
199             elif test -f $(srcdir)/$$tst; then \
200               tst=$(srcdir)/$$tst; \
201               break; \
202             else \
203               tst=''; \
204             fi; \
205           done; \
206           test -n "$$tst" || err "couldn't find test '$$bas'"; \
207 ## Don't check that perl tests are valid shell scripts!
208           test $$suf = pl && continue; \
209           $(AM_V_P) && echo " $(AM_TEST_RUNNER_SHELL) -n $$tst"; \
210           $(AM_TEST_RUNNER_SHELL) -n "$$tst" \
211             || err "test '$$tst' syntactically invalid"; \
212         done; \
213         exit $$st
214 check-local: check-tests-syntax
215 .PHONY: check-tests-syntax
217 # Recipes with a trailing backslash character (possibly followed by
218 # blank characters only) can cause spurious syntax errors with at
219 # least older bash versions (e.g., bash 2.05b), and can be potentially
220 # be unportable to other weaker shells.  Run the testsuite in a way
221 # that helps catching such problems in Automake-generated recipes.
222 # See automake bug#10436.
223 check-no-trailing-backslash-in-recipes:
224         $(AM_V_GEN)$(MAKE) $(AM_MAKEFLAGS) check \
225           CONFIG_SHELL='$(abs_top_builddir)/%D%/ax/shell-no-trail-bslash'
226 .PHONY: check-no-trailing-backslash-in-recipes
228 # Some compilers out there (hello, MSVC) still choke on "-c -o" being
229 # passed together on the command line.  Run the whole testsuite faking
230 # the presence of such a compiler, to help catch regressions that would
231 # otherwise only present themselves later "in the wild".  See also the
232 # long discussion about automake bug#13378.
233 check-cc-no-c-o:
234         $(AM_V_GEN)$(MAKE) $(AM_MAKEFLAGS) check \
235           AM_TESTSUITE_SIMULATING_NO_CC_C_O=yes
236 .PHONY: check-cc-no-c-o
238 # Automake-generated Makefiles should work when run with parallel make.
239 check-parallel:
240         $(AM_V_GEN)$(MAKE) $(AM_MAKEFLAGS) check \
241           AM_TESTSUITE_MAKE="$${AM_TESTSUITE_MAKE-$${MAKE-make}} -j4"
242 .PHONY: check-parallel
244 ## Checking the list of tests.
245 test_subdirs = %D% %D%/pm contrib/%D%
246 include %D%/CheckListOfTests.am
248 # Run the testsuite with the installed aclocal and automake.
249 installcheck-local: installcheck-testsuite
250 installcheck-testsuite:
251         $(AM_V_GEN)$(MAKE) $(AM_MAKEFLAGS) check \
252           am_running_installcheck=yes
254 # Performance tests.
255 .PHONY: perf
256 perf: all
257         $(AM_V_GEN)$(MAKE) $(AM_MAKEFLAGS) check \
258           TEST_SUITE_LOG='$(PERF_TEST_SUITE_LOG)' TESTS='$(perf_TESTS)'
259 PERF_TEST_SUITE_LOG = %D%/perf/test-suite.log
260 CLEANFILES += $(PERF_TEST_SUITE_LOG)
261 EXTRA_DIST += $(perf_TESTS)
263 clean-local: clean-local-check
264 .PHONY: clean-local-check
265 clean-local-check:
266         $(AM_V_GEN)$(PERL) $(srcdir)/t/ax/deltree.pl t/*.dir t/*/*.dir */t/*.dir
268 # vim: ft=automake noet