1 # Include this file at the end of each tests/*/Makefile.am.
2 # Copyright (C) 2007-2011 Free Software Foundation, Inc.
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 3 of the License, or
7 # (at your option) any later version.
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.
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/>.
17 # Ensure that all version-controlled executable files are listed in TESTS.
18 # Collect test names from the line matching /^TESTS = \\$$/ to the following
19 # one that does not end in '\'.
22 vc_exe_in_TESTS: Makefile
23 $(AM_V_GEN)rm -f t1 t2; \
24 if test -d $(top_srcdir)/.git && test $(srcdir) = .; then \
25 { sed -n '/^$(_v) =[ ]*\\$$/,/[^\]$$/p' \
26 $(srcdir)/Makefile.am \
27 | sed 's/^ *//;/^\$$.*/d;/^$(_v) =/d'; \
28 sed -n '/^$(_w) =[ ]*\\$$/,/[^\]$$/p' \
29 $(srcdir)/Makefile.am \
30 | sed 's/^ *//;/^\$$.*/d;/^$(_w) =/d'; } \
31 | tr -s '\012\\' ' ' | fmt -1 | sort -u > t1 && \
32 for f in `cd $(top_srcdir) && build-aux/vc-list-files $(subdir)`; do \
33 f=`echo $$f|sed 's!^$(subdir)/!!'`; \
34 test -f "$$f" && test -x "$$f" && echo "$$f"; \
35 done | sort -u > t2 && \
36 diff -u t1 t2 || exit 1; \
40 check: vc_exe_in_TESTS
41 .PHONY: vc_exe_in_TESTS
44 CLEANFILES += .built-programs
45 check-am: .built-programs
47 $(AM_V_GEN)(cd $(top_builddir)/src \
48 && MAKEFLAGS= $(MAKE) -s built_programs.list) \
51 ## `$f' is set by the Automake-generated test harness to the path of the
52 ## current test script stripped of VPATH components, and is used by the
53 ## shell-or-perl script to determine the name of the temporary files to be
54 ## used. Note that $f is a shell variable, not a make macro, so the use of
55 ## `$$f' below is correct, and not a typo.
57 $(SHELL) $(srcdir)/shell-or-perl \
58 --test-name "$$f" --srcdir '$(srcdir)' \
59 --shell '$(SHELL)' --perl '$(PERL)' --
61 # Note that the first lines are statements. They ensure that environment
62 # variables that can perturb tests are unset or set to expected values.
63 # The rest are envvar settings that propagate build-related Makefile
64 # variables to test scripts.
66 . $(srcdir)/lang-default; \
67 tmp__=$${TMPDIR-/tmp}; \
68 test -d "$$tmp__" && test -w "$$tmp__" || tmp__=.; \
69 . $(srcdir)/envvar-check; \
70 TMPDIR=$$tmp__; export TMPDIR; \
72 VERSION='$(VERSION)' \
73 LOCALE_FR='$(LOCALE_FR)' \
74 LOCALE_FR_UTF8='$(LOCALE_FR_UTF8)' \
75 abs_top_builddir='$(abs_top_builddir)' \
76 abs_top_srcdir='$(abs_top_srcdir)' \
77 abs_srcdir='$(abs_srcdir)' \
78 built_programs="`cat .built-programs`" \
80 host_triplet='$(host_triplet)' \
82 top_srcdir='$(top_srcdir)' \
83 CONFIG_HEADER='$(abs_top_builddir)/$(CONFIG_INCLUDE)' \
84 CU_TEST_NAME=`basename '$(abs_srcdir)'`,`echo $$tst|sed 's,^\./,,;s,/,-,g'` \
90 PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)' \
91 PACKAGE_VERSION=$(PACKAGE_VERSION) \
93 PREFERABLY_POSIX_SHELL='$(PREFERABLY_POSIX_SHELL)' \
94 REPLACE_GETCWD=$(REPLACE_GETCWD) \
95 ; test -d /usr/xpg4/bin && PATH='/usr/xpg4/bin$(PATH_SEPARATOR)'"$$PATH"; \
96 PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" \