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