tests: use "compare exp out", not "compare out exp"
[coreutils/ericb.git] / tests / check.mk
blob557d41a7a5beadbcee8fac9ec7ecd71184debdcc
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 '\'.
20 _v = TESTS
21 _w = root_tests
22 vc_exe_in_TESTS: Makefile
23 $(AM_V_GEN)if test -d $(top_srcdir)/.git && test $(srcdir) = .; then \
24 { \
25 for list in $(_v) $(_w); do \
26 sed -n "/^$$list =[ ]*\\\\$$/,/[^\]$$/p" Makefile.am | \
27 sed -n 's/^ *\([^$$ ]\{1,\}\).*/\1/p'; \
28 done; \
29 for f in `cd $(top_srcdir) && \
30 build-aux/vc-list-files $(subdir) | sed 's!^$(subdir)/!!'`; do \
31 test -f "$$f" && test -x "$$f" && echo "$$f"; \
32 done; \
33 } | sort | uniq -u | grep . && exit 1 ||:; \
34 else :; fi
36 check: vc_exe_in_TESTS
37 .PHONY: vc_exe_in_TESTS
39 CLEANFILES =
40 CLEANFILES += .built-programs
41 check-am: .built-programs
42 .built-programs:
43 $(AM_V_GEN)(cd $(top_builddir)/src \
44 && MAKEFLAGS= $(MAKE) -s built_programs.list) \
45 > $@-t && mv $@-t $@
47 ## `$f' is set by the Automake-generated test harness to the path of the
48 ## current test script stripped of VPATH components, and is used by the
49 ## shell-or-perl script to determine the name of the temporary files to be
50 ## used. Note that $f is a shell variable, not a make macro, so the use of
51 ## `$$f' below is correct, and not a typo.
52 LOG_COMPILER = \
53 $(SHELL) $(srcdir)/shell-or-perl \
54 --test-name "$$f" --srcdir '$(srcdir)' \
55 --shell '$(SHELL)' --perl '$(PERL)' --
57 # Note that the first lines are statements. They ensure that environment
58 # variables that can perturb tests are unset or set to expected values.
59 # The rest are envvar settings that propagate build-related Makefile
60 # variables to test scripts.
61 TESTS_ENVIRONMENT = \
62 . $(srcdir)/lang-default; \
63 tmp__=$${TMPDIR-/tmp}; \
64 test -d "$$tmp__" && test -w "$$tmp__" || tmp__=.; \
65 . $(srcdir)/envvar-check; \
66 TMPDIR=$$tmp__; export TMPDIR; \
67 export \
68 VERSION='$(VERSION)' \
69 LOCALE_FR='$(LOCALE_FR)' \
70 LOCALE_FR_UTF8='$(LOCALE_FR_UTF8)' \
71 abs_top_builddir='$(abs_top_builddir)' \
72 abs_top_srcdir='$(abs_top_srcdir)' \
73 abs_srcdir='$(abs_srcdir)' \
74 built_programs="`cat .built-programs`" \
75 host_os=$(host_os) \
76 host_triplet='$(host_triplet)' \
77 srcdir='$(srcdir)' \
78 top_srcdir='$(top_srcdir)' \
79 CONFIG_HEADER='$(abs_top_builddir)/$(CONFIG_INCLUDE)' \
80 CU_TEST_NAME=`basename '$(abs_srcdir)'`,`echo $$tst|sed 's,^\./,,;s,/,-,g'` \
81 CC='$(CC)' \
82 AWK='$(AWK)' \
83 EGREP='$(EGREP)' \
84 EXEEXT='$(EXEEXT)' \
85 MAKE=$(MAKE) \
86 PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)' \
87 PACKAGE_VERSION=$(PACKAGE_VERSION) \
88 PERL='$(PERL)' \
89 PREFERABLY_POSIX_SHELL='$(PREFERABLY_POSIX_SHELL)' \
90 REPLACE_GETCWD=$(REPLACE_GETCWD) \
91 ; test -d /usr/xpg4/bin && PATH='/usr/xpg4/bin$(PATH_SEPARATOR)'"$$PATH"; \
92 PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" \
93 ; 9>&2
95 VERBOSE = yes