maint: merge build improvements from coreutils
[debian/gzip] / tests / Makefile.am
1 ## Process this file with automake to create Makefile.in
2 # Copyright 2010-2012 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 3, 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 TESTS =                                 \
18   helin-segv                            \
19   help-version                          \
20   hufts                                 \
21   memcpy-abuse                          \
22   mixed                                 \
23   null-suffix-clobber                   \
24   stdin                                 \
25   trailing-nul                          \
26   zdiff                                 \
27   zgrep-f                               \
28   zgrep-context                         \
29   zgrep-signal                          \
30   znew-k
31
32 EXTRA_DIST =                            \
33   $(TESTS)                              \
34   init.cfg                              \
35   init.sh                               \
36   hufts-segv.gz
37
38 built_programs = \
39   gzip          \
40   gunzip        \
41   gzexe         \
42   zcat          \
43   zcmp          \
44   zdiff         \
45   zegrep        \
46   zfgrep        \
47   zforce        \
48   zgrep         \
49   zless         \
50   zmore         \
51   znew
52
53 TESTS_ENVIRONMENT =                             \
54   tmp__=$$TMPDIR; test -d "$$tmp__" || tmp__=.; \
55   TMPDIR=$$tmp__; export TMPDIR;                \
56   shell_or_perl_() {                            \
57     if grep '^\#!/usr/bin/perl' "$$1" > /dev/null; then                 \
58       if $(PERL) -e 'use warnings' > /dev/null 2>&1; then               \
59         grep '^\#!/usr/bin/perl -T' "$$1" > /dev/null && T_=T || T_=;   \
60         $(PERL) -w$$T_ -I$(srcdir) -MCoreutils                          \
61               -M"CuTmpdir qw($$f)" -- "$$1";    \
62       else                                      \
63         echo 1>&2 "$$tst: configure did not find a usable version of Perl," \
64           "so skipping this test";              \
65         (exit 77);                              \
66       fi;                                       \
67     else                                        \
68       $(SHELL) "$$1";                           \
69     fi;                                         \
70   };                                            \
71   export                                        \
72   LC_ALL=C                                      \
73   VERSION=$(VERSION)                            \
74   abs_top_builddir='$(abs_top_builddir)'        \
75   abs_top_srcdir='$(abs_top_srcdir)'            \
76   abs_srcdir='$(abs_srcdir)'                    \
77   built_programs='$(built_programs)'            \
78   srcdir='$(srcdir)'                            \
79   top_srcdir='$(top_srcdir)'                    \
80   CC='$(CC)'                                    \
81   GZIP_TEST_NAME=`echo $$tst|sed 's,^\./,,;s,/,-,g'` \
82   MAKE=$(MAKE)                                  \
83   PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)'      \
84   PACKAGE_VERSION=$(PACKAGE_VERSION)            \
85   PERL='$(PERL)'                                \
86   SHELL='$(SHELL)'                              \
87   PATH='$(abs_top_builddir)$(PATH_SEPARATOR)'"$$PATH" \
88   ; 9>&2
89
90 VERBOSE = yes