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