summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAssaf Gordon <assafgordon@gmail.com>2016-12-16 01:34:20 (GMT)
committerAssaf Gordon <assafgordon@gmail.com>2016-12-16 01:34:20 (GMT)
commit6bcd430230ff02d7fa3c2bf9ffc183125b04490d (patch)
tree00c2463c4a4345f18ca788aab4b610aa6dc63720
parenteec6ab399159b8c3caec722d956531a4e799a84c (diff)
downloadgrep-non-recursive-2.zip
grep-non-recursive-2.tar.gz
grep-non-recursive-2.tar.bz2
build: switch to non-recursive makefilenon-recursive-2
* bootstrap.conf: Add 'non-recursive-gnulib-prefix-hack' gnulib module. (bootstrap_post_import_hook): Add required gnulib 'prefix' code. * build-aux/.gitignore: Ignore new gnulib-prefix-hack M4 file. * configure.ac: Don't generate makefiles in subdirectories. * cfg.mk (local-checks-to-skip): Skip 'sc_cross_check_PATH_usage_in_tests'. It does not work with non-recursive makefiles. * Makefile.am: Include 'local.mk' files, adjust for non-recursive make. (AM_CFLAGS,AM_LDFLAGS,AM_CPPFLAGS): Hoist from ./src/Makefile.am. * doc/Makefile.am: Rename to ... * doc/local.mk: Adjust paths. * lib/Makefile.am: Rename to ... * lib/local.mk: Adjust paths. * src/Makefile.am: Rename to ... * src/local.mk: Adjust paths. * tests/Makefile.am: Rename to ... * tests/local.mk: Adjust paths. * tests/init.sh: Add '/tests/' to path of sourcing 'init.cfg'. * tests/init.cfg (require_en_utf8_locale_, require_tr_utf8_locale_, require_ru_RU_koi8_r,require_unibyte_locale,require_JP_EUC_locale_): Add 'tests/' to path_prepend_ command, for 'get-mb-cur-max'. * tests/backref, tests/backref-alt, tests/backref-multibyte-slow, tests/backref-word, tests/backslash-s-and-repetition-operators, tests/backslash-s-vs-invalid-multitype, tests/big-hole, tests/big-match, tests/bogus-wctob, tests/bre, tests/c-locale, tests/case-fold-backref, tests/case-fold-backslash-w, tests/case-fold-char-class, tests/case-fold-char-range, tests/case-fold-char-type, tests/case-fold-titlecase, tests/char-class-multibyte, tests/char-class-multibyte2, tests/context-0, tests/count-newline, tests/dfa-coverage, tests/dfa-heap-overrun, tests/dfa-infloop, tests/dfaexec-multibyte, tests/empty, tests/empty-line, tests/empty-line-mb, tests/encoding-error, tests/epipe, tests/equiv-classes, tests/ere, tests/euc-mb, tests/false-match-mb-non-utf8, tests/fedora, tests/fgrep-infloop, tests/file, tests/fmbtest, tests/foad1, tests/grep-dev-null, tests/grep-dev-null-out, tests/grep-dir, tests/help-version, tests/high-bit-range, tests/in-eq-out-infloop, tests/include-exclude, tests/inconsistent-range, tests/initial-tab, tests/invalid-multibyte-infloop, tests/khadafy, tests/kwset-abuse, tests/long-line-vs-2GiB-read, tests/long-pattern-perf, tests/match-lines, tests/max-count-overread, tests/max-count-vs-context, tests/mb-dot-newline, tests/mb-non-UTF8-overrun, tests/mb-non-UTF8-performance, tests/multibyte-white-space, tests/multiple-begin-or-end-line, tests/null-byte, tests/options, tests/pcre, tests/pcre-abort, tests/pcre-context, tests/pcre-count, tests/pcre-infloop, tests/pcre-invalid-utf8-infloop, tests/pcre-invalid-utf8-input, tests/pcre-jitstack, tests/pcre-o, tests/pcre-utf8, tests/pcre-w, tests/pcre-wx-backref, tests/pcre-z, tests/posix-bracket, tests/prefix-of-multibyte, tests/proc, tests/r-dot, tests/repetition-overflow, tests/reversed-range-endpoints, tests/sjis-mb, tests/skip-device, tests/skip-read, tests/spencer1, tests/spencer1-locale, tests/spencer2, tests/status, tests/surrogate-pair, tests/symlink, tests/triple-backref, tests/turkish-I, tests/turkish-I-without-dot, tests/turkish-eyes, tests/two-chars, tests/two-files, tests/unibyte-binary, tests/unibyte-bracket-expr, tests/unibyte-negated-circumflex, tests/utf8-bracket, tests/warn-char-classes, tests/word-delim-multibyte, tests/word-multi-file, tests/word-multibyte, tests/write-error-msg, tests/yesno, tests/z-anchor-newline: Adjust paths of init.sh, path_prepend_ .
-rw-r--r--.gitignore2
-rw-r--r--Makefile.am29
-rw-r--r--bootstrap.conf4
-rw-r--r--build-aux/.gitignore1
-rw-r--r--cfg.mk1
-rw-r--r--configure.ac4
-rw-r--r--doc/local.mk (renamed from doc/Makefile.am)22
-rw-r--r--lib/local.mk (renamed from lib/Makefile.am)27
-rw-r--r--src/local.mk (renamed from src/Makefile.am)49
-rwxr-xr-xtests/backref2
-rwxr-xr-xtests/backref-alt2
-rwxr-xr-xtests/backref-multibyte-slow2
-rwxr-xr-xtests/backref-word2
-rwxr-xr-xtests/backslash-s-and-repetition-operators2
-rwxr-xr-xtests/backslash-s-vs-invalid-multitype2
-rwxr-xr-xtests/big-hole3
-rwxr-xr-xtests/big-match2
-rwxr-xr-xtests/bogus-wctob2
-rwxr-xr-xtests/bre2
-rwxr-xr-xtests/c-locale2
-rwxr-xr-xtests/case-fold-backref2
-rwxr-xr-xtests/case-fold-backslash-w2
-rwxr-xr-xtests/case-fold-char-class2
-rwxr-xr-xtests/case-fold-char-range2
-rwxr-xr-xtests/case-fold-char-type2
-rwxr-xr-xtests/case-fold-titlecase5
-rwxr-xr-xtests/char-class-multibyte2
-rwxr-xr-xtests/char-class-multibyte22
-rwxr-xr-xtests/context-02
-rwxr-xr-xtests/count-newline2
-rwxr-xr-xtests/dfa-coverage2
-rwxr-xr-xtests/dfa-heap-overrun2
-rwxr-xr-xtests/dfa-infloop2
-rwxr-xr-xtests/dfaexec-multibyte2
-rwxr-xr-xtests/empty2
-rwxr-xr-xtests/empty-line2
-rwxr-xr-xtests/empty-line-mb2
-rwxr-xr-xtests/encoding-error2
-rwxr-xr-xtests/epipe2
-rwxr-xr-xtests/equiv-classes2
-rwxr-xr-xtests/ere2
-rwxr-xr-xtests/euc-mb6
-rwxr-xr-xtests/false-match-mb-non-utf86
-rwxr-xr-xtests/fedora2
-rwxr-xr-xtests/fgrep-infloop2
-rwxr-xr-xtests/file2
-rwxr-xr-xtests/fmbtest2
-rwxr-xr-xtests/foad12
-rwxr-xr-xtests/grep-dev-null2
-rwxr-xr-xtests/grep-dev-null-out2
-rwxr-xr-xtests/grep-dir2
-rwxr-xr-xtests/help-version2
-rwxr-xr-xtests/high-bit-range2
-rwxr-xr-xtests/in-eq-out-infloop2
-rwxr-xr-xtests/include-exclude2
-rwxr-xr-xtests/inconsistent-range2
-rw-r--r--tests/init.cfg10
-rw-r--r--tests/init.sh6
-rwxr-xr-xtests/initial-tab2
-rwxr-xr-xtests/invalid-multibyte-infloop2
-rwxr-xr-xtests/khadafy2
-rwxr-xr-xtests/kwset-abuse2
-rw-r--r--tests/local.mk (renamed from tests/Makefile.am)279
-rwxr-xr-xtests/long-line-vs-2GiB-read2
-rwxr-xr-xtests/long-pattern-perf2
-rwxr-xr-xtests/match-lines2
-rwxr-xr-xtests/max-count-overread2
-rwxr-xr-xtests/max-count-vs-context2
-rwxr-xr-xtests/mb-dot-newline2
-rwxr-xr-xtests/mb-non-UTF8-overrun2
-rwxr-xr-xtests/mb-non-UTF8-performance2
-rwxr-xr-xtests/multibyte-white-space2
-rwxr-xr-xtests/multiple-begin-or-end-line2
-rwxr-xr-xtests/null-byte6
-rwxr-xr-xtests/options2
-rwxr-xr-xtests/pcre2
-rwxr-xr-xtests/pcre-abort2
-rwxr-xr-xtests/pcre-context2
-rwxr-xr-xtests/pcre-count2
-rwxr-xr-xtests/pcre-infloop2
-rwxr-xr-xtests/pcre-invalid-utf8-infloop2
-rwxr-xr-xtests/pcre-invalid-utf8-input2
-rwxr-xr-xtests/pcre-jitstack2
-rwxr-xr-xtests/pcre-o2
-rwxr-xr-xtests/pcre-utf82
-rwxr-xr-xtests/pcre-w2
-rwxr-xr-xtests/pcre-wx-backref2
-rwxr-xr-xtests/pcre-z2
-rwxr-xr-xtests/posix-bracket2
-rwxr-xr-xtests/prefix-of-multibyte2
-rwxr-xr-xtests/proc2
-rwxr-xr-xtests/r-dot2
-rwxr-xr-xtests/repetition-overflow2
-rwxr-xr-xtests/reversed-range-endpoints2
-rwxr-xr-xtests/sjis-mb6
-rwxr-xr-xtests/skip-device2
-rwxr-xr-xtests/skip-read2
-rwxr-xr-xtests/spencer12
-rwxr-xr-xtests/spencer1-locale5
-rw-r--r--tests/spencer22
-rwxr-xr-xtests/status2
-rwxr-xr-xtests/surrogate-pair2
-rwxr-xr-xtests/symlink2
-rwxr-xr-xtests/triple-backref2
-rwxr-xr-xtests/turkish-I2
-rwxr-xr-xtests/turkish-I-without-dot2
-rwxr-xr-xtests/turkish-eyes2
-rwxr-xr-xtests/two-chars2
-rwxr-xr-xtests/two-files2
-rwxr-xr-xtests/unibyte-binary2
-rwxr-xr-xtests/unibyte-bracket-expr2
-rwxr-xr-xtests/unibyte-negated-circumflex2
-rwxr-xr-xtests/utf8-bracket2
-rwxr-xr-xtests/warn-char-classes2
-rwxr-xr-xtests/word-delim-multibyte2
-rwxr-xr-xtests/word-multi-file2
-rwxr-xr-xtests/word-multibyte5
-rwxr-xr-xtests/write-error-msg2
-rwxr-xr-xtests/yesno2
-rwxr-xr-xtests/z-anchor-newline2
120 files changed, 358 insertions, 318 deletions
diff --git a/.gitignore b/.gitignore
index 372ceca..9619809 100644
--- a/.gitignore
+++ b/.gitignore
@@ -71,3 +71,5 @@ THANKS
!/lib/colorize-posix.c
!/lib/colorize-w32.c
!/lib/colorize.h
+/src/.dirstamp
+.dirstamp
diff --git a/Makefile.am b/Makefile.am
index 3a52e8f..ad06c2d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,9 +17,28 @@
#
AUTOMAKE_OPTIONS = gnu 1.12
-SUBDIRS = po lib doc src tests gnulib-tests
+SUBDIRS = po . gnulib-tests
-EXTRA_DIST = \
+# This applies to all parts: gnulib, grep, tests
+BUILT_SOURCES =
+CLEANFILES =
+EXTRA_DIST =
+MAINTAINERCLEANFILES =
+MOSTLYCLEANDIRS =
+MOSTLYCLEANFILES =
+SUFFIXES =
+#TODO: this are defined in ./src/local.mk.
+#bin_PROGRAMS =
+#bin_SCRIPTS =
+noinst_LIBRARIES =
+
+AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) $(PCRE_CFLAGS)
+# Tell the linker to omit references to unused shared libraries.
+AM_LDFLAGS = $(IGNORE_UNUSED_LIBRARIES_CFLAGS)
+
+AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib
+
+EXTRA_DIST += \
.mailmap \
ChangeLog-2009 \
dist-check.mk \
@@ -82,3 +101,9 @@ THANKS: THANKS.in Makefile.am .mailmap thanks-gen
echo; \
printf ';; %s\n' 'Local Variables:' 'coding: utf-8' End:; \
} > $@-t && chmod a-w $@-t && mv $@-t $@
+
+
+include $(top_srcdir)/lib/local.mk
+include $(top_srcdir)/src/local.mk
+include $(top_srcdir)/doc/local.mk
+include $(top_srcdir)/tests/local.mk
diff --git a/bootstrap.conf b/bootstrap.conf
index 5ee69cd..12ff39f 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -64,6 +64,7 @@ memchr
memchr2
mempcpy
minmax
+non-recursive-gnulib-prefix-hack
obstack
openat-safer
perl
@@ -137,6 +138,9 @@ bootstrap_post_import_hook ()
# Automake requires that ChangeLog exist.
touch ChangeLog || return 1
+ # Massage lib/gnulib.mk before using it later in the bootstrapping process.
+ build-aux/prefix-gnulib-mk --lib-name=$gnulib_name lib/$gnulib_mk
+
# Copy pkg-config's pkg.m4 so that our downstream users don't need to.
local ac_dir=`aclocal --print-ac-dir`
test -s "$ac_dir/dirlist" && ac_dir=$ac_dir:`tr '\n' : < "$ac_dir/dirlist"`
diff --git a/build-aux/.gitignore b/build-aux/.gitignore
index d40e457..b123ae1 100644
--- a/build-aux/.gitignore
+++ b/build-aux/.gitignore
@@ -24,3 +24,4 @@
/vc-list-files
/warn-on-use.h
/ar-lib
+/prefix-gnulib-mk
diff --git a/cfg.mk b/cfg.mk
index 43205a6..274e90d 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -28,6 +28,7 @@ url_dir_list = http://ftp.gnu.org/gnu/$(PACKAGE)
# Tests not to run as part of "make distcheck".
local-checks-to-skip = \
+ sc_cross_check_PATH_usage_in_tests \
sc_texinfo_acronym
# Tools used to bootstrap this package, used for "announcement".
diff --git a/configure.ac b/configure.ac
index 8a20317..5407237 100644
--- a/configure.ac
+++ b/configure.ac
@@ -215,11 +215,7 @@ AC_SUBST([COLORIZE_SOURCE])
AC_CONFIG_FILES([
Makefile
- lib/Makefile
- src/Makefile
- tests/Makefile
po/Makefile.in
- doc/Makefile
gnulib-tests/Makefile
])
GREP="$ac_abs_top_builddir/src/grep"
diff --git a/doc/Makefile.am b/doc/local.mk
index 048c691..83c6993 100644
--- a/doc/Makefile.am
+++ b/doc/local.mk
@@ -1,5 +1,4 @@
-# Process this file with automake to create Makefile.in
-# Makefile.am for grep/doc.
+# This Makefile snippet is included from <grep>/Makefile.am.
#
# Copyright 2008-2016 Free Software Foundation, Inc.
#
@@ -16,21 +15,24 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-info_TEXINFOS = grep.texi
-grep_TEXINFOS = fdl.texi
+info_TEXINFOS = doc/grep.texi
+doc_grep_TEXINFOS = doc/fdl.texi
-man_MANS = grep.1 fgrep.1 egrep.1
+man_MANS = doc/grep.1 doc/fgrep.1 doc/egrep.1
-EXTRA_DIST = grep.in.1
-CLEANFILES = grep.1 egrep.1 fgrep.1
+EXTRA_DIST += doc/grep.in.1
+CLEANFILES += doc/grep.1 doc/egrep.1 doc/fgrep.1
-grep.1: grep.in.1
+# TODO: verify if the 'MKDIR_P is needed.
+# with out-of-tree build, the './doc/' directory doesn't necessarily exist.
+doc/grep.1: doc/grep.in.1
+ $(MKDIR_P) doc
$(AM_V_GEN)rm -f $@-t $@
- $(AM_V_at)sed 's/@''VERSION@/$(VERSION)/' $(srcdir)/grep.in.1 > $@-t
+ $(AM_V_at)sed 's/@''VERSION@/$(VERSION)/' $(srcdir)/doc/grep.in.1 > $@-t
$(AM_V_at)chmod a=r $@-t
$(AM_V_at)mv -f $@-t $@
-egrep.1 fgrep.1: Makefile.am
+doc/egrep.1 doc/fgrep.1: $(top_srcdir)/doc/local.mk
$(AM_V_GEN)rm -f $@-t $@
$(AM_V_at)inst=`echo grep | sed '$(transform)'`.1 \
&& echo ".so man1/$$inst" > $@-t
diff --git a/lib/Makefile.am b/lib/local.mk
index a14c8b7..33b3a2a 100644
--- a/lib/Makefile.am
+++ b/lib/local.mk
@@ -14,28 +14,17 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-AM_CFLAGS =
-AM_CPPFLAGS =
-BUILT_SOURCES =
-CLEANFILES =
-EXTRA_DIST =
-MAINTAINERCLEANFILES =
-MOSTLYCLEANDIRS =
-MOSTLYCLEANFILES =
-SUFFIXES =
-noinst_LIBRARIES =
-
-include gnulib.mk
+include lib/gnulib.mk
AM_CFLAGS += $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS)
-nodist_libgreputils_a_SOURCES = colorize.c
-libgreputils_a_SOURCES += colorize.h
-EXTRA_DIST += colorize-posix.c colorize-w32.c
-CLEANFILES += colorize.c
-colorize.c:
+nodist_lib_libgreputils_a_SOURCES = lib/colorize.c
+lib_libgreputils_a_SOURCES += lib/colorize.h
+EXTRA_DIST += lib/colorize-posix.c lib/colorize-w32.c
+CLEANFILES += lib/colorize.c
+lib/colorize.c:
$(AM_V_at)echo '#include <$(COLORIZE_SOURCE)>' >$@-t
$(AM_V_at)mv $@-t $@
-libgreputils_a_LIBADD += $(LIBOBJS) $(ALLOCA)
-libgreputils_a_DEPENDENCIES += $(LIBOBJS) $(ALLOCA)
+lib_libgreputils_a_LIBADD += $(LIBOBJS) $(ALLOCA)
+lib_libgreputils_a_DEPENDENCIES += $(LIBOBJS) $(ALLOCA)
diff --git a/src/Makefile.am b/src/local.mk
index 423ded8..45f734c 100644
--- a/src/Makefile.am
+++ b/src/local.mk
@@ -16,40 +16,47 @@
LN = ln
-AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) $(PCRE_CFLAGS)
+## TODO: these moved to <grep>/Makefile.am
+## AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) $(PCRE_CFLAGS)
+##
+## # Tell the linker to omit references to unused shared libraries.
+## AM_LDFLAGS = $(IGNORE_UNUSED_LIBRARIES_CFLAGS)
-# Tell the linker to omit references to unused shared libraries.
-AM_LDFLAGS = $(IGNORE_UNUSED_LIBRARIES_CFLAGS)
+bin_PROGRAMS = src/grep
+bin_SCRIPTS = src/egrep src/fgrep
+src_grep_SOURCES = \
+ src/dfasearch.c \
+ src/die.h \
+ src/grep.c \
+ src/kwsearch.c \
+ src/kwset.c \
+ src/pcresearch.c \
+ src/searchutils.c
-bin_PROGRAMS = grep
-bin_SCRIPTS = egrep fgrep
-grep_SOURCES = \
- dfasearch.c \
- die.h \
- grep.c \
- kwsearch.c \
- kwset.c \
- pcresearch.c \
- searchutils.c
+#TODO: Ensure this works: grep must depend on gnulib
+$(src_grep_OBJECTS): $(BUILT_SOURCES)
-noinst_HEADERS = grep.h kwset.h search.h system.h
+noinst_HEADERS = src/grep.h src/kwset.h src/search.h src/system.h
# Sometimes, the expansion of $(LIBINTL) includes -lc which may
# include modules defining variables like 'optind', so libgreputils.a
# must precede $(LIBINTL) in order to ensure we use GNU getopt.
# But libgreputils.a must also follow $(LIBINTL), since libintl uses
# replacement functions defined in libgreputils.a.
+# TODO: how to apply this BEFORE 'src_grep_LDADD' but not to all other programs?
LDADD = \
- ../lib/libgreputils.a $(LIBINTL) ../lib/libgreputils.a $(LIBICONV) \
+ ./lib/libgreputils.a $(LIBINTL) ./lib/libgreputils.a $(LIBICONV) \
$(LIBTHREAD)
-grep_LDADD = $(LDADD) $(PCRE_LIBS)
+src_grep_LDADD = $(LDADD) $(PCRE_LIBS)
localedir = $(datadir)/locale
-AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib
-EXTRA_DIST = dosbuf.c egrep.sh
+##TODO: moved to <grep>/Makefile.am
+##AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib
-egrep fgrep: egrep.sh Makefile
+EXTRA_DIST += src/dosbuf.c src/egrep.sh
+
+src/egrep src/fgrep: src/egrep.sh $(top_builddir)/Makefile
$(AM_V_GEN)grep=`echo grep | sed -e '$(transform)'` && \
case $@ in egrep) option=-E;; fgrep) option=-F;; esac && \
shell_does_substrings='set x/y && d=$${1%/*} && test "$$d" = x' && \
@@ -61,8 +68,8 @@ egrep fgrep: egrep.sh Makefile
sed -e 's|[@]SHELL@|$(SHELL)|g' \
-e "$$edit_substring" \
-e "s|[@]grep@|$$grep|g" \
- -e "s|[@]option@|$$option|g" <$(srcdir)/egrep.sh >$@-t
+ -e "s|[@]option@|$$option|g" <$(srcdir)/src/egrep.sh >$@-t
$(AM_V_at)chmod +x $@-t
$(AM_V_at)mv $@-t $@
-CLEANFILES = egrep fgrep *-t
+CLEANFILES += src/egrep src/fgrep *-t
diff --git a/tests/backref b/tests/backref
index 1d15434..fb03d93 100755
--- a/tests/backref
+++ b/tests/backref
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
failures=0
diff --git a/tests/backref-alt b/tests/backref-alt
index 654b345..d07bb07 100755
--- a/tests/backref-alt
+++ b/tests/backref-alt
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
echo aa > in || framework_failure_
diff --git a/tests/backref-multibyte-slow b/tests/backref-multibyte-slow
index 9c4fe06..15a80ca 100755
--- a/tests/backref-multibyte-slow
+++ b/tests/backref-multibyte-slow
@@ -1,6 +1,6 @@
#!/bin/sh
# This was approximately quadratic up to grep-2.6.3
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
require_timeout_
diff --git a/tests/backref-word b/tests/backref-word
index e5b5486..ff67e0c 100755
--- a/tests/backref-word
+++ b/tests/backref-word
@@ -1,6 +1,6 @@
#!/bin/sh
# This would fail for grep-2.6
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
printf 'foo foo bar\n' > exp1 || framework_failure_
fail=0
diff --git a/tests/backslash-s-and-repetition-operators b/tests/backslash-s-and-repetition-operators
index 45a4b55..8cb0281 100755
--- a/tests/backslash-s-and-repetition-operators
+++ b/tests/backslash-s-and-repetition-operators
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
diff --git a/tests/backslash-s-vs-invalid-multitype b/tests/backslash-s-vs-invalid-multitype
index a77b6a5..f0c38f6 100755
--- a/tests/backslash-s-vs-invalid-multitype
+++ b/tests/backslash-s-vs-invalid-multitype
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
diff --git a/tests/big-hole b/tests/big-hole
index eac077f..1531901 100755
--- a/tests/big-hole
+++ b/tests/big-hole
@@ -1,7 +1,8 @@
#!/bin/sh
# Check that grep --binary-file=without-match quickly skips files with holes.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+
expensive_
diff --git a/tests/big-match b/tests/big-match
index 0da9731..e765276 100755
--- a/tests/big-match
+++ b/tests/big-match
@@ -1,7 +1,7 @@
#!/bin/sh
# Check that grep doesn't mishandle long matching lines.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
expensive_
# Create a one-line file containing slightly more than 2 GiB.
diff --git a/tests/bogus-wctob b/tests/bogus-wctob
index 6be6c39..d4bf3d0 100755
--- a/tests/bogus-wctob
+++ b/tests/bogus-wctob
@@ -2,7 +2,7 @@
# This was latent in grep-2.8 and earlier because we punted interpretation
# of MBCSETs to glibc. However, it becomes apparent as soon as "[à]" is
# simplified to "à".
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
printf '\340' > in || framework_failure_
fail=0
diff --git a/tests/bre b/tests/bre
index 324d198..c0ff96f 100755
--- a/tests/bre
+++ b/tests/bre
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
diff --git a/tests/c-locale b/tests/c-locale
index 1fe5c70..d32eb5c 100755
--- a/tests/c-locale
+++ b/tests/c-locale
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
diff --git a/tests/case-fold-backref b/tests/case-fold-backref
index b96b481..5e42621 100755
--- a/tests/case-fold-backref
+++ b/tests/case-fold-backref
@@ -1,6 +1,6 @@
#!/bin/sh
# This would fail for grep-2.5.3
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
printf '%s foo\n' foo fOo Foo FOO > exp1 || framework_failure_
fail=0
diff --git a/tests/case-fold-backslash-w b/tests/case-fold-backslash-w
index 57ff0f5..dbed133 100755
--- a/tests/case-fold-backslash-w
+++ b/tests/case-fold-backslash-w
@@ -1,7 +1,7 @@
#!/bin/sh
# test that \W works on case-insensitive matches. It used to become \w.
# Derived from https://savannah.gnu.org/bugs/?28162
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
if echo foo bar | LANG=C.ASCII grep '^foo\W'; then
echo foo bar | LANG=C.ASCII grep -i '^foo\W' || fail_ ASCII insensitive
diff --git a/tests/case-fold-char-class b/tests/case-fold-char-class
index ac8f3ee..7202f45 100755
--- a/tests/case-fold-char-class
+++ b/tests/case-fold-char-class
@@ -1,6 +1,6 @@
#!/bin/sh
# This would fail for grep-2.5.3
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
printf 'Y\n' > exp1 || framework_failure_
fail=0
diff --git a/tests/case-fold-char-range b/tests/case-fold-char-range
index 4203024..0fb9f10 100755
--- a/tests/case-fold-char-range
+++ b/tests/case-fold-char-range
@@ -1,6 +1,6 @@
#!/bin/sh
# This would fail for grep-2.5.3
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
printf 'A\nZ\n' > exp1 || framework_failure_
fail=0
diff --git a/tests/case-fold-char-type b/tests/case-fold-char-type
index d5fd67c..6d6da52 100755
--- a/tests/case-fold-char-type
+++ b/tests/case-fold-char-type
@@ -1,6 +1,6 @@
#!/bin/sh
# This would fail for grep-2.5.3
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
printf 'Y\n' > exp1 || framework_failure_
fail=0
diff --git a/tests/case-fold-titlecase b/tests/case-fold-titlecase
index 57a4613..78e65a0 100755
--- a/tests/case-fold-titlecase
+++ b/tests/case-fold-titlecase
@@ -16,7 +16,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+
+# Add "./tests" to PATH for the use of get-mb-cur-max.
+path_prepend_ ./tests
require_en_utf8_locale_
require_compiled_in_MB_support
diff --git a/tests/char-class-multibyte b/tests/char-class-multibyte
index b957518..366249c 100755
--- a/tests/char-class-multibyte
+++ b/tests/char-class-multibyte
@@ -1,6 +1,6 @@
#!/bin/sh
# This would segfault for grep-2.6
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
require_compiled_in_MB_support
diff --git a/tests/char-class-multibyte2 b/tests/char-class-multibyte2
index 6cdada5..bbc4487 100755
--- a/tests/char-class-multibyte2
+++ b/tests/char-class-multibyte2
@@ -1,6 +1,6 @@
#!/bin/sh
# This test would segfault for grep-2.14
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
require_compiled_in_MB_support
diff --git a/tests/context-0 b/tests/context-0
index 4b63305..5c222ce 100755
--- a/tests/context-0
+++ b/tests/context-0
@@ -1,6 +1,6 @@
#!/bin/sh
# 0 lines of context
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
cat <<EOF > in || framework_failure_
needle
diff --git a/tests/count-newline b/tests/count-newline
index b37b8ec..c395904 100755
--- a/tests/count-newline
+++ b/tests/count-newline
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
printf '%1024d\nb\n' 0 >in || framework_failure_
diff --git a/tests/dfa-coverage b/tests/dfa-coverage
index ca8654f..b47e457 100755
--- a/tests/dfa-coverage
+++ b/tests/dfa-coverage
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
require_compiled_in_MB_support
diff --git a/tests/dfa-heap-overrun b/tests/dfa-heap-overrun
index c8bb185..b62baa1 100755
--- a/tests/dfa-heap-overrun
+++ b/tests/dfa-heap-overrun
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
diff --git a/tests/dfa-infloop b/tests/dfa-infloop
index e35eef5..39d93fd 100755
--- a/tests/dfa-infloop
+++ b/tests/dfa-infloop
@@ -1,6 +1,6 @@
#!/bin/sh
# This would infloop for some unreleased versions between 2.26 and 2.27
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_timeout_
diff --git a/tests/dfaexec-multibyte b/tests/dfaexec-multibyte
index baac9ba..8c05db2 100755
--- a/tests/dfaexec-multibyte
+++ b/tests/dfaexec-multibyte
@@ -1,6 +1,6 @@
#!/bin/sh
# This would fail for grep-2.5.3
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
printf 'aa\nab\nba\nbb\n' > exp1 || framework_failure_
printf '1 2 3\n' > exp2 || framework_failure_
diff --git a/tests/empty b/tests/empty
index 2b5ecf2..f5b2dff 100755
--- a/tests/empty
+++ b/tests/empty
@@ -8,7 +8,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_timeout_
diff --git a/tests/empty-line b/tests/empty-line
index 25e9509..6696926 100755
--- a/tests/empty-line
+++ b/tests/empty-line
@@ -2,7 +2,7 @@
# Test that the empty pattern matches everything.
# Some of these tests failed in grep 2.18.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
printf 'abc\n' >in || framework_failure_
diff --git a/tests/empty-line-mb b/tests/empty-line-mb
index 605ecf9..e8492e8 100755
--- a/tests/empty-line-mb
+++ b/tests/empty-line-mb
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
diff --git a/tests/encoding-error b/tests/encoding-error
index 5f5a09d..5dd1cf8 100755
--- a/tests/encoding-error
+++ b/tests/encoding-error
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
diff --git a/tests/epipe b/tests/epipe
index 3b568e3..7f83ff6 100755
--- a/tests/epipe
+++ b/tests/epipe
@@ -2,7 +2,7 @@
# Check that a write failure with errno == EPIPE
# doesn't cause grep to issue multiple "write error" diagnostics.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
if
# Use awk to output a bounded amount of data to the grep in question,
diff --git a/tests/equiv-classes b/tests/equiv-classes
index 940efa4..52de797 100755
--- a/tests/equiv-classes
+++ b/tests/equiv-classes
@@ -1,7 +1,7 @@
#!/bin/sh
# Test that equivalence classes work.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
require_compiled_in_MB_support
diff --git a/tests/ere b/tests/ere
index 68d1533..1bd3243 100755
--- a/tests/ere
+++ b/tests/ere
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
diff --git a/tests/euc-mb b/tests/euc-mb
index c639374..863b145 100755
--- a/tests/euc-mb
+++ b/tests/euc-mb
@@ -2,10 +2,10 @@
# test that matches starting in the middle of a multibyte char aren't rejected
# too greedily.
# Derived from https://savannah.gnu.org/bugs/?23814
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-# Add "." to PATH for the use of get-mb-cur-max.
-path_prepend_ .
+# Add "./tests" to PATH for the use of get-mb-cur-max.
+path_prepend_ ./tests
require_compiled_in_MB_support
diff --git a/tests/false-match-mb-non-utf8 b/tests/false-match-mb-non-utf8
index c772793..a43e6d7 100755
--- a/tests/false-match-mb-non-utf8
+++ b/tests/false-match-mb-non-utf8
@@ -7,10 +7,10 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-# Add "." to PATH for the use of get-mb-cur-max.
-path_prepend_ .
+# Add "./tests" to PATH for the use of get-mb-cur-max.
+path_prepend_ ./tests
fail=0
diff --git a/tests/fedora b/tests/fedora
index 43650f3..e1da346 100755
--- a/tests/fedora
+++ b/tests/fedora
@@ -1,6 +1,6 @@
#!/bin/sh
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
# GREP Regression test suite for Fedora bugs and fixes
# (c) 2008 Lubomir Rintel
diff --git a/tests/fgrep-infloop b/tests/fgrep-infloop
index 015ec74..ce2d4e9 100755
--- a/tests/fgrep-infloop
+++ b/tests/fgrep-infloop
@@ -1,6 +1,6 @@
#!/bin/sh
# This would infloop for grep-2.6.1
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
require_timeout_
diff --git a/tests/file b/tests/file
index 11de7e4..ba598b8 100755
--- a/tests/file
+++ b/tests/file
@@ -10,7 +10,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
diff --git a/tests/fmbtest b/tests/fmbtest
index 14fb9d3..d3be306 100755
--- a/tests/fmbtest
+++ b/tests/fmbtest
@@ -5,7 +5,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
cz=cs_CZ.UTF-8
diff --git a/tests/foad1 b/tests/foad1
index 9417381..c4f2bb3 100755
--- a/tests/foad1
+++ b/tests/foad1
@@ -9,7 +9,7 @@
#
# This set of tests was started by Julian Foad.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
failures=0
diff --git a/tests/grep-dev-null b/tests/grep-dev-null
index 49a9385..4e2b820 100755
--- a/tests/grep-dev-null
+++ b/tests/grep-dev-null
@@ -1,6 +1,6 @@
#!/bin/sh
# Case-insensitive grep with a 0-size input file would fail in grep up to 2.6.3
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
diff --git a/tests/grep-dev-null-out b/tests/grep-dev-null-out
index 13a4843..a628020 100755
--- a/tests/grep-dev-null-out
+++ b/tests/grep-dev-null-out
@@ -1,7 +1,7 @@
#!/bin/sh
# Outputting to /dev/null.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_timeout_
diff --git a/tests/grep-dir b/tests/grep-dir
index 4947512..5fba30f 100755
--- a/tests/grep-dir
+++ b/tests/grep-dir
@@ -1,6 +1,6 @@
#!/bin/sh
# Case-insensitive grep with a 0-size input file would fail in grep up to 2.6.3
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
mkdir a || framework_failure
diff --git a/tests/help-version b/tests/help-version
index 9d9b147..dcebe63 100755
--- a/tests/help-version
+++ b/tests/help-version
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
# Terminate any background processes
cleanup_() { kill $pid 2>/dev/null && wait $pid; }
diff --git a/tests/high-bit-range b/tests/high-bit-range
index e414c93..7450342 100755
--- a/tests/high-bit-range
+++ b/tests/high-bit-range
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
diff --git a/tests/in-eq-out-infloop b/tests/in-eq-out-infloop
index 1742825..7a87167 100755
--- a/tests/in-eq-out-infloop
+++ b/tests/in-eq-out-infloop
@@ -1,6 +1,6 @@
#!/bin/sh
# Demonstrate the disk-filling infloop when redirecting to an input file.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_timeout_
# Use an input file large enough that the problem is reproducible in spite
diff --git a/tests/include-exclude b/tests/include-exclude
index c3d22a1..ee45876 100755
--- a/tests/include-exclude
+++ b/tests/include-exclude
@@ -1,6 +1,6 @@
#!/bin/sh
# Use of any --include or --exclude* option would segfault in 2.6 and 2.6.1
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
mkdir -p x/dir || framework_failure_
echo aaa > x/a || framework_failure_
diff --git a/tests/inconsistent-range b/tests/inconsistent-range
index e28acde..b56957f 100755
--- a/tests/inconsistent-range
+++ b/tests/inconsistent-range
@@ -1,6 +1,6 @@
#!/bin/sh
# This would fail for grep-2.6
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
printf '00a\n00g\n00z\n00A\n00G\n00Z\n' > in || framework_failure_
diff --git a/tests/init.cfg b/tests/init.cfg
index 1677ec5..b5e8f59 100644
--- a/tests/init.cfg
+++ b/tests/init.cfg
@@ -58,7 +58,7 @@ require_pcre_()
# If the locale is not available, just skip the test.
require_en_utf8_locale_()
{
- path_prepend_ .
+ path_prepend_ ./tests
case $(get-mb-cur-max en_US.UTF-8) in
[3456]) ;;
*) skip_ 'en_US.UTF-8 locale not found' ;;
@@ -67,7 +67,7 @@ require_en_utf8_locale_()
require_tr_utf8_locale_()
{
- path_prepend_ .
+ path_prepend_ ./tests
case $(get-mb-cur-max tr_TR.UTF-8) in
[3456]) ;;
*) skip_ 'tr_TR.UTF-8 locale not found' ;;
@@ -76,7 +76,7 @@ require_tr_utf8_locale_()
require_ru_RU_koi8_r()
{
- path_prepend_ .
+ path_prepend_ ./tests
case $(get-mb-cur-max ru_RU.KOI8-R) in
1) ;;
*) skip_ 'ru_RU.KOI8-R locale not found' ;;
@@ -92,7 +92,7 @@ require_compiled_in_MB_support()
require_unibyte_locale()
{
- path_prepend_ .
+ path_prepend_ ./tests
for loc in C en_US; do
for encoding in '' .iso88591 .iso885915 .ISO8859-1 .ISO8859-15; do
locale=$loc$encoding
@@ -124,7 +124,7 @@ require_hi_res_time_()
require_JP_EUC_locale_()
{
local locale=ja_JP.eucJP
- path_prepend_ .
+ path_prepend_ ./tests
case $(get-mb-cur-max $locale) in
[23])
LC_ALL=$locale &&
diff --git a/tests/init.sh b/tests/init.sh
index ee08022..f3df324 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -28,7 +28,7 @@
# Note that the "path_prepend_ ." is useful only if the body of your
# test invokes programs residing in the initial directory.
# For example, if the programs you want to test are in src/, and this test
-# script is named tests/test-1, then you would use "path_prepend_ ../src",
+# script is named test-1, then you would use "path_prepend_ ../src",
# or perhaps export PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH"
# to all tests via automake's TESTS_ENVIRONMENT.
# Set the exit code 0 for success, 77 for skipped, or 1 or other for failure.
@@ -604,8 +604,8 @@ mktempd_ ()
# If you want to override the testdir_prefix_ function,
# or to add more utility functions, use this file.
-test -f "$srcdir/init.cfg" \
- && . "$srcdir/init.cfg"
+test -f "$srcdir/tests/init.cfg" \
+ && . "$srcdir/tests/init.cfg"
setup_ "$@"
# This trap is here, rather than in the setup_ function, because some
diff --git a/tests/initial-tab b/tests/initial-tab
index 8b3cb8c..47a4be2 100755
--- a/tests/initial-tab
+++ b/tests/initial-tab
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
diff --git a/tests/invalid-multibyte-infloop b/tests/invalid-multibyte-infloop
index 5b3bdfc..e61a5c2 100755
--- a/tests/invalid-multibyte-infloop
+++ b/tests/invalid-multibyte-infloop
@@ -1,7 +1,7 @@
#!/bin/sh
# Ensure that we don't trigger a grep -F infloop.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
require_compiled_in_MB_support
diff --git a/tests/khadafy b/tests/khadafy
index 73ee1c7..6a30f2d 100755
--- a/tests/khadafy
+++ b/tests/khadafy
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
diff --git a/tests/kwset-abuse b/tests/kwset-abuse
index a8680f8..df43d4e 100755
--- a/tests/kwset-abuse
+++ b/tests/kwset-abuse
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
diff --git a/tests/Makefile.am b/tests/local.mk
index 52e2b9e..2112ed5 100644
--- a/tests/Makefile.am
+++ b/tests/local.mk
@@ -19,11 +19,11 @@ TEST_EXTENSIONS = .sh .pl
if HAVE_PERL
TESTSUITE_PERL = $(PERL)
else
-TESTSUITE_PERL = $(SHELL) $(srcdir)/no-perl
+TESTSUITE_PERL = $(SHELL) $(tcp_srcdir)/tests/no-perl
endif
# Options passed to the perl invocations running the perl test scripts.
-TESTSUITE_PERL_OPTIONS = -w -I$(srcdir) -MCoreutils -MCuSkip
+TESTSUITE_PERL_OPTIONS = -w -I$(top_srcdir)/tests -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
@@ -34,161 +34,166 @@ 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 \
+check_PROGRAMS = tests/get-mb-cur-max
+
+## TODO: how to cleanly apply these only to $(check_PROGRAMS) ?
+## with recursive makefiles, these were global AM_CPPFLAGS/AM_CFLAGS,
+## but only affected test programs in this directory.
+tests_get_mb_cur_max_AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib \
-I$(top_srcdir)/src
-AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
+tests_get_mb_cur_max_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
+tests_get_mb_cur_max_LDFLAGS = $(IGNORE_UNUSED_LIBRARIES_CFLAGS)
+tests_get_mb_cur_max_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
+XFAIL_TESTS = 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
+XFAIL_TESTS += tests/equiv-classes
else
# The backslash-alt test fails for glibc, which needs to be fixed.
# FIXME-2015: Remove this once the glibc bug is fixed.
-XFAIL_TESTS += backref-alt
+XFAIL_TESTS += tests/backref-alt
endif
TESTS = \
- backref \
- backref-alt \
- backref-multibyte-slow \
- backref-word \
- backslash-s-and-repetition-operators \
- backslash-s-vs-invalid-multitype \
- big-hole \
- big-match \
- 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 \
- dfaexec-multibyte \
- empty \
- empty-line \
- empty-line-mb \
- encoding-error \
- epipe \
- equiv-classes \
- ere \
- euc-mb \
- false-match-mb-non-utf8 \
- fedora \
- fgrep-infloop \
- file \
- filename-lineno.pl \
- fmbtest \
- foad1 \
- grep-dev-null \
- grep-dev-null-out \
- grep-dir \
- 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 \
- match-lines \
- max-count-overread \
- max-count-vs-context \
- mb-dot-newline \
- mb-non-UTF8-overrun \
- mb-non-UTF8-performance \
- 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 \
- 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
+ tests/backref \
+ tests/backref-alt \
+ tests/backref-multibyte-slow \
+ tests/backref-word \
+ tests/backslash-s-and-repetition-operators \
+ tests/backslash-s-vs-invalid-multitype \
+ tests/big-hole \
+ tests/big-match \
+ tests/bogus-wctob \
+ tests/bre \
+ tests/c-locale \
+ tests/case-fold-backref \
+ tests/case-fold-backslash-w \
+ tests/case-fold-char-class \
+ tests/case-fold-char-range \
+ tests/case-fold-char-type \
+ tests/case-fold-titlecase \
+ tests/char-class-multibyte \
+ tests/char-class-multibyte2 \
+ tests/context-0 \
+ tests/count-newline \
+ tests/dfa-coverage \
+ tests/dfa-heap-overrun \
+ tests/dfa-infloop \
+ tests/dfaexec-multibyte \
+ tests/empty \
+ tests/empty-line \
+ tests/empty-line-mb \
+ tests/encoding-error \
+ tests/epipe \
+ tests/equiv-classes \
+ tests/ere \
+ tests/euc-mb \
+ tests/false-match-mb-non-utf8 \
+ tests/fedora \
+ tests/fgrep-infloop \
+ tests/file \
+ tests/filename-lineno.pl \
+ tests/fmbtest \
+ tests/foad1 \
+ tests/grep-dev-null \
+ tests/grep-dev-null-out \
+ tests/grep-dir \
+ tests/help-version \
+ tests/high-bit-range \
+ tests/in-eq-out-infloop \
+ tests/include-exclude \
+ tests/inconsistent-range \
+ tests/initial-tab \
+ tests/invalid-multibyte-infloop \
+ tests/khadafy \
+ tests/kwset-abuse \
+ tests/long-line-vs-2GiB-read \
+ tests/long-pattern-perf \
+ tests/match-lines \
+ tests/max-count-overread \
+ tests/max-count-vs-context \
+ tests/mb-dot-newline \
+ tests/mb-non-UTF8-overrun \
+ tests/mb-non-UTF8-performance \
+ tests/multibyte-white-space \
+ tests/multiple-begin-or-end-line \
+ tests/null-byte \
+ tests/options \
+ tests/pcre \
+ tests/pcre-abort \
+ tests/pcre-context \
+ tests/pcre-count \
+ tests/pcre-infloop \
+ tests/pcre-invalid-utf8-infloop \
+ tests/pcre-invalid-utf8-input \
+ tests/pcre-jitstack \
+ tests/pcre-o \
+ tests/pcre-utf8 \
+ tests/pcre-w \
+ tests/pcre-wx-backref \
+ tests/pcre-z \
+ tests/posix-bracket \
+ tests/prefix-of-multibyte \
+ tests/proc \
+ tests/r-dot \
+ tests/repetition-overflow \
+ tests/reversed-range-endpoints \
+ tests/sjis-mb \
+ tests/skip-device \
+ tests/skip-read \
+ tests/spencer1 \
+ tests/spencer1-locale \
+ tests/status \
+ tests/surrogate-pair \
+ tests/symlink \
+ tests/triple-backref \
+ tests/turkish-I \
+ tests/turkish-I-without-dot \
+ tests/turkish-eyes \
+ tests/two-chars \
+ tests/two-files \
+ tests/unibyte-binary \
+ tests/unibyte-bracket-expr \
+ tests/unibyte-negated-circumflex \
+ tests/utf8-bracket \
+ tests/warn-char-classes \
+ tests/word-delim-multibyte \
+ tests/word-multi-file \
+ tests/word-multibyte \
+ tests/write-error-msg \
+ tests/yesno \
+ tests/z-anchor-newline
-EXTRA_DIST = \
+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
+ tests/bre.awk \
+ tests/bre.tests \
+ tests/Coreutils.pm \
+ tests/CuSkip.pm \
+ tests/CuTmpdir.pm \
+ tests/envvar-check \
+ tests/ere.awk \
+ tests/ere.tests \
+ tests/init.cfg \
+ tests/init.sh \
+ tests/khadafy.lines \
+ tests/khadafy.regexp \
+ tests/no-perl \
+ tests/spencer1.awk \
+ tests/spencer1.tests \
+ tests/spencer1-locale.awk
# Default to a nonzero value. Environment overrides.
# http://udrepper.livejournal.com/11429.html
@@ -197,7 +202,7 @@ MALLOC_PERTURB_ = 1
TESTS_ENVIRONMENT = \
tmp__=$${TMPDIR-/tmp}; \
test -d "$$tmp__" && test -w "$$tmp__" || tmp__=.; \
- . $(srcdir)/envvar-check; \
+ . $(srcdir)/tests/envvar-check; \
TMPDIR=$$tmp__; export TMPDIR; \
\
if test -n "$$BASH_VERSION" || (eval "export v=x") 2>/dev/null; then \
@@ -254,7 +259,7 @@ VERBOSE = yes
check: check_executable_TESTS
.PHONY: check_executable_TESTS
-check_executable_TESTS: Makefile
+check_executable_TESTS: $(top_builddir)/Makefile
$(AM_V_GEN)fail=0; \
cd $(srcdir) && for i in $(TESTS); do \
test -x $$i || { fail=1; echo $$i >&2; }; \
diff --git a/tests/long-line-vs-2GiB-read b/tests/long-line-vs-2GiB-read
index 29d29ec..162141e 100755
--- a/tests/long-line-vs-2GiB-read
+++ b/tests/long-line-vs-2GiB-read
@@ -4,7 +4,7 @@
# an "Invalid argument" (EINVAL) failure from the read syscall on
# systems like OS/X 10.8.5.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
# Searching 2GiB takes a while.
expensive_
diff --git a/tests/long-pattern-perf b/tests/long-pattern-perf
index 0a02e6f..9091682 100755
--- a/tests/long-pattern-perf
+++ b/tests/long-pattern-perf
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
diff --git a/tests/match-lines b/tests/match-lines
index 7e1f291..854c78d 100755
--- a/tests/match-lines
+++ b/tests/match-lines
@@ -18,7 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
printf 'a\n' > in || framework_failure_
diff --git a/tests/max-count-overread b/tests/max-count-overread
index 23c45cb..f8c775c 100755
--- a/tests/max-count-overread
+++ b/tests/max-count-overread
@@ -2,7 +2,7 @@
# Ensure that -m1 stops reading after the first match.
# In grep-2.19, yes x|grep -m1 x would infloop.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_timeout_
fail=0
diff --git a/tests/max-count-vs-context b/tests/max-count-vs-context
index 5633dd6..4524471 100755
--- a/tests/max-count-vs-context
+++ b/tests/max-count-vs-context
@@ -1,6 +1,6 @@
#!/bin/sh
# Show how -m1 works with -A N when a 2nd match is < N lines after the first
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
cat <<EOF > in || framework_failure_
needle
diff --git a/tests/mb-dot-newline b/tests/mb-dot-newline
index 9e3db15..e2aae1c 100755
--- a/tests/mb-dot-newline
+++ b/tests/mb-dot-newline
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
printf 'a\naa\n' > in || framework_failure_
printf 'aa\n' > exp || framework_failure_
diff --git a/tests/mb-non-UTF8-overrun b/tests/mb-non-UTF8-overrun
index 7743029..19b981f 100755
--- a/tests/mb-non-UTF8-overrun
+++ b/tests/mb-non-UTF8-overrun
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_JP_EUC_locale_
fail=0
diff --git a/tests/mb-non-UTF8-performance b/tests/mb-non-UTF8-performance
index 11d0cf7..8b41b10 100755
--- a/tests/mb-non-UTF8-performance
+++ b/tests/mb-non-UTF8-performance
@@ -18,7 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
diff --git a/tests/multibyte-white-space b/tests/multibyte-white-space
index 7c0d0b7..4c5df1f 100755
--- a/tests/multibyte-white-space
+++ b/tests/multibyte-white-space
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
diff --git a/tests/multiple-begin-or-end-line b/tests/multiple-begin-or-end-line
index ec6da30..26d66e3 100755
--- a/tests/multiple-begin-or-end-line
+++ b/tests/multiple-begin-or-end-line
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
echo aa | grep 'a\(b$\|c$\)' >out && fail=1
compare /dev/null out || fail=1
diff --git a/tests/null-byte b/tests/null-byte
index f9bb00e..65d18ce 100755
--- a/tests/null-byte
+++ b/tests/null-byte
@@ -16,10 +16,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-# Add "." to PATH for the use of get-mb-cur-max.
-path_prepend_ .
+# Add "./tests" to PATH for the use of get-mb-cur-max.
+path_prepend_ ./tests
locales=C
for locale in en_US.iso885915 en_US.UTF-8; do
diff --git a/tests/options b/tests/options
index 97d2a03..d29658d 100755
--- a/tests/options
+++ b/tests/options
@@ -13,7 +13,7 @@
# -f pattern_file ... [file ...]
# grep [ -E| -F][ -c| -l| -q ][-insvx] pattern_list [file...]
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
diff --git a/tests/pcre b/tests/pcre
index a290099..fb50b75 100755
--- a/tests/pcre
+++ b/tests/pcre
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_pcre_
fail=0
diff --git a/tests/pcre-abort b/tests/pcre-abort
index 83c90e4..fb2485f 100755
--- a/tests/pcre-abort
+++ b/tests/pcre-abort
@@ -8,7 +8,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_pcre_
fail=0
diff --git a/tests/pcre-context b/tests/pcre-context
index b910a20..e36c18a 100755
--- a/tests/pcre-context
+++ b/tests/pcre-context
@@ -1,6 +1,6 @@
#!/bin/sh
# Test Perl regex with context
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_pcre_
cat >in <<'EOF'
diff --git a/tests/pcre-count b/tests/pcre-count
index e638635..35c105e 100755
--- a/tests/pcre-count
+++ b/tests/pcre-count
@@ -8,7 +8,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_pcre_
fail=0
diff --git a/tests/pcre-infloop b/tests/pcre-infloop
index fe97353..3124097 100755
--- a/tests/pcre-infloop
+++ b/tests/pcre-infloop
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_timeout_
require_en_utf8_locale_
require_compiled_in_MB_support
diff --git a/tests/pcre-invalid-utf8-infloop b/tests/pcre-invalid-utf8-infloop
index e0503bc..dba6662 100755
--- a/tests/pcre-invalid-utf8-infloop
+++ b/tests/pcre-invalid-utf8-infloop
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_timeout_
require_en_utf8_locale_
require_compiled_in_MB_support
diff --git a/tests/pcre-invalid-utf8-input b/tests/pcre-invalid-utf8-input
index 17c1d4e..8ee4d5a 100755
--- a/tests/pcre-invalid-utf8-input
+++ b/tests/pcre-invalid-utf8-input
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_timeout_
require_en_utf8_locale_
require_compiled_in_MB_support
diff --git a/tests/pcre-jitstack b/tests/pcre-jitstack
index 5bdb5a8..581f680 100755
--- a/tests/pcre-jitstack
+++ b/tests/pcre-jitstack
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_pcre_
for p in 'base64 -d' 'base64 -D' 'openssl base64 -d' \
diff --git a/tests/pcre-o b/tests/pcre-o
index 7c46f27..5c9ea0b 100755
--- a/tests/pcre-o
+++ b/tests/pcre-o
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_pcre_
fail=0
diff --git a/tests/pcre-utf8 b/tests/pcre-utf8
index a29b412..985bf8a 100755
--- a/tests/pcre-utf8
+++ b/tests/pcre-utf8
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
LC_ALL=en_US.UTF-8 require_pcre_
diff --git a/tests/pcre-w b/tests/pcre-w
index 2c91e90..f66cd30 100755
--- a/tests/pcre-w
+++ b/tests/pcre-w
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_pcre_
fail=0
diff --git a/tests/pcre-wx-backref b/tests/pcre-wx-backref
index 907c858..1ef708a 100755
--- a/tests/pcre-wx-backref
+++ b/tests/pcre-wx-backref
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_pcre_
echo aa > in || framework_failure_
diff --git a/tests/pcre-z b/tests/pcre-z
index 4ce9a93..80d844a 100755
--- a/tests/pcre-z
+++ b/tests/pcre-z
@@ -1,6 +1,6 @@
#!/bin/sh
# Test Perl regex with NUL-separated input
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_pcre_
require_en_utf8_locale_
diff --git a/tests/posix-bracket b/tests/posix-bracket
index bca4303..679e39a 100755
--- a/tests/posix-bracket
+++ b/tests/posix-bracket
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
LC_ALL=C
export LC_ALL
diff --git a/tests/prefix-of-multibyte b/tests/prefix-of-multibyte
index 2228a22..e13aa25 100755
--- a/tests/prefix-of-multibyte
+++ b/tests/prefix-of-multibyte
@@ -1,6 +1,6 @@
#!/bin/sh
# This would mistakenly print a line prior to grep-2.18.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
require_compiled_in_MB_support
diff --git a/tests/proc b/tests/proc
index aeb4a50..34232de 100755
--- a/tests/proc
+++ b/tests/proc
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
diff --git a/tests/r-dot b/tests/r-dot
index 29aedad..c69fc03 100755
--- a/tests/r-dot
+++ b/tests/r-dot
@@ -1,6 +1,6 @@
#!/bin/sh
# Check that "grep -r PAT" reads ".".
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
mkdir dir || framework_failure_
echo aaa > dir/a || framework_failure_
diff --git a/tests/repetition-overflow b/tests/repetition-overflow
index 38a652d..fe7e650 100755
--- a/tests/repetition-overflow
+++ b/tests/repetition-overflow
@@ -1,6 +1,6 @@
#!/bin/sh
# These would fail (i.e., match erroneously) prior to grep-2.11.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
xp1=4294967297 # 2^32+1
xp2=4294967298 # 2^32+2
diff --git a/tests/reversed-range-endpoints b/tests/reversed-range-endpoints
index 0737447..915def6 100755
--- a/tests/reversed-range-endpoints
+++ b/tests/reversed-range-endpoints
@@ -1,6 +1,6 @@
#!/bin/sh
# Ensure that an invalid range like [b-a] evokes exit status of 2.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
diff --git a/tests/sjis-mb b/tests/sjis-mb
index abe2c0c..c9e452b 100755
--- a/tests/sjis-mb
+++ b/tests/sjis-mb
@@ -3,10 +3,10 @@
# in this encoding, an ASCII character is both a valid single-byte
# character, and a suffix of a valid double-byte character
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-# Add "." to PATH for the use of get-mb-cur-max.
-path_prepend_ .
+# Add "./tests" to PATH for the use of get-mb-cur-max.
+path_prepend_ ./tests
require_compiled_in_MB_support
require_timeout_
diff --git a/tests/skip-device b/tests/skip-device
index d6368f1..a920e8e 100755
--- a/tests/skip-device
+++ b/tests/skip-device
@@ -2,7 +2,7 @@
# grep must ignore --devices=ACTION (-D) when reading stdin
# For grep-2.11, this test would fail.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
# Test both with no file argument, and with "-".
echo foo | grep -D skip foo - || fail=1
diff --git a/tests/skip-read b/tests/skip-read
index 1eef87e..e03237c 100755
--- a/tests/skip-read
+++ b/tests/skip-read
@@ -1,7 +1,7 @@
#!/bin/sh
# Check that grep skips reading in some cases.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
diff --git a/tests/spencer1 b/tests/spencer1
index 65503d3..138bd75 100755
--- a/tests/spencer1
+++ b/tests/spencer1
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
diff --git a/tests/spencer1-locale b/tests/spencer1-locale
index 3f202d8..8c61518 100755
--- a/tests/spencer1-locale
+++ b/tests/spencer1-locale
@@ -8,14 +8,15 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
# . . . and the following by Henry Spencer.
${AWK-awk} -v extra_locale=$LOCALE_FR_UTF8 \
- -f "$abs_srcdir/spencer1-locale.awk" "$abs_srcdir/spencer1.tests" \
+ -f "$abs_srcdir/tests/spencer1-locale.awk" \
+ "$abs_srcdir/tests/spencer1.tests" \
> spencer1-locale.script || fail=1
${re_shell-${SHELL-sh}} spencer1-locale.script || fail=1
diff --git a/tests/spencer2 b/tests/spencer2
index c31a393..f43472b 100644
--- a/tests/spencer2
+++ b/tests/spencer2
@@ -8,7 +8,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
diff --git a/tests/status b/tests/status
index 37703be..ff072e0 100755
--- a/tests/status
+++ b/tests/status
@@ -11,7 +11,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
diff --git a/tests/surrogate-pair b/tests/surrogate-pair
index 38a2a55..470c5f5 100755
--- a/tests/surrogate-pair
+++ b/tests/surrogate-pair
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
require_compiled_in_MB_support
diff --git a/tests/symlink b/tests/symlink
index a915bbe..ad0fd83 100755
--- a/tests/symlink
+++ b/tests/symlink
@@ -18,7 +18,7 @@
# written by Paul Eggert
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
mkdir dir || framework_failure_
echo a > dir/a || framework_failure_
diff --git a/tests/triple-backref b/tests/triple-backref
index 3d36c05..3151d50 100755
--- a/tests/triple-backref
+++ b/tests/triple-backref
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
echo a > in || framework_failure_
diff --git a/tests/turkish-I b/tests/turkish-I
index 43becea..e457e57 100755
--- a/tests/turkish-I
+++ b/tests/turkish-I
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
require_compiled_in_MB_support
diff --git a/tests/turkish-I-without-dot b/tests/turkish-I-without-dot
index 69215de..c625629 100755
--- a/tests/turkish-I-without-dot
+++ b/tests/turkish-I-without-dot
@@ -18,7 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_tr_utf8_locale_
require_compiled_in_MB_support
diff --git a/tests/turkish-eyes b/tests/turkish-eyes
index b57df8e..e323602 100755
--- a/tests/turkish-eyes
+++ b/tests/turkish-eyes
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_compiled_in_MB_support
diff --git a/tests/two-chars b/tests/two-chars
index 7ce7216..653f942 100755
--- a/tests/two-chars
+++ b/tests/two-chars
@@ -7,7 +7,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
diff --git a/tests/two-files b/tests/two-files
index 1b52e3f..3ed8d58 100755
--- a/tests/two-files
+++ b/tests/two-files
@@ -8,7 +8,7 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
fail=0
diff --git a/tests/unibyte-binary b/tests/unibyte-binary
index 11325ee..3791d2d 100755
--- a/tests/unibyte-binary
+++ b/tests/unibyte-binary
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_unibyte_locale
fail=0
diff --git a/tests/unibyte-bracket-expr b/tests/unibyte-bracket-expr
index 68c475c..c44331a 100755
--- a/tests/unibyte-bracket-expr
+++ b/tests/unibyte-bracket-expr
@@ -20,7 +20,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_ru_RU_koi8_r
LC_ALL=ru_RU.KOI8-R
export LC_ALL
diff --git a/tests/unibyte-negated-circumflex b/tests/unibyte-negated-circumflex
index 03e448a..7df22ad 100755
--- a/tests/unibyte-negated-circumflex
+++ b/tests/unibyte-negated-circumflex
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_unibyte_locale
fail=0
diff --git a/tests/utf8-bracket b/tests/utf8-bracket
index e85877c..f5c57d6 100755
--- a/tests/utf8-bracket
+++ b/tests/utf8-bracket
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
printf '1\n2\n' >in || framework_failure_
diff --git a/tests/warn-char-classes b/tests/warn-char-classes
index b1db240..8d0dd9b 100755
--- a/tests/warn-char-classes
+++ b/tests/warn-char-classes
@@ -1,6 +1,6 @@
#!/bin/sh
# Use of any --include or --exclude* option would segfault in 2.6 and 2.6.1
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
echo f > x || framework_failure_
echo b >> x || framework_failure_
diff --git a/tests/word-delim-multibyte b/tests/word-delim-multibyte
index f65298f..af677c7 100755
--- a/tests/word-delim-multibyte
+++ b/tests/word-delim-multibyte
@@ -1,7 +1,7 @@
#!/bin/sh
# exercise \< and \> with multibyte data.
# Derived from http://savannah.gnu.org/bugs/?29537
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
diff --git a/tests/word-multi-file b/tests/word-multi-file
index 1816d60..c44bb03 100755
--- a/tests/word-multi-file
+++ b/tests/word-multi-file
@@ -1,7 +1,7 @@
#!/bin/sh
# exercise the -w option on multiple files
# Derived from http://bugzilla.redhat.com/570500
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
mkdir a || framework_failure_
( cd a \
diff --git a/tests/word-multibyte b/tests/word-multibyte
index 9cbb71f..c327d2f 100755
--- a/tests/word-multibyte
+++ b/tests/word-multibyte
@@ -1,6 +1,9 @@
#!/bin/sh
# This would fail for grep-2.20
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+
+# Add "./tests" to PATH for the use of get-mb-cur-max.
+path_prepend_ ./tests
require_en_utf8_locale_
diff --git a/tests/write-error-msg b/tests/write-error-msg
index 130648b..13d12d1 100755
--- a/tests/write-error-msg
+++ b/tests/write-error-msg
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
test -e /dev/full || skip_ your system lacks /dev/full
export LC_ALL=C
diff --git a/tests/yesno b/tests/yesno
index fd8d4ec..e5ca5fb 100755
--- a/tests/yesno
+++ b/tests/yesno
@@ -9,7 +9,7 @@
#
# This set of tests was started by Charles Levert.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
: ${VERBOSE=} # empty or "1"
failures=0
diff --git a/tests/z-anchor-newline b/tests/z-anchor-newline
index c12dd1e..eba0932 100755
--- a/tests/z-anchor-newline
+++ b/tests/z-anchor-newline
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_en_utf8_locale_
require_compiled_in_MB_support