summaryrefslogtreecommitdiffstats
path: root/src/grep/tests/Makefile.am
blob: c84cdc0e34eee427405038ac2fd9f1af7d695dc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
## Process this file with automake to create Makefile.in
# Copyright 1997-1998, 2005-2021 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

TEST_EXTENSIONS = .sh .pl

if HAVE_PERL
TESTSUITE_PERL = $(PERL)
else
TESTSUITE_PERL = $(SHELL) $(srcdir)/no-perl
endif

# Options passed to the perl invocations running the perl test scripts.
TESTSUITE_PERL_OPTIONS = -w -I$(srcdir) -MCoreutils -MCuSkip
# '$f' is set by the Automake-generated test harness to the path of the
# current test script stripped of VPATH components, and is used by the
# CuTmpdir module to determine the name of the temporary files to be
# used.  Note that $f is a shell variable, not a make macro, so the use
# of '$$f' below is correct, and not a typo.
TESTSUITE_PERL_OPTIONS += -M"CuTmpdir qw($$f)"

SH_LOG_COMPILER = $(SHELL)
PL_LOG_COMPILER = $(TESTSUITE_PERL) $(TESTSUITE_PERL_OPTIONS)

check_PROGRAMS = get-mb-cur-max
AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib \
  -I$(top_srcdir)/src
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)

# Tell the linker to omit references to unused shared libraries.
AM_LDFLAGS = $(IGNORE_UNUSED_LIBRARIES_CFLAGS)
LDADD = ../lib/libgreputils.a $(LIBINTL) ../lib/libgreputils.a

# The triple-backref test is expected to fail with both the system
# matcher (i.e., with glibc) and with the included matcher.
# Both matchers need to be fixed.
# FIXME-2015: Remove this once the glibc and gnulib bugs are fixed.
XFAIL_TESTS = triple-backref

# Equivalence classes are only supported when using the system
# matcher (which means only with glibc).
# The included matcher needs to be fixed.
# FIXME-2015: Remove this once the gnulib bug is fixed.
if USE_INCLUDED_REGEX
XFAIL_TESTS += equiv-classes
else
# The backref-alt test fails for glibc 2.27 and earlier.
# If you're using older glibc you can upgrade to glibc 2.28 or later,
# configure --with-included-regex, or ignore the test failure.
endif

TESTS =						\
  backref					\
  backref-alt					\
  backref-multibyte-slow			\
  backref-word					\
  backslash-dot					\
  backslash-s-and-repetition-operators		\
  backslash-s-vs-invalid-multibyte		\
  big-hole					\
  big-match					\
  binary-file-matches				\
  bogus-wctob					\
  bre						\
  c-locale					\
  case-fold-backref				\
  case-fold-backslash-w				\
  case-fold-char-class				\
  case-fold-char-range				\
  case-fold-char-type				\
  case-fold-titlecase				\
  char-class-multibyte				\
  char-class-multibyte2				\
  context-0					\
  count-newline					\
  dfa-coverage					\
  dfa-heap-overrun				\
  dfa-infloop					\
  dfa-invalid-utf8				\
  dfaexec-multibyte				\
  empty						\
  empty-line					\
  empty-line-mb					\
  encoding-error				\
  epipe						\
  equiv-classes					\
  ere						\
  euc-mb					\
  false-match-mb-non-utf8			\
  fedora					\
  fgrep-infloop					\
  fgrep-longest					\
  file						\
  filename-lineno.pl				\
  fmbtest					\
  foad1						\
  grep-dev-null					\
  grep-dev-null-out				\
  grep-dir					\
  hash-collision-perf				\
  help-version					\
  high-bit-range				\
  in-eq-out-infloop				\
  include-exclude				\
  inconsistent-range				\
  initial-tab					\
  invalid-multibyte-infloop			\
  khadafy					\
  kwset-abuse					\
  long-line-vs-2GiB-read			\
  long-pattern-perf				\
  many-regex-performance			\
  match-lines					\
  max-count-overread				\
  max-count-vs-context				\
  mb-dot-newline				\
  mb-non-UTF8-overrun				\
  mb-non-UTF8-perf-Fw				\
  mb-non-UTF8-performance			\
  mb-non-UTF8-word-boundary			\
  multibyte-white-space				\
  multiple-begin-or-end-line			\
  null-byte					\
  options					\
  pcre						\
  pcre-abort					\
  pcre-context					\
  pcre-count					\
  pcre-infloop					\
  pcre-invalid-utf8-infloop			\
  pcre-invalid-utf8-input			\
  pcre-jitstack					\
  pcre-o					\
  pcre-utf8					\
  pcre-w					\
  pcre-wx-backref				\
  pcre-z					\
  posix-bracket					\
  prefix-of-multibyte				\
  proc						\
  r-dot						\
  repetition-overflow				\
  reversed-range-endpoints			\
  sjis-mb					\
  skip-device					\
  skip-read					\
  spencer1					\
  spencer1-locale				\
  stack-overflow				\
  status					\
  surrogate-pair				\
  symlink					\
  triple-backref				\
  turkish-I					\
  turkish-I-without-dot				\
  turkish-eyes					\
  two-chars					\
  two-files					\
  unibyte-binary				\
  unibyte-bracket-expr				\
  unibyte-negated-circumflex			\
  utf8-bracket					\
  warn-char-classes				\
  word-delim-multibyte				\
  word-multi-file				\
  word-multibyte				\
  write-error-msg				\
  yesno						\
  z-anchor-newline

EXTRA_DIST =					\
  $(TESTS)					\
  bre.awk					\
  bre.tests					\
  Coreutils.pm					\
  CuSkip.pm					\
  CuTmpdir.pm					\
  envvar-check					\
  ere.awk					\
  ere.tests					\
  init.cfg					\
  init.sh					\
  khadafy.lines					\
  khadafy.regexp				\
  no-perl					\
  spencer1.awk					\
  spencer1.tests				\
  spencer1-locale.awk

# Default to a nonzero value.  Environment overrides.
# https://udrepper.livejournal.com/11429.html
MALLOC_PERTURB_ = 1

TESTS_ENVIRONMENT =				\
  tmp__=$${TMPDIR-/tmp};			\
  test -d "$$tmp__" && test -w "$$tmp__" || tmp__=.;	\
  . $(srcdir)/envvar-check;			\
  TMPDIR=$$tmp__; export TMPDIR;		\
						\
  if test -n "$$BASH_VERSION" || (eval "export v=x") 2>/dev/null; then \
    export_with_values () { export "$$@"; };		\
  else							\
    export_with_values ()				\
    {							\
      sed_extract_var='s/=.*//';			\
      sed_quote_value="s/'/'\\\\''/g;s/=\\(.*\\)/='\\1'/";\
      for arg in "$$@"; do				\
        var=`echo "$$arg" | sed "$$sed_extract_var"`;	\
        arg=`echo "$$arg" | sed "$$sed_quote_value"`;	\
        eval "$$arg";					\
        export "$$var";					\
      done;						\
    };							\
  fi;							\
							\
  : 'Test egrep/fgrep help if they use our grep.';	\
  grep=`echo grep | sed -e '$(transform)'` || exit;	\
  if test "$$grep" = grep; then				\
    built_programs='grep egrep fgrep';			\
  else							\
    built_programs='grep';				\
  fi;							\
						\
  export_with_values				\
  VERSION='$(VERSION)'				\
  LOCALE_FR='$(LOCALE_FR)'			\
  LOCALE_FR_UTF8='$(LOCALE_FR_UTF8)'		\
  AWK=$(AWK)					\
  LC_ALL=C					\
  abs_top_builddir='$(abs_top_builddir)'	\
  abs_top_srcdir='$(abs_top_srcdir)'		\
  abs_srcdir='$(abs_srcdir)'			\
  built_programs="$$built_programs"		\
  host_triplet='$(host_triplet)'		\
  srcdir='$(srcdir)'				\
  top_srcdir='$(top_srcdir)'			\
  CC='$(CC)'					\
  GREP_TEST_NAME=`echo $$tst|sed 's,^\./,,;s,/,-,g'` \
  MAKE=$(MAKE)					\
  MALLOC_PERTURB_=$(MALLOC_PERTURB_)		\
  PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)'	\
  PACKAGE_VERSION=$(PACKAGE_VERSION)		\
  PERL='$(PERL)'				\
  SHELL='$(SHELL)'				\
  PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" \
  ;						\
						\
  : 'set this envvar to indicate whether -P works';	\
  m=0; if err=`echo .|grep -Pq . 2>&1`; then		\
    test -z "$$err" && m=1; fi;				\
  export PCRE_WORKS=$$m;				\
  9>&2

LOG_COMPILER = $(SHELL)

VERBOSE = yes

check: check_executable_TESTS
.PHONY: check_executable_TESTS
check_executable_TESTS: Makefile
	$(AM_V_GEN)fail=0;						\
        cd $(srcdir) && for i in $(TESTS); do				\
	  test -x $$i || { fail=1; echo $$i >&2; };			\
	done;								\
	test $$fail = 1							\
          && { echo the above test scripts are not executable >&2; exit 1; } \
          || :