Merge branch 'compilers-for-testsuite'
[platform/upstream/automake.git] / tests / Makefile.am
1 ## Process this file with automake to create Makefile.in
2
3 # Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
4 # 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation,
5 # Inc.
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
10 # any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20 # Run the tests with the shell detected at configure time.
21 LOG_COMPILER = $(SHELL)
22
23 TEST_EXTENSIONS = .pl .test .tap
24 TEST_LOG_COMPILER = $(LOG_COMPILER)
25 TAP_LOG_COMPILER = $(LOG_COMPILER)
26 PL_LOG_COMPILER = $(PERL)
27 AM_PL_LOG_FLAGS = -Mstrict -I $(top_builddir)/lib -I $(top_srcdir)/lib -w
28
29 TAP_LOG_DRIVER = AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/lib/tap-driver.sh
30
31 AM_TAP_LOG_DRIVER_FLAGS = --merge
32
33 EXTRA_DIST = ChangeLog-old
34
35 TESTS = ## Will be updated later.
36
37 XFAIL_TESTS = \
38 all.test \
39 cond17.test \
40 gcj6.test \
41 override-conditional-2.test \
42 java-nobase.test \
43 objext-pr10128.test \
44 pr8365-remake-timing.test \
45 lex-subobj-nodep.test \
46 remake-am-pr10111.test \
47 remake-m4-pr10111.test \
48 txinfo5.test \
49 ## FIXME: this "expected failures" are in truth an hack used to
50 ## FIXME: to verify that some incorrect usages of our perl: libraries
51 ## FIXME: raise an error.  We should find a cleaner way to check that.
52 pm/Cond2.pl \
53 pm/Cond3.pl \
54 pm/DisjCon2.pl \
55 pm/DisjCon3.pl \
56 pm/Version2.pl \
57 pm/Version3.pl
58
59 # Some testsuite-influential variables should be overridable from the
60 # test scripts, but not from the environment.
61 AM_TESTS_ENVIRONMENT = \
62   for v in \
63     me \
64     required \
65     am_using_tap \
66     am_parallel_tests \
67     am_test_prefer_config_shell \
68     am_original_AUTOMAKE \
69     am_original_ACLOCAL \
70   ; do \
71     eval test x"\$${$$v}" = x || unset $$v; \
72   done;
73 # The `AM_TESTS_REEXEC=no' setting tells the tests not to needlessly
74 # re-execute themselves with the shell detected at configure time, since
75 # we are already running them under it explicitly in our setup (see e.g.
76 # the definition of TEST_LOG_COMPILER above).
77 AM_TESTS_ENVIRONMENT += AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC;
78 # We want warning messages and explanations for skipped tests to go to
79 # the console if possible, so set up `stderr_fileno_' properly.
80 AM_TESTS_FD_REDIRECT = 9>&2
81 AM_TESTS_ENVIRONMENT += stderr_fileno_=9; export stderr_fileno_;
82
83 # Hand-written tests.
84
85 include $(srcdir)/list-of-tests.mk
86
87 TESTS += $(handwritten_TESTS)
88 EXTRA_DIST += $(handwritten_TESTS)
89
90 # Automatically-generated tests wrapping hand-written ones.
91 # Also, automatically-computed dependencies for tests.
92
93 include $(srcdir)/testsuite-part.am
94
95 TESTS += $(generated_TESTS)
96 EXTRA_DIST += $(generated_TESTS)
97
98 $(srcdir)/testsuite-part.am:
99         $(AM_V_at)rm -f testsuite-part.tmp $@
100         $(AM_V_GEN)$(PERL) $(srcdir)/gen-testsuite-part \
101           --srcdir $(srcdir) > testsuite-part.tmp
102         $(AM_V_at)chmod a-w testsuite-part.tmp
103         $(AM_V_at)mv -f testsuite-part.tmp $@
104 EXTRA_DIST += gen-testsuite-part
105
106 $(generated_TESTS) $(srcdir)/testsuite-part.am: \
107   gen-testsuite-part list-of-tests.mk Makefile.am $(handwritten_TESTS)
108
109 # Static dependencies valid for each test case.
110 check_SCRIPTS = aclocal-$(APIVERSION) automake-$(APIVERSION)
111 check_DATA = defs defs-static plain-functions.sh tap-functions.sh
112 EXTRA_DIST += tap-functions.sh plain-functions.sh
113
114 # Few more static dependencies.
115 distcheck-missing-m4.log distcheck-outdated-m4.log: distcheck-hook-m4.am
116 EXTRA_DIST += distcheck-hook-m4.am
117
118 # Keep in sync with AC_SUBST'd stuff in defs-static.in.
119 do_subst = sed \
120   -e 's|@abs_srcdir[@]|$(abs_srcdir)|g' \
121   -e 's|@abs_top_srcdir[@]|$(abs_top_srcdir)|g' \
122   -e 's|@abs_builddir[@]|$(abs_builddir)|g' \
123   -e 's|@abs_top_builddir[@]|$(abs_top_builddir)|g' \
124   -e 's|@prefix[@]|$(prefix)|g' \
125   -e 's|@amdir[@]|$(amdir)|g' \
126   -e 's|@bindir[@]|$(bindir)|g' \
127   -e 's|@datadir[@]|$(datadir)|g' \
128   -e 's|@docdir[@]|$(docdir)|g' \
129   -e 's|@automake_acdir[@]|$(automake_acdir)|g' \
130   -e 's|@system_acdir[@]|$(system_acdir)|g' \
131   -e 's|@scriptdir[@]|$(scriptdir)|g' \
132   -e 's|@pkgvdatadir[@]|$(pkgvdatadir)|g' \
133   -e 's|@host_alias[@]|$(host_alias)|g' \
134   -e 's|@build_alias[@]|$(build_alias)|g' \
135   -e 's|@APIVERSION[@]|$(APIVERSION)|g' \
136   -e 's|@PATH_SEPARATOR[@]|$(PATH_SEPARATOR)|g' \
137   -e 's|@SHELL[@]|$(SHELL)|g' \
138   -e 's|@PERL[@]|$(PERL)|g' \
139   -e 's|@EGREP[@]|$(EGREP)|g' \
140   -e 's|@FGREP[@]|$(FGREP)|g' \
141   -e 's|@CPPFLAGS[@]|$(CPPFLAGS)|g' \
142   -e 's|@CC[@]|$(CC)|g' \
143   -e 's|@CFLAGS[@]|$(CFLAGS)|g' \
144   -e 's|@CXX[@]|$(CXX)|g' \
145   -e 's|@CXXFLAGS[@]|$(CXXFLAGS)|g' \
146   -e 's|@F77[@]|$(F77)|g' \
147   -e 's|@FFLAGS[@]|$(FFLAGS)|g' \
148   -e 's|@FC[@]|$(FC)|g' \
149   -e 's|@FCFLAGS[@]|$(FCFLAGS)|g' \
150   -e 's|@GNU_CFLAGS[@]|$(GNU_CFLAGS)|g' \
151   -e 's|@GNU_CXXFLAGS[@]|$(GNU_CXXFLAGS)|g' \
152   -e 's|@GNU_FFLAGS[@]|$(GNU_FFLAGS)|g' \
153   -e 's|@GNU_FCFLAGS[@]|$(GNU_FCFLAGS)|g' \
154   -e 's|@TEX[@]|$(TEX)|g' \
155   -e 's|@MODIFICATION_DELAY[@]|$(MODIFICATION_DELAY)|g' \
156   -e 's|@am_AUTOCONF[@]|$(am_AUTOCONF)|g' \
157   -e 's|@am_AUTOM4TE[@]|$(am_AUTOM4TE)|g' \
158   -e 's|@am_AUTORECONF[@]|$(am_AUTORECONF)|g' \
159   -e 's|@am_AUTOHEADER[@]|$(am_AUTOHEADER)|g' \
160   -e 's|@am_AUTOUPDATE[@]|$(am_AUTOUPDATE)|g' \
161   -e 's|@sh_errexit_works[@]|$(sh_errexit_works)|g' \
162   -e 's|@configure_input[@]|Generated from $@.in.  DO NOT EDIT BY HAND!|'
163
164 defs-static: defs-static.in
165         $(AM_V_at)rm -f $@ $@-t
166         $(AM_V_GEN)$(do_subst) $(srcdir)/defs-static.in >$@-t
167         $(AM_V_at) : Sanity check on the substitutions; \
168         if LC_ALL=C grep '@[a-zA-Z0-9_][a-zA-Z0-9_]*@' $@-t; then \
169           echo "$@ contains unexpanded substitution (see lines above)"; \
170           exit 1; \
171         fi
172         $(AM_V_at)chmod a-w $@-t && mv -f $@-t $@
173 EXTRA_DIST += defs-static.in
174 CLEANFILES = defs-static
175
176 # If two test scripts have the same basename, they will end up sharing
177 # the same log file, leading to all sort of undefined and undesired
178 # behaviours.
179 check-no-repeated-test-name:
180         @LC_ALL=C; export LC_ALL; \
181          lst='$(TEST_LOGS)'; for log in $$lst; do echo $$log; done \
182            | sort | uniq -c | awk '($$1 > 1) { print }' \
183            | sed 's/\.log$$//' | grep . >&2 \
184            && { \
185              echo $@: test names listed above are duplicated >&2; \
186              exit 1; \
187            }; :
188 check-local: check-no-repeated-test-name
189 .PHONY: check-no-repeated-test-name
190
191 ## Checking the list of tests.
192 test_subdirs = . pm
193 include $(srcdir)/CheckListOfTests.am
194
195 # Run the testsuite with the installed aclocal and automake.
196 installcheck-local:
197         am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
198
199 clean-local: clean-local-check
200 .PHONY: clean-local-check
201 clean-local-check:
202         -set x *.dir; shift; \
203          if test "$$#,$$1" = "1,*.dir"; then \
204            : there is no test directory to clean; \
205          else \
206            find "$$@" -type d ! -perm -700 -exec chmod u+rwx {} ';'; \
207            rm -rf "$$@"; \
208          fi;
209
210 ## Run the testsuite through the `prove' utility.  Mostly for maintainers,
211 ## and to find out possible incompatibilities between `prove' and the
212 ## Automake own TAP driver.
213
214 PROVE = prove
215 AM_PROVEFLAGS = --timer
216 AM_PROVECMD = \
217   test -z "$$tests" || \
218     { \
219       $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) \
220       $(PROVE) $(AM_PROVEFLAGS) -e $(srcdir)/prove-runner $(PROVEFLAGS) \
221       $$tests $(AM_TESTS_FD_REDIRECT); \
222     }
223
224 EXTRA_DIST += prove-runner
225
226 .PHONY: prove installprove
227 prove installprove: $(TESTS) prove-runner defs-static
228         @exit_status=0; \
229 ## The testsuite can be run either using the automake build tree or
230 ## the already-installed automake package.
231         case '$@' in \
232           install*) am_running_installcheck=yes;; \
233           *) am_running_installcheck=no;; \
234         esac; \
235         export am_running_installcheck; \
236 ## XXX Our poor-man way to handle inter-tests dependencies without the
237 ## XXX help of make.  This is obviously fragile and doesn't scale,
238 ## XXX but for now it's good enough since we have only one possible
239 ## XXX inter-tests dependency at the moment.
240         need_tap_common_setup=no; \
241         lst=' $(TESTS) '; for t in $$lst; do \
242           case ' $(on_tap_with_common_setup_TESTS) ' in \
243             *" $$t "*) need_tap_common_setup=yes; break;; \
244           esac; \
245         done; \
246 ## For VPATH builds.
247         if test $$need_tap_common_setup = yes; then \
248           t=tap-common-setup.test; \
249           if test -f ./$$t; then \
250             tests=./$$t; \
251           else \
252             tests=$(srcdir)/$$t; \
253           fi; \
254 ## Do not stop if there's a failure here, we want to run the following
255 ## tests anyway.
256           echo "$@: running pre-requisite tests ..."; \
257           $(AM_PROVECMD) || exits_status=$$?; \
258           echo "$@: done.  We'll shortly run the main testsuite."; \
259         fi; \
260 ## Handle VPATH builds, and ensure that the tests have a properly
261 ## qualified path.
262         tests=`\
263           for t in $(TESTS); do \
264 ## XXX In next line, another hack for inter-tests dependencies: this
265 ## XXX can't run concurrently to the tests that use the data files it
266 ## XXX generates.
267             case "$$need_tap_common_setup,/$$t" in \
268               yes,*/tap-common-setup.test) continue;; \
269             esac; \
270             if test -f ./$$t; then \
271               echo ./$$t; \
272             else \
273               echo $(srcdir)/$$t; \
274             fi; \
275           done`; \
276 ## Extra environment, mostly for use by `prove-runner'.
277 ## XFAIL_TESTS gets normalized to play nicer with VPATH builds.
278         XFAIL_TESTS=`\
279           for t in $(XFAIL_TESTS); do \
280             echo $$t; echo ./$$t; echo $(srcdir)/$$t; \
281           done | LC_ALL=C sort | uniq`; \
282         XFAIL_TESTS=`echo $$XFAIL_TESTS`; \
283         TAP_RUNNER='$(TAP_LOG_COMPILE)' \
284         TEST_RUNER='$(TEST_LOG_COMPILE)' \
285         export XFAIL_TESTS TAP_RUNNER TEST_RUNNER; \
286 ## For consistency with the Automake testsuite harness, that exports
287 ## this unconditionally in the test scripts' environment.
288         srcdir='$(srcdir)'; export srcdir; \
289 ## Here we go.
290         $(AM_PROVECMD) || exit_status=$$?; \
291         exit $$exit_status;