Makefile.inc 9.1 KB

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