582f97660ec48eb406f5cf3e08511195b0189a72
[platform/upstream/diffutils.git] / tests / Makefile.am
1 # tests for GNU diff
2
3 TESTS = \
4   basic \
5   binary \
6   colliding-file-names \
7   excess-slash \
8   help-version  \
9   function-line-vs-leading-space \
10   label-vs-func \
11   no-newline-at-eof \
12   stdin
13
14 EXTRA_DIST = \
15   $(TESTS) init.sh t-local.sh
16
17 # Note that the first lines are statements.  They ensure that environment
18 # variables that can perturb tests are unset or set to expected values.
19 # The rest are envvar settings that propagate build-related Makefile
20 # variables to test scripts.
21 TESTS_ENVIRONMENT =                             \
22   tmp__=$$TMPDIR; test -d "$$tmp__" || tmp__=.; \
23   TMPDIR=$$tmp__; export TMPDIR;                \
24   exec 9>&2;                                    \
25   shell_or_perl_() {                            \
26     if grep '^\#!/usr/bin/perl' "$$1" > /dev/null; then                 \
27       if $(PERL) -e 'use warnings' > /dev/null 2>&1; then               \
28         grep '^\#!/usr/bin/perl -T' "$$1" > /dev/null && T_=T || T_=;   \
29         $(PERL) -w$$T_ -I$(srcdir) -MCoreutils                          \
30               -M"CuTmpdir qw($$f)" -- "$$1";    \
31       else                                      \
32         echo 1>&2 "$$tst: configure did not find a usable version of Perl," \
33           "so skipping this test";              \
34         (exit 77);                              \
35       fi;                                       \
36     else                                        \
37       $(SHELL) "$$1";                           \
38     fi;                                         \
39   };                                            \
40   export                                        \
41   VERSION='$(VERSION)'                          \
42   abs_top_builddir='$(abs_top_builddir)'        \
43   abs_top_srcdir='$(abs_top_srcdir)'            \
44   abs_srcdir='$(abs_srcdir)'                    \
45   built_programs="`$(built_programs)`"          \
46   srcdir='$(srcdir)'                            \
47   top_srcdir='$(top_srcdir)'                    \
48   CC='$(CC)'                                    \
49   MAKE=$(MAKE)                                  \
50   PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)'      \
51   PACKAGE_VERSION=$(PACKAGE_VERSION)            \
52   CONFIG_HEADER='$(abs_top_builddir)/lib/config.h' \
53   ENABLE_DEVICE_MAPPER=$(ENABLE_DEVICE_MAPPER)  \
54   PERL='$(PERL)'                                \
55   PREFERABLY_POSIX_SHELL='$(PREFERABLY_POSIX_SHELL)' \
56   REPLACE_GETCWD=$(REPLACE_GETCWD)              \
57   PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" \
58   ; shell_or_perl_
59
60 built_programs =                                                        \
61   echo 'spy:;@echo $$(PROGRAMS)'                                        \
62     | MAKEFLAGS= $(MAKE) -s -C $(builddir)/../src -f Makefile -f - spy  \
63     | fmt -1 | sed 's,$(EXEEXT)$$,,' | sort -u
64
65 VERBOSE = yes