ls: --color now highlights hard linked files, too
[coreutils/bo.git] / tests / check.mk
blob527e505817428d3985ad92bdb2202c65ccf01076
1 # Include this file at the end of each tests/*/Makefile.am.
2 # Copyright (C) 2007, 2008 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 @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; \
37 rm -f t1 t2; \
38 else :; fi
40 check: vc_exe_in_TESTS
41 .PHONY: vc_exe_in_TESTS
43 built_programs = \
44 (cd $(top_builddir)/src && MAKEFLAGS= $(MAKE) -s built_programs.list)
46 # Note that the first lines are statements. They ensure that environment
47 # variables that can perturb tests are unset or set to expected values.
48 # The rest are envvar settings that propagate build-related Makefile
49 # variables to test scripts.
50 TESTS_ENVIRONMENT = \
51 . $(srcdir)/lang-default; \
52 tmp__=$$TMPDIR; test -d "$$tmp__" || tmp__=.; \
53 . $(srcdir)/envvar-check; \
54 TMPDIR=$$tmp__; export TMPDIR; \
55 shell_or_perl_() { \
56 if grep '^\#!/usr/bin/perl' "$$1" > /dev/null; then \
57 if $(PERL) -e 'use warnings' > /dev/null 2>&1; then \
58 grep '^\#!/usr/bin/perl -T' "$$1" > /dev/null && T_=T || T_=; \
59 $(PERL) -w$$T_ -I$(srcdir) -MCoreutils \
60 -M"CuTmpdir qw($$tst)" -- "$$1"; \
61 else \
62 echo 1>&2 "$$tst: configure did not find a usable version of Perl," \
63 "so skipping this test"; \
64 (exit 77); \
65 fi; \
66 else \
67 $(SHELL) "$$1"; \
68 fi; \
69 }; \
70 export \
71 LOCALE_FR='$(LOCALE_FR)' \
72 LOCALE_FR_UTF8='$(LOCALE_FR_UTF8)' \
73 abs_top_builddir='$(abs_top_builddir)' \
74 abs_top_srcdir='$(abs_top_srcdir)' \
75 abs_srcdir='$(abs_srcdir)' \
76 built_programs="`$(built_programs)`" \
77 host_os=$(host_os) \
78 host_triplet='$(host_triplet)' \
79 srcdir='$(srcdir)' \
80 top_srcdir='$(top_srcdir)' \
81 CONFIG_HEADER='$(abs_top_builddir)/lib/config.h' \
82 CU_TEST_NAME=`basename '$(abs_srcdir)'`,$$tst \
83 CC='$(CC)' \
84 AWK='$(AWK)' \
85 EGREP='$(EGREP)' \
86 EXEEXT='$(EXEEXT)' \
87 MAKE=$(MAKE) \
88 PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)' \
89 PACKAGE_VERSION=$(PACKAGE_VERSION) \
90 PERL='$(PERL)' \
91 PREFERABLY_POSIX_SHELL='$(PREFERABLY_POSIX_SHELL)' \
92 REPLACE_GETCWD=$(REPLACE_GETCWD) \
93 PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" \
94 ; shell_or_perl_
96 TEST_LOGS = $(TESTS:=.log)
98 # Parallel replacement of Automake's check-TESTS target.
99 SUFFIXES =
100 include $(top_srcdir)/build-aux/check.mk
102 VERBOSE = yes