1 ## Included by top-level Makefile for Automake.
3 ## Copyright (C) 1995-2013 Free Software Foundation, Inc.
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)
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/>.
22 # Run the tests with a proper shell detected at configure time.
23 LOG_COMPILER = $(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 = $(PERL)
29 AM_PL_LOG_FLAGS = -Mstrict -I $(builddir)/lib -I $(srcdir)/lib -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.
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 = \
49 am_test_prefer_config_shell \
50 am_original_AUTOMAKE \
55 eval test x"\$${$$v}" = x || unset $$v; \
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; \
69 PATH='$(abs_builddir)/%D%/ax'$(PATH_SEPARATOR)$$PATH; \
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
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 nodist_noinst_SCRIPTS += \
114 %D%/wrap/aclocal-$(APIVERSION) \
115 %D%/wrap/automake-$(APIVERSION)
117 dist_noinst_DATA += \
118 %D%/ax/test-init.sh \
120 %D%/ax/am-test-lib.sh \
121 %D%/ax/tap-functions.sh
123 # Few more static dependencies.
124 %D%/distcheck-missing-m4.log: %D%/ax/distcheck-hook-m4.am
125 %D%/distcheck-outdated-m4.log: %D%/ax/distcheck-hook-m4.am
126 EXTRA_DIST += %D%/ax/distcheck-hook-m4.am
128 %D%/ax/test-defs.sh: %D%/ax/test-defs.in Makefile
129 $(AM_V_at)rm -f $@ $@-t
130 $(AM_V_at)$(MKDIR_P) %D%/ax
131 $(AM_V_GEN)in=%D%/ax/test-defs.in \
132 && $(do_subst) <$(srcdir)/$$in >$@-t
133 $(generated_file_finalize)
134 EXTRA_DIST += %D%/ax/test-defs.in
135 CLEANFILES += %D%/ax/test-defs.sh
136 nodist_noinst_DATA += %D%/ax/test-defs.sh
138 %D%/ax/shell-no-trail-bslash: %D%/ax/shell-no-trail-bslash.in Makefile
139 $(AM_V_at)rm -f $@ $@-t
140 $(AM_V_GEN)in=%D%/ax/shell-no-trail-bslash.in \
141 && $(MKDIR_P) %D%/ax \
142 && $(do_subst) <$(srcdir)/$$in >$@-t \
144 $(generated_file_finalize)
145 EXTRA_DIST += %D%/ax/shell-no-trail-bslash.in
146 CLEANFILES += %D%/ax/shell-no-trail-bslash
147 nodist_noinst_SCRIPTS += %D%/ax/shell-no-trail-bslash
149 %D%/ax/cc-no-c-o: %D%/ax/cc-no-c-o.in Makefile
150 $(AM_V_at)rm -f $@ $@-t
151 $(AM_V_GEN)in=%D%/ax/cc-no-c-o.in \
152 && $(MKDIR_P) %D%/ax \
153 && $(do_subst) <$(srcdir)/$$in >$@-t \
155 $(generated_file_finalize)
156 EXTRA_DIST += %D%/ax/cc-no-c-o.in
157 CLEANFILES += %D%/ax/cc-no-c-o
158 nodist_noinst_SCRIPTS += %D%/ax/cc-no-c-o
160 runtest: %D%/ax/runtest.in Makefile
161 $(AM_V_at)rm -f $@ $@-t
162 $(AM_V_GEN)in=%D%/ax/runtest.in \
163 && $(MKDIR_P) %D%/ax \
164 && $(do_subst) <$(srcdir)/$$in >$@-t \
166 $(generated_file_finalize)
167 EXTRA_DIST += %D%/ax/runtest.in
168 CLEANFILES += runtest
169 nodist_noinst_SCRIPTS += runtest
171 # If two test scripts have the same basename, they will end up sharing
172 # the same log file, leading to all sort of undefined and undesired
174 check-no-repeated-test-name:
175 @LC_ALL=C; export LC_ALL; \
176 lst='$(TEST_LOGS)'; for log in $$lst; do echo $$log; done \
177 | sort | uniq -c | awk '($$1 > 1) { print }' \
178 | sed 's/\.log$$//' | grep . >&2 \
180 echo $@: test names listed above are duplicated >&2; \
183 check-local: check-no-repeated-test-name
184 .PHONY: check-no-repeated-test-name
186 # Check that our test cases are syntactically correct.
187 # See automake bug#11898.
190 err () { echo "$@: $$*" >&2; st=1; }; \
191 ## The user might do something like "make check TESTS=t/foo" or
192 ## "make check TESTS_LOGS=t/foo.log" and expect (say) the test
193 ## 't/foo.sh' to be run; this has worked well until today, and
194 ## we want to continue supporting this use case.
195 bases=`for log in : $(TEST_LOGS); do echo $$log; done \
196 | sed -e '/^:$$/d' -e 's/\.log$$//'`; \
197 for bas in $$bases; do \
198 for suf in sh tap pl; do \
200 ## Emulate VPATH search.
201 if test -f $$tst; then \
203 elif test -f $(srcdir)/$$tst; then \
204 tst=$(srcdir)/$$tst; \
210 test -n "$$tst" || err "couldn't find test '$$bas'"; \
211 ## Don't check that perl tests are valid shell scripts!
212 test $$suf = pl && continue; \
213 $(AM_V_P) && echo " $(AM_TEST_RUNNER_SHELL) -n $$tst"; \
214 $(AM_TEST_RUNNER_SHELL) -n "$$tst" \
215 || err "test '$$tst' syntactically invalid"; \
218 check-local: check-tests-syntax
219 .PHONY: check-tests-syntax
221 # Recipes with a trailing backslash character (possibly followed by
222 # blank characters only) can cause spurious syntax errors with at
223 # least older bash versions (e.g., bash 2.05b), and can be potentially
224 # be unportable to other weaker shells. Run the testsuite in a way
225 # that helps catching such problems in Automake-generated recipes.
226 # See automake bug#10436.
227 check-no-trailing-backslash-in-recipes:
228 $(AM_V_GEN)$(MAKE) $(AM_MAKEFLAGS) check \
229 CONFIG_SHELL='$(abs_top_builddir)/%D%/ax/shell-no-trail-bslash'
230 .PHONY: check-no-trailing-backslash-in-recipes
232 # Some compilers out there (hello, MSVC) still choke on "-c -o" being
233 # passed together on the command line. Run the whole testsuite faking
234 # the presence of such a compiler, to help catch regressions that would
235 # otherwise only present themselves later "in the wild". See also the
236 # long discussion about automake bug#13378.
238 $(AM_V_GEN)$(MAKE) $(AM_MAKEFLAGS) check \
239 AM_TESTSUITE_SIMULATING_NO_CC_C_O=yes
240 .PHONY: check-cc-no-c-o
242 # Automake-generated Makefiles should work when run with parallel make.
244 $(AM_V_GEN)$(MAKE) $(AM_MAKEFLAGS) check \
245 AM_TESTSUITE_MAKE="$${AM_TESTSUITE_MAKE-$${MAKE-make}} -j4"
246 .PHONY: check-parallel
248 ## Checking the list of tests.
249 test_subdirs = %D% %D%/pm contrib/%D%
250 include %D%/CheckListOfTests.am
252 # Run the testsuite with the installed aclocal and automake.
253 installcheck-local: installcheck-testsuite
254 installcheck-testsuite:
255 $(AM_V_GEN)$(MAKE) $(AM_MAKEFLAGS) check \
256 am_running_installcheck=yes
261 $(AM_V_GEN)$(MAKE) $(AM_MAKEFLAGS) check \
262 TEST_SUITE_LOG='$(PERF_TEST_SUITE_LOG)' TESTS='$(perf_TESTS)'
263 PERF_TEST_SUITE_LOG = %D%/perf/test-suite.log
264 CLEANFILES += $(PERF_TEST_SUITE_LOG)
265 EXTRA_DIST += $(perf_TESTS)
267 clean-local: clean-local-check
268 .PHONY: clean-local-check
270 $(AM_V_GEN)$(PERL) $(srcdir)/t/ax/deltree.pl t/*.dir t/*/*.dir */t/*.dir
272 # vim: ft=automake noet