summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/.deps/bench.Po1
-rw-r--r--tests/.deps/libxtre_la-regcomp.Plo1
-rw-r--r--tests/.deps/libxtre_la-regerror.Plo1
-rw-r--r--tests/.deps/libxtre_la-regexec.Plo1
-rw-r--r--tests/.deps/libxtre_la-tre-ast.Plo1
-rw-r--r--tests/.deps/libxtre_la-tre-compile.Plo1
-rw-r--r--tests/.deps/libxtre_la-tre-match-approx.Plo1
-rw-r--r--tests/.deps/libxtre_la-tre-match-backtrack.Plo1
-rw-r--r--tests/.deps/libxtre_la-tre-match-parallel.Plo1
-rw-r--r--tests/.deps/libxtre_la-tre-mem.Plo1
-rw-r--r--tests/.deps/libxtre_la-tre-parse.Plo1
-rw-r--r--tests/.deps/libxtre_la-tre-stack.Plo1
-rw-r--r--tests/.deps/libxtre_la-xmalloc.Plo1
-rw-r--r--tests/.deps/randtest-randtest.Po1
-rw-r--r--tests/.deps/retest-retest.Po1
-rw-r--r--tests/.deps/test-str-source.Po1
-rw-r--r--tests/.deps/wretest-retest.Po1
-rw-r--r--tests/Makefile910
-rw-r--r--tests/Makefile.am69
-rw-r--r--tests/Makefile.in910
-rw-r--r--tests/agrep/Makefile441
-rw-r--r--tests/agrep/Makefile.am16
-rw-r--r--tests/agrep/Makefile.in441
-rw-r--r--tests/agrep/basic.args6
-rw-r--r--tests/agrep/basic.input8
-rw-r--r--tests/agrep/basic.ok496
-rw-r--r--tests/agrep/delimiters.args9
-rw-r--r--tests/agrep/delimiters.input5
-rw-r--r--tests/agrep/delimiters.ok528
-rw-r--r--tests/agrep/exitstatus.args10
-rw-r--r--tests/agrep/exitstatus.input3
-rw-r--r--tests/agrep/exitstatus.ok705
-rw-r--r--tests/agrep/records.args9
-rw-r--r--tests/agrep/records.input23
-rw-r--r--tests/agrep/records.ok812
-rwxr-xr-xtests/agrep/run-tests.sh96
-rw-r--r--tests/bench.c466
-rwxr-xr-xtests/build-tests.sh34
-rw-r--r--tests/randtest.c76
-rw-r--r--tests/retest.c1681
-rw-r--r--tests/test-str-source.c134
41 files changed, 7905 insertions, 0 deletions
diff --git a/tests/.deps/bench.Po b/tests/.deps/bench.Po
new file mode 100644
index 0000000000000..9ce06a81ea45b
--- /dev/null
+++ b/tests/.deps/bench.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/tests/.deps/libxtre_la-regcomp.Plo b/tests/.deps/libxtre_la-regcomp.Plo
new file mode 100644
index 0000000000000..9ce06a81ea45b
--- /dev/null
+++ b/tests/.deps/libxtre_la-regcomp.Plo
@@ -0,0 +1 @@
+# dummy
diff --git a/tests/.deps/libxtre_la-regerror.Plo b/tests/.deps/libxtre_la-regerror.Plo
new file mode 100644
index 0000000000000..9ce06a81ea45b
--- /dev/null
+++ b/tests/.deps/libxtre_la-regerror.Plo
@@ -0,0 +1 @@
+# dummy
diff --git a/tests/.deps/libxtre_la-regexec.Plo b/tests/.deps/libxtre_la-regexec.Plo
new file mode 100644
index 0000000000000..9ce06a81ea45b
--- /dev/null
+++ b/tests/.deps/libxtre_la-regexec.Plo
@@ -0,0 +1 @@
+# dummy
diff --git a/tests/.deps/libxtre_la-tre-ast.Plo b/tests/.deps/libxtre_la-tre-ast.Plo
new file mode 100644
index 0000000000000..9ce06a81ea45b
--- /dev/null
+++ b/tests/.deps/libxtre_la-tre-ast.Plo
@@ -0,0 +1 @@
+# dummy
diff --git a/tests/.deps/libxtre_la-tre-compile.Plo b/tests/.deps/libxtre_la-tre-compile.Plo
new file mode 100644
index 0000000000000..9ce06a81ea45b
--- /dev/null
+++ b/tests/.deps/libxtre_la-tre-compile.Plo
@@ -0,0 +1 @@
+# dummy
diff --git a/tests/.deps/libxtre_la-tre-match-approx.Plo b/tests/.deps/libxtre_la-tre-match-approx.Plo
new file mode 100644
index 0000000000000..9ce06a81ea45b
--- /dev/null
+++ b/tests/.deps/libxtre_la-tre-match-approx.Plo
@@ -0,0 +1 @@
+# dummy
diff --git a/tests/.deps/libxtre_la-tre-match-backtrack.Plo b/tests/.deps/libxtre_la-tre-match-backtrack.Plo
new file mode 100644
index 0000000000000..9ce06a81ea45b
--- /dev/null
+++ b/tests/.deps/libxtre_la-tre-match-backtrack.Plo
@@ -0,0 +1 @@
+# dummy
diff --git a/tests/.deps/libxtre_la-tre-match-parallel.Plo b/tests/.deps/libxtre_la-tre-match-parallel.Plo
new file mode 100644
index 0000000000000..9ce06a81ea45b
--- /dev/null
+++ b/tests/.deps/libxtre_la-tre-match-parallel.Plo
@@ -0,0 +1 @@
+# dummy
diff --git a/tests/.deps/libxtre_la-tre-mem.Plo b/tests/.deps/libxtre_la-tre-mem.Plo
new file mode 100644
index 0000000000000..9ce06a81ea45b
--- /dev/null
+++ b/tests/.deps/libxtre_la-tre-mem.Plo
@@ -0,0 +1 @@
+# dummy
diff --git a/tests/.deps/libxtre_la-tre-parse.Plo b/tests/.deps/libxtre_la-tre-parse.Plo
new file mode 100644
index 0000000000000..9ce06a81ea45b
--- /dev/null
+++ b/tests/.deps/libxtre_la-tre-parse.Plo
@@ -0,0 +1 @@
+# dummy
diff --git a/tests/.deps/libxtre_la-tre-stack.Plo b/tests/.deps/libxtre_la-tre-stack.Plo
new file mode 100644
index 0000000000000..9ce06a81ea45b
--- /dev/null
+++ b/tests/.deps/libxtre_la-tre-stack.Plo
@@ -0,0 +1 @@
+# dummy
diff --git a/tests/.deps/libxtre_la-xmalloc.Plo b/tests/.deps/libxtre_la-xmalloc.Plo
new file mode 100644
index 0000000000000..9ce06a81ea45b
--- /dev/null
+++ b/tests/.deps/libxtre_la-xmalloc.Plo
@@ -0,0 +1 @@
+# dummy
diff --git a/tests/.deps/randtest-randtest.Po b/tests/.deps/randtest-randtest.Po
new file mode 100644
index 0000000000000..9ce06a81ea45b
--- /dev/null
+++ b/tests/.deps/randtest-randtest.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/tests/.deps/retest-retest.Po b/tests/.deps/retest-retest.Po
new file mode 100644
index 0000000000000..9ce06a81ea45b
--- /dev/null
+++ b/tests/.deps/retest-retest.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/tests/.deps/test-str-source.Po b/tests/.deps/test-str-source.Po
new file mode 100644
index 0000000000000..9ce06a81ea45b
--- /dev/null
+++ b/tests/.deps/test-str-source.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/tests/.deps/wretest-retest.Po b/tests/.deps/wretest-retest.Po
new file mode 100644
index 0000000000000..9ce06a81ea45b
--- /dev/null
+++ b/tests/.deps/wretest-retest.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644
index 0000000000000..e9ba1b14cc3b3
--- /dev/null
+++ b/tests/Makefile
@@ -0,0 +1,910 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# tests/Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+
+pkgdatadir = $(datadir)/tre
+pkglibdir = $(libdir)/tre
+pkgincludedir = $(includedir)/tre
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = x86_64-unknown-freebsd8.0
+host_triplet = x86_64-unknown-freebsd8.0
+target_triplet = x86_64-unknown-freebsd8.0
+check_PROGRAMS = retest$(EXEEXT) randtest$(EXEEXT) \
+ test-str-source$(EXEEXT) $(am__EXEEXT_1)
+EXTRA_PROGRAMS = bench$(EXEEXT)
+am__append_1 = wretest
+am__append_2 = ../lib/tre-match-approx.c
+TESTS = test-str-source$(EXEEXT) retest$(EXEEXT) $(am__EXEEXT_1)
+am__append_3 = wretest
+subdir = tests
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_libtool_tags.m4 \
+ $(top_srcdir)/m4/ax_check_funcs_comp.m4 \
+ $(top_srcdir)/m4/ax_check_sign.m4 \
+ $(top_srcdir)/m4/ax_decl_wchar_max.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/m4/vl_prog_cc_warnings.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/utils/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h \
+ $(top_builddir)/lib/tre-config.h
+CONFIG_CLEAN_FILES =
+libxtre_la_LIBADD =
+am__libxtre_la_SOURCES_DIST = ../lib/tre-mem.c ../lib/tre-stack.c \
+ ../lib/tre-ast.c ../lib/tre-parse.c ../lib/tre-compile.c \
+ ../lib/tre-match-parallel.c ../lib/tre-match-backtrack.c \
+ ../lib/regcomp.c ../lib/regexec.c ../lib/regerror.c \
+ ../lib/xmalloc.c ../lib/tre-match-approx.c
+am__objects_1 = libxtre_la-tre-match-approx.lo
+am_libxtre_la_OBJECTS = libxtre_la-tre-mem.lo \
+ libxtre_la-tre-stack.lo libxtre_la-tre-ast.lo \
+ libxtre_la-tre-parse.lo \
+ libxtre_la-tre-compile.lo \
+ libxtre_la-tre-match-parallel.lo \
+ libxtre_la-tre-match-backtrack.lo \
+ libxtre_la-regcomp.lo libxtre_la-regexec.lo \
+ libxtre_la-regerror.lo libxtre_la-xmalloc.lo \
+ $(am__objects_1)
+libxtre_la_OBJECTS = $(am_libxtre_la_OBJECTS)
+libxtre_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libxtre_la_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_libxtre_la_rpath =
+am__EXEEXT_1 = wretest$(EXEEXT)
+am_bench_OBJECTS = bench.$(OBJEXT)
+bench_OBJECTS = $(am_bench_OBJECTS)
+am__DEPENDENCIES_1 =
+am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
+bench_DEPENDENCIES = ../lib/libtre.la $(am__DEPENDENCIES_2)
+am_randtest_OBJECTS = randtest-randtest.$(OBJEXT)
+randtest_OBJECTS = $(am_randtest_OBJECTS)
+randtest_DEPENDENCIES = libxtre.la \
+ $(am__DEPENDENCIES_2)
+#randtest_DEPENDENCIES = ../lib/libtre.la \
+# $(am__DEPENDENCIES_2)
+randtest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(randtest_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_retest_OBJECTS = retest-retest.$(OBJEXT)
+retest_OBJECTS = $(am_retest_OBJECTS)
+retest_DEPENDENCIES = libxtre.la \
+ $(am__DEPENDENCIES_2)
+#retest_DEPENDENCIES = ../lib/libtre.la \
+# $(am__DEPENDENCIES_2)
+retest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(retest_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_test_str_source_OBJECTS = test-str-source.$(OBJEXT)
+test_str_source_OBJECTS = $(am_test_str_source_OBJECTS)
+test_str_source_DEPENDENCIES = ../lib/libtre.la $(am__DEPENDENCIES_2)
+am__wretest_SOURCES_DIST = retest.c
+am_wretest_OBJECTS = wretest-retest.$(OBJEXT)
+wretest_OBJECTS = $(am_wretest_OBJECTS)
+wretest_DEPENDENCIES = \
+ libxtre.la \
+ $(am__DEPENDENCIES_2)
+#wretest_DEPENDENCIES = \
+# ../lib/libtre.la \
+# $(am__DEPENDENCIES_2)
+wretest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(wretest_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. -I$(top_builddir) -I$(top_builddir)/lib
+depcomp = $(SHELL) $(top_srcdir)/utils/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libxtre_la_SOURCES) $(bench_SOURCES) $(randtest_SOURCES) \
+ $(retest_SOURCES) $(test_str_source_SOURCES) \
+ $(wretest_SOURCES)
+DIST_SOURCES = $(am__libxtre_la_SOURCES_DIST) $(bench_SOURCES) \
+ $(randtest_SOURCES) $(retest_SOURCES) \
+ $(test_str_source_SOURCES) $(am__wretest_SOURCES_DIST)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /home/gabor/wrk/tre/tre-0.8.0/utils/missing --run aclocal-1.10
+ALLOCA =
+AMTAR = ${SHELL} /home/gabor/wrk/tre/tre-0.8.0/utils/missing --run tar
+AR = ar
+AS = as
+AUTOCONF = ${SHELL} /home/gabor/wrk/tre/tre-0.8.0/utils/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/gabor/wrk/tre/tre-0.8.0/utils/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/gabor/wrk/tre/tre-0.8.0/utils/missing --run automake-1.10
+AWK = nawk
+CC = gcc
+CCDEPMODE = depmode=gcc3
+CFLAGS = -g -O2 -Wall
+CPP = gcc -E
+CPPFLAGS =
+CYGPATH_W = echo
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+DLLTOOL = dlltool
+DSYMUTIL =
+ECHO = echo
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = /usr/bin/grep -E
+EXEEXT =
+GETTEXT_MACRO_VERSION = 0.17
+GMSGFMT = /usr/local/bin/msgfmt
+GMSGFMT_015 = /usr/local/bin/msgfmt
+GREP = /usr/bin/grep
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
+INTLLIBS =
+INTL_MACOSX_LIBS =
+LDFLAGS =
+LIBICONV = /usr/local/lib/libiconv.so -Wl,-rpath -Wl,/usr/local/lib
+LIBINTL =
+LIBOBJS =
+LIBS =
+LIBTOOL = $(SHELL) $(top_builddir)/libtool
+LN_S = ln -s
+LTLIBICONV = -L/usr/local/lib -liconv -R/usr/local/lib
+LTLIBINTL =
+LTLIBOBJS =
+MAKEINFO = ${SHELL} /home/gabor/wrk/tre/tre-0.8.0/utils/missing --run makeinfo
+MKDIR_P = ../utils/install-sh -c -d
+MSGFMT = /usr/local/bin/msgfmt
+MSGFMT_015 = /usr/local/bin/msgfmt
+MSGMERGE = /usr/local/bin/msgmerge
+NMEDIT =
+OBJDUMP = objdump
+OBJEXT = o
+PACKAGE = tre
+PACKAGE_BUGREPORT = tre-general@lists.laurikari.net
+PACKAGE_NAME = TRE
+PACKAGE_STRING = TRE 0.8.0
+PACKAGE_TARNAME = tre
+PACKAGE_VERSION = 0.8.0
+PATH_SEPARATOR = :
+POSUB =
+RANLIB = ranlib
+SED = /usr/local/bin/gsed
+SET_MAKE =
+SHELL = /bin/sh
+STRIP = strip
+TRE_VERSION = 0.8.0
+USE_NLS = no
+VERSION = 0.8.0
+XGETTEXT = /usr/local/bin/xgettext
+XGETTEXT_015 = /usr/local/bin/xgettext
+XGETTEXT_EXTRA_OPTIONS =
+abs_builddir = /home/gabor/wrk/tre/tre-0.8.0/tests
+abs_srcdir = /home/gabor/wrk/tre/tre-0.8.0/tests
+abs_top_builddir = /home/gabor/wrk/tre/tre-0.8.0
+abs_top_srcdir = /home/gabor/wrk/tre/tre-0.8.0
+ac_ct_CC = gcc
+am__include = include
+am__leading_dot = .
+am__quote =
+am__tar = ${AMTAR} chof - "$$tardir"
+am__untar = ${AMTAR} xf -
+bindir = ${exec_prefix}/bin
+build = x86_64-unknown-freebsd8.0
+build_alias =
+build_cpu = x86_64
+build_os = freebsd8.0
+build_vendor = unknown
+builddir = .
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
+dvidir = ${docdir}
+exec_prefix = ${prefix}
+host = x86_64-unknown-freebsd8.0
+host_alias =
+host_cpu = x86_64
+host_os = freebsd8.0
+host_vendor = unknown
+htmldir = ${docdir}
+includedir = ${prefix}/include
+infodir = ${datarootdir}/info
+install_sh = $(SHELL) /home/gabor/wrk/tre/tre-0.8.0/utils/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localedir = ${datarootdir}/locale
+localstatedir = ${prefix}/var
+mandir = ${datarootdir}/man
+mkdir_p = $(top_builddir)/utils/install-sh -c -d
+oldincludedir = /usr/include
+pdfdir = ${docdir}
+prefix = /usr/local
+program_transform_name = s,x,x,
+psdir = ${docdir}
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+srcdir = .
+sysconfdir = ${prefix}/etc
+target = x86_64-unknown-freebsd8.0
+target_alias =
+target_cpu = x86_64
+target_os = freebsd8.0
+target_vendor = unknown
+top_builddir = ..
+top_srcdir = ..
+SUBDIRS = agrep
+LDADD = $(LTLIBINTL)
+retest_SOURCES = retest.c
+wretest_SOURCES = retest.c
+wretest_CPPFLAGS = -DWRETEST $(AM_CPPFLAGS)
+randtest_SOURCES = randtest.c
+bench_SOURCES = bench.c
+bench_LDADD = ../lib/libtre.la $(LDADD) -lm
+test_str_source_SOURCES = test-str-source.c
+test_str_source_LDADD = ../lib/libtre.la $(LDADD) -lm
+retest_LDADD = libxtre.la $(LDADD)
+#retest_LDADD = ../lib/libtre.la $(LDADD)
+wretest_LDADD = libxtre.la $(LDADD)
+#wretest_LDADD = ../lib/libtre.la $(LDADD)
+randtest_LDADD = libxtre.la $(LDADD)
+#randtest_LDADD = ../lib/libtre.la $(LDADD)
+check_LTLIBRARIES = libxtre.la
+libxtre_la_SOURCES = ../lib/tre-mem.c \
+ ../lib/tre-stack.c ../lib/tre-ast.c \
+ ../lib/tre-parse.c ../lib/tre-compile.c \
+ ../lib/tre-match-parallel.c \
+ ../lib/tre-match-backtrack.c ../lib/regcomp.c \
+ ../lib/regexec.c ../lib/regerror.c \
+ ../lib/xmalloc.c $(am__append_2)
+libxtre_la_CFLAGS = -DMALLOC_DEBUGGING
+retest_CFLAGS = -DMALLOC_DEBUGGING
+wretest_CFLAGS = -DMALLOC_DEBUGGING
+randtest_CFLAGS = -DMALLOC_DEBUGGING
+INCLUDES = -I$(top_srcdir)/lib
+EXTRA_DIST = build-tests.sh
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign tests/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-checkLTLIBRARIES:
+ -test -z "$(check_LTLIBRARIES)" || rm -f $(check_LTLIBRARIES)
+ @list='$(check_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libxtre.la: $(libxtre_la_OBJECTS) $(libxtre_la_DEPENDENCIES)
+ $(libxtre_la_LINK) $(am_libxtre_la_rpath) $(libxtre_la_OBJECTS) $(libxtre_la_LIBADD) $(LIBS)
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+bench$(EXEEXT): $(bench_OBJECTS) $(bench_DEPENDENCIES)
+ @rm -f bench$(EXEEXT)
+ $(LINK) $(bench_OBJECTS) $(bench_LDADD) $(LIBS)
+randtest$(EXEEXT): $(randtest_OBJECTS) $(randtest_DEPENDENCIES)
+ @rm -f randtest$(EXEEXT)
+ $(randtest_LINK) $(randtest_OBJECTS) $(randtest_LDADD) $(LIBS)
+retest$(EXEEXT): $(retest_OBJECTS) $(retest_DEPENDENCIES)
+ @rm -f retest$(EXEEXT)
+ $(retest_LINK) $(retest_OBJECTS) $(retest_LDADD) $(LIBS)
+test-str-source$(EXEEXT): $(test_str_source_OBJECTS) $(test_str_source_DEPENDENCIES)
+ @rm -f test-str-source$(EXEEXT)
+ $(LINK) $(test_str_source_OBJECTS) $(test_str_source_LDADD) $(LIBS)
+wretest$(EXEEXT): $(wretest_OBJECTS) $(wretest_DEPENDENCIES)
+ @rm -f wretest$(EXEEXT)
+ $(wretest_LINK) $(wretest_OBJECTS) $(wretest_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+include ./$(DEPDIR)/bench.Po
+include ./$(DEPDIR)/libxtre_la-regcomp.Plo
+include ./$(DEPDIR)/libxtre_la-regerror.Plo
+include ./$(DEPDIR)/libxtre_la-regexec.Plo
+include ./$(DEPDIR)/libxtre_la-tre-ast.Plo
+include ./$(DEPDIR)/libxtre_la-tre-compile.Plo
+include ./$(DEPDIR)/libxtre_la-tre-match-approx.Plo
+include ./$(DEPDIR)/libxtre_la-tre-match-backtrack.Plo
+include ./$(DEPDIR)/libxtre_la-tre-match-parallel.Plo
+include ./$(DEPDIR)/libxtre_la-tre-mem.Plo
+include ./$(DEPDIR)/libxtre_la-tre-parse.Plo
+include ./$(DEPDIR)/libxtre_la-tre-stack.Plo
+include ./$(DEPDIR)/libxtre_la-xmalloc.Plo
+include ./$(DEPDIR)/randtest-randtest.Po
+include ./$(DEPDIR)/retest-retest.Po
+include ./$(DEPDIR)/test-str-source.Po
+include ./$(DEPDIR)/wretest-retest.Po
+
+.c.o:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c $<
+
+.c.obj:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+# source='$<' object='$@' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(LTCOMPILE) -c -o $@ $<
+
+libxtre_la-tre-mem.lo: ../lib/tre-mem.c
+ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-tre-mem.lo -MD -MP -MF $(DEPDIR)/libxtre_la-tre-mem.Tpo -c -o libxtre_la-tre-mem.lo `test -f '../lib/tre-mem.c' || echo '$(srcdir)/'`../lib/tre-mem.c
+ mv -f $(DEPDIR)/libxtre_la-tre-mem.Tpo $(DEPDIR)/libxtre_la-tre-mem.Plo
+# source='../lib/tre-mem.c' object='libxtre_la-tre-mem.lo' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-tre-mem.lo `test -f '../lib/tre-mem.c' || echo '$(srcdir)/'`../lib/tre-mem.c
+
+libxtre_la-tre-stack.lo: ../lib/tre-stack.c
+ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-tre-stack.lo -MD -MP -MF $(DEPDIR)/libxtre_la-tre-stack.Tpo -c -o libxtre_la-tre-stack.lo `test -f '../lib/tre-stack.c' || echo '$(srcdir)/'`../lib/tre-stack.c
+ mv -f $(DEPDIR)/libxtre_la-tre-stack.Tpo $(DEPDIR)/libxtre_la-tre-stack.Plo
+# source='../lib/tre-stack.c' object='libxtre_la-tre-stack.lo' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-tre-stack.lo `test -f '../lib/tre-stack.c' || echo '$(srcdir)/'`../lib/tre-stack.c
+
+libxtre_la-tre-ast.lo: ../lib/tre-ast.c
+ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-tre-ast.lo -MD -MP -MF $(DEPDIR)/libxtre_la-tre-ast.Tpo -c -o libxtre_la-tre-ast.lo `test -f '../lib/tre-ast.c' || echo '$(srcdir)/'`../lib/tre-ast.c
+ mv -f $(DEPDIR)/libxtre_la-tre-ast.Tpo $(DEPDIR)/libxtre_la-tre-ast.Plo
+# source='../lib/tre-ast.c' object='libxtre_la-tre-ast.lo' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-tre-ast.lo `test -f '../lib/tre-ast.c' || echo '$(srcdir)/'`../lib/tre-ast.c
+
+libxtre_la-tre-parse.lo: ../lib/tre-parse.c
+ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-tre-parse.lo -MD -MP -MF $(DEPDIR)/libxtre_la-tre-parse.Tpo -c -o libxtre_la-tre-parse.lo `test -f '../lib/tre-parse.c' || echo '$(srcdir)/'`../lib/tre-parse.c
+ mv -f $(DEPDIR)/libxtre_la-tre-parse.Tpo $(DEPDIR)/libxtre_la-tre-parse.Plo
+# source='../lib/tre-parse.c' object='libxtre_la-tre-parse.lo' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-tre-parse.lo `test -f '../lib/tre-parse.c' || echo '$(srcdir)/'`../lib/tre-parse.c
+
+libxtre_la-tre-compile.lo: ../lib/tre-compile.c
+ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-tre-compile.lo -MD -MP -MF $(DEPDIR)/libxtre_la-tre-compile.Tpo -c -o libxtre_la-tre-compile.lo `test -f '../lib/tre-compile.c' || echo '$(srcdir)/'`../lib/tre-compile.c
+ mv -f $(DEPDIR)/libxtre_la-tre-compile.Tpo $(DEPDIR)/libxtre_la-tre-compile.Plo
+# source='../lib/tre-compile.c' object='libxtre_la-tre-compile.lo' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-tre-compile.lo `test -f '../lib/tre-compile.c' || echo '$(srcdir)/'`../lib/tre-compile.c
+
+libxtre_la-tre-match-parallel.lo: ../lib/tre-match-parallel.c
+ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-tre-match-parallel.lo -MD -MP -MF $(DEPDIR)/libxtre_la-tre-match-parallel.Tpo -c -o libxtre_la-tre-match-parallel.lo `test -f '../lib/tre-match-parallel.c' || echo '$(srcdir)/'`../lib/tre-match-parallel.c
+ mv -f $(DEPDIR)/libxtre_la-tre-match-parallel.Tpo $(DEPDIR)/libxtre_la-tre-match-parallel.Plo
+# source='../lib/tre-match-parallel.c' object='libxtre_la-tre-match-parallel.lo' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-tre-match-parallel.lo `test -f '../lib/tre-match-parallel.c' || echo '$(srcdir)/'`../lib/tre-match-parallel.c
+
+libxtre_la-tre-match-backtrack.lo: ../lib/tre-match-backtrack.c
+ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-tre-match-backtrack.lo -MD -MP -MF $(DEPDIR)/libxtre_la-tre-match-backtrack.Tpo -c -o libxtre_la-tre-match-backtrack.lo `test -f '../lib/tre-match-backtrack.c' || echo '$(srcdir)/'`../lib/tre-match-backtrack.c
+ mv -f $(DEPDIR)/libxtre_la-tre-match-backtrack.Tpo $(DEPDIR)/libxtre_la-tre-match-backtrack.Plo
+# source='../lib/tre-match-backtrack.c' object='libxtre_la-tre-match-backtrack.lo' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-tre-match-backtrack.lo `test -f '../lib/tre-match-backtrack.c' || echo '$(srcdir)/'`../lib/tre-match-backtrack.c
+
+libxtre_la-regcomp.lo: ../lib/regcomp.c
+ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-regcomp.lo -MD -MP -MF $(DEPDIR)/libxtre_la-regcomp.Tpo -c -o libxtre_la-regcomp.lo `test -f '../lib/regcomp.c' || echo '$(srcdir)/'`../lib/regcomp.c
+ mv -f $(DEPDIR)/libxtre_la-regcomp.Tpo $(DEPDIR)/libxtre_la-regcomp.Plo
+# source='../lib/regcomp.c' object='libxtre_la-regcomp.lo' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-regcomp.lo `test -f '../lib/regcomp.c' || echo '$(srcdir)/'`../lib/regcomp.c
+
+libxtre_la-regexec.lo: ../lib/regexec.c
+ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-regexec.lo -MD -MP -MF $(DEPDIR)/libxtre_la-regexec.Tpo -c -o libxtre_la-regexec.lo `test -f '../lib/regexec.c' || echo '$(srcdir)/'`../lib/regexec.c
+ mv -f $(DEPDIR)/libxtre_la-regexec.Tpo $(DEPDIR)/libxtre_la-regexec.Plo
+# source='../lib/regexec.c' object='libxtre_la-regexec.lo' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-regexec.lo `test -f '../lib/regexec.c' || echo '$(srcdir)/'`../lib/regexec.c
+
+libxtre_la-regerror.lo: ../lib/regerror.c
+ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-regerror.lo -MD -MP -MF $(DEPDIR)/libxtre_la-regerror.Tpo -c -o libxtre_la-regerror.lo `test -f '../lib/regerror.c' || echo '$(srcdir)/'`../lib/regerror.c
+ mv -f $(DEPDIR)/libxtre_la-regerror.Tpo $(DEPDIR)/libxtre_la-regerror.Plo
+# source='../lib/regerror.c' object='libxtre_la-regerror.lo' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-regerror.lo `test -f '../lib/regerror.c' || echo '$(srcdir)/'`../lib/regerror.c
+
+libxtre_la-xmalloc.lo: ../lib/xmalloc.c
+ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-xmalloc.lo -MD -MP -MF $(DEPDIR)/libxtre_la-xmalloc.Tpo -c -o libxtre_la-xmalloc.lo `test -f '../lib/xmalloc.c' || echo '$(srcdir)/'`../lib/xmalloc.c
+ mv -f $(DEPDIR)/libxtre_la-xmalloc.Tpo $(DEPDIR)/libxtre_la-xmalloc.Plo
+# source='../lib/xmalloc.c' object='libxtre_la-xmalloc.lo' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-xmalloc.lo `test -f '../lib/xmalloc.c' || echo '$(srcdir)/'`../lib/xmalloc.c
+
+libxtre_la-tre-match-approx.lo: ../lib/tre-match-approx.c
+ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-tre-match-approx.lo -MD -MP -MF $(DEPDIR)/libxtre_la-tre-match-approx.Tpo -c -o libxtre_la-tre-match-approx.lo `test -f '../lib/tre-match-approx.c' || echo '$(srcdir)/'`../lib/tre-match-approx.c
+ mv -f $(DEPDIR)/libxtre_la-tre-match-approx.Tpo $(DEPDIR)/libxtre_la-tre-match-approx.Plo
+# source='../lib/tre-match-approx.c' object='libxtre_la-tre-match-approx.lo' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-tre-match-approx.lo `test -f '../lib/tre-match-approx.c' || echo '$(srcdir)/'`../lib/tre-match-approx.c
+
+randtest-randtest.o: randtest.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(randtest_CFLAGS) $(CFLAGS) -MT randtest-randtest.o -MD -MP -MF $(DEPDIR)/randtest-randtest.Tpo -c -o randtest-randtest.o `test -f 'randtest.c' || echo '$(srcdir)/'`randtest.c
+ mv -f $(DEPDIR)/randtest-randtest.Tpo $(DEPDIR)/randtest-randtest.Po
+# source='randtest.c' object='randtest-randtest.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(randtest_CFLAGS) $(CFLAGS) -c -o randtest-randtest.o `test -f 'randtest.c' || echo '$(srcdir)/'`randtest.c
+
+randtest-randtest.obj: randtest.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(randtest_CFLAGS) $(CFLAGS) -MT randtest-randtest.obj -MD -MP -MF $(DEPDIR)/randtest-randtest.Tpo -c -o randtest-randtest.obj `if test -f 'randtest.c'; then $(CYGPATH_W) 'randtest.c'; else $(CYGPATH_W) '$(srcdir)/randtest.c'; fi`
+ mv -f $(DEPDIR)/randtest-randtest.Tpo $(DEPDIR)/randtest-randtest.Po
+# source='randtest.c' object='randtest-randtest.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(randtest_CFLAGS) $(CFLAGS) -c -o randtest-randtest.obj `if test -f 'randtest.c'; then $(CYGPATH_W) 'randtest.c'; else $(CYGPATH_W) '$(srcdir)/randtest.c'; fi`
+
+retest-retest.o: retest.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(retest_CFLAGS) $(CFLAGS) -MT retest-retest.o -MD -MP -MF $(DEPDIR)/retest-retest.Tpo -c -o retest-retest.o `test -f 'retest.c' || echo '$(srcdir)/'`retest.c
+ mv -f $(DEPDIR)/retest-retest.Tpo $(DEPDIR)/retest-retest.Po
+# source='retest.c' object='retest-retest.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(retest_CFLAGS) $(CFLAGS) -c -o retest-retest.o `test -f 'retest.c' || echo '$(srcdir)/'`retest.c
+
+retest-retest.obj: retest.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(retest_CFLAGS) $(CFLAGS) -MT retest-retest.obj -MD -MP -MF $(DEPDIR)/retest-retest.Tpo -c -o retest-retest.obj `if test -f 'retest.c'; then $(CYGPATH_W) 'retest.c'; else $(CYGPATH_W) '$(srcdir)/retest.c'; fi`
+ mv -f $(DEPDIR)/retest-retest.Tpo $(DEPDIR)/retest-retest.Po
+# source='retest.c' object='retest-retest.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(retest_CFLAGS) $(CFLAGS) -c -o retest-retest.obj `if test -f 'retest.c'; then $(CYGPATH_W) 'retest.c'; else $(CYGPATH_W) '$(srcdir)/retest.c'; fi`
+
+wretest-retest.o: retest.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(wretest_CPPFLAGS) $(CPPFLAGS) $(wretest_CFLAGS) $(CFLAGS) -MT wretest-retest.o -MD -MP -MF $(DEPDIR)/wretest-retest.Tpo -c -o wretest-retest.o `test -f 'retest.c' || echo '$(srcdir)/'`retest.c
+ mv -f $(DEPDIR)/wretest-retest.Tpo $(DEPDIR)/wretest-retest.Po
+# source='retest.c' object='wretest-retest.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(wretest_CPPFLAGS) $(CPPFLAGS) $(wretest_CFLAGS) $(CFLAGS) -c -o wretest-retest.o `test -f 'retest.c' || echo '$(srcdir)/'`retest.c
+
+wretest-retest.obj: retest.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(wretest_CPPFLAGS) $(CPPFLAGS) $(wretest_CFLAGS) $(CFLAGS) -MT wretest-retest.obj -MD -MP -MF $(DEPDIR)/wretest-retest.Tpo -c -o wretest-retest.obj `if test -f 'retest.c'; then $(CYGPATH_W) 'retest.c'; else $(CYGPATH_W) '$(srcdir)/retest.c'; fi`
+ mv -f $(DEPDIR)/wretest-retest.Tpo $(DEPDIR)/wretest-retest.Po
+# source='retest.c' object='wretest-retest.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(wretest_CPPFLAGS) $(CPPFLAGS) $(wretest_CFLAGS) $(CFLAGS) -c -o wretest-retest.obj `if test -f 'retest.c'; then $(CYGPATH_W) 'retest.c'; else $(CYGPATH_W) '$(srcdir)/retest.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all tests failed"; \
+ else \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-checkLTLIBRARIES clean-checkPROGRAMS clean-generic \
+ clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-TESTS check-am clean \
+ clean-checkLTLIBRARIES clean-checkPROGRAMS clean-generic \
+ clean-libtool ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000000000..ab332f213f99c
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,69 @@
+## Process this file with automake to produce Makefile.in
+
+SUBDIRS = agrep
+
+check_PROGRAMS = retest randtest test-str-source
+EXTRA_PROGRAMS = bench
+LDADD = $(LTLIBINTL)
+
+retest_SOURCES = retest.c
+if TRE_MULTIBYTE
+check_PROGRAMS += wretest
+wretest_SOURCES = retest.c
+wretest_CPPFLAGS = -DWRETEST $(AM_CPPFLAGS)
+endif TRE_MULTIBYTE
+
+randtest_SOURCES = randtest.c
+
+bench_SOURCES = bench.c
+bench_LDADD = ../lib/libtre.la $(LDADD) -lm
+
+test_str_source_SOURCES = test-str-source.c
+test_str_source_LDADD = ../lib/libtre.la $(LDADD) -lm
+
+if TRE_DEBUG
+ retest_LDADD = ../lib/libtre.la $(LDADD)
+if TRE_MULTIBYTE
+ wretest_LDADD = ../lib/libtre.la $(LDADD)
+endif TRE_MULTIBYTE
+ randtest_LDADD = ../lib/libtre.la $(LDADD)
+else !TRE_DEBUG
+ ## Debugging is not turned on. Make a malloc-debugging version of the
+ ## library and use it with `retest' and `randtest'. Malloc-debugging is
+ ## not used for the debugging version since it would just get in the way.
+ check_LTLIBRARIES = libxtre.la
+ libxtre_la_SOURCES = \
+ ../lib/tre-mem.c \
+ ../lib/tre-stack.c \
+ ../lib/tre-ast.c \
+ ../lib/tre-parse.c \
+ ../lib/tre-compile.c \
+ ../lib/tre-match-parallel.c \
+ ../lib/tre-match-backtrack.c \
+ ../lib/regcomp.c \
+ ../lib/regexec.c \
+ ../lib/regerror.c \
+ ../lib/xmalloc.c
+if TRE_APPROX
+ libxtre_la_SOURCES += ../lib/tre-match-approx.c
+endif TRE_APPROX
+ libxtre_la_CFLAGS = -DMALLOC_DEBUGGING
+
+ retest_CFLAGS = -DMALLOC_DEBUGGING
+ retest_LDADD = libxtre.la $(LDADD)
+if TRE_MULTIBYTE
+ wretest_CFLAGS = -DMALLOC_DEBUGGING
+ wretest_LDADD = libxtre.la $(LDADD)
+endif TRE_MULTIBYTE
+ randtest_CFLAGS = -DMALLOC_DEBUGGING
+ randtest_LDADD = libxtre.la $(LDADD)
+endif !TRE_DEBUG
+
+INCLUDES = -I$(top_srcdir)/lib
+
+EXTRA_DIST = build-tests.sh
+
+TESTS = test-str-source retest
+if TRE_MULTIBYTE
+TESTS += wretest
+endif TRE_MULTIBYTE
diff --git a/tests/Makefile.in b/tests/Makefile.in
new file mode 100644
index 0000000000000..120b8e0400882
--- /dev/null
+++ b/tests/Makefile.in
@@ -0,0 +1,910 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+check_PROGRAMS = retest$(EXEEXT) randtest$(EXEEXT) \
+ test-str-source$(EXEEXT) $(am__EXEEXT_1)
+EXTRA_PROGRAMS = bench$(EXEEXT)
+@TRE_MULTIBYTE_TRUE@am__append_1 = wretest
+@TRE_APPROX_TRUE@@TRE_DEBUG_FALSE@am__append_2 = ../lib/tre-match-approx.c
+TESTS = test-str-source$(EXEEXT) retest$(EXEEXT) $(am__EXEEXT_1)
+@TRE_MULTIBYTE_TRUE@am__append_3 = wretest
+subdir = tests
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_libtool_tags.m4 \
+ $(top_srcdir)/m4/ax_check_funcs_comp.m4 \
+ $(top_srcdir)/m4/ax_check_sign.m4 \
+ $(top_srcdir)/m4/ax_decl_wchar_max.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/m4/vl_prog_cc_warnings.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/utils/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h \
+ $(top_builddir)/lib/tre-config.h
+CONFIG_CLEAN_FILES =
+libxtre_la_LIBADD =
+am__libxtre_la_SOURCES_DIST = ../lib/tre-mem.c ../lib/tre-stack.c \
+ ../lib/tre-ast.c ../lib/tre-parse.c ../lib/tre-compile.c \
+ ../lib/tre-match-parallel.c ../lib/tre-match-backtrack.c \
+ ../lib/regcomp.c ../lib/regexec.c ../lib/regerror.c \
+ ../lib/xmalloc.c ../lib/tre-match-approx.c
+@TRE_APPROX_TRUE@@TRE_DEBUG_FALSE@am__objects_1 = libxtre_la-tre-match-approx.lo
+@TRE_DEBUG_FALSE@am_libxtre_la_OBJECTS = libxtre_la-tre-mem.lo \
+@TRE_DEBUG_FALSE@ libxtre_la-tre-stack.lo libxtre_la-tre-ast.lo \
+@TRE_DEBUG_FALSE@ libxtre_la-tre-parse.lo \
+@TRE_DEBUG_FALSE@ libxtre_la-tre-compile.lo \
+@TRE_DEBUG_FALSE@ libxtre_la-tre-match-parallel.lo \
+@TRE_DEBUG_FALSE@ libxtre_la-tre-match-backtrack.lo \
+@TRE_DEBUG_FALSE@ libxtre_la-regcomp.lo libxtre_la-regexec.lo \
+@TRE_DEBUG_FALSE@ libxtre_la-regerror.lo libxtre_la-xmalloc.lo \
+@TRE_DEBUG_FALSE@ $(am__objects_1)
+libxtre_la_OBJECTS = $(am_libxtre_la_OBJECTS)
+libxtre_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libxtre_la_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+@TRE_DEBUG_FALSE@am_libxtre_la_rpath =
+@TRE_MULTIBYTE_TRUE@am__EXEEXT_1 = wretest$(EXEEXT)
+am_bench_OBJECTS = bench.$(OBJEXT)
+bench_OBJECTS = $(am_bench_OBJECTS)
+am__DEPENDENCIES_1 =
+am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
+bench_DEPENDENCIES = ../lib/libtre.la $(am__DEPENDENCIES_2)
+am_randtest_OBJECTS = randtest-randtest.$(OBJEXT)
+randtest_OBJECTS = $(am_randtest_OBJECTS)
+@TRE_DEBUG_FALSE@randtest_DEPENDENCIES = libxtre.la \
+@TRE_DEBUG_FALSE@ $(am__DEPENDENCIES_2)
+@TRE_DEBUG_TRUE@randtest_DEPENDENCIES = ../lib/libtre.la \
+@TRE_DEBUG_TRUE@ $(am__DEPENDENCIES_2)
+randtest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(randtest_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_retest_OBJECTS = retest-retest.$(OBJEXT)
+retest_OBJECTS = $(am_retest_OBJECTS)
+@TRE_DEBUG_FALSE@retest_DEPENDENCIES = libxtre.la \
+@TRE_DEBUG_FALSE@ $(am__DEPENDENCIES_2)
+@TRE_DEBUG_TRUE@retest_DEPENDENCIES = ../lib/libtre.la \
+@TRE_DEBUG_TRUE@ $(am__DEPENDENCIES_2)
+retest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(retest_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_test_str_source_OBJECTS = test-str-source.$(OBJEXT)
+test_str_source_OBJECTS = $(am_test_str_source_OBJECTS)
+test_str_source_DEPENDENCIES = ../lib/libtre.la $(am__DEPENDENCIES_2)
+am__wretest_SOURCES_DIST = retest.c
+@TRE_MULTIBYTE_TRUE@am_wretest_OBJECTS = wretest-retest.$(OBJEXT)
+wretest_OBJECTS = $(am_wretest_OBJECTS)
+@TRE_DEBUG_FALSE@@TRE_MULTIBYTE_TRUE@wretest_DEPENDENCIES = \
+@TRE_DEBUG_FALSE@@TRE_MULTIBYTE_TRUE@ libxtre.la \
+@TRE_DEBUG_FALSE@@TRE_MULTIBYTE_TRUE@ $(am__DEPENDENCIES_2)
+@TRE_DEBUG_TRUE@@TRE_MULTIBYTE_TRUE@wretest_DEPENDENCIES = \
+@TRE_DEBUG_TRUE@@TRE_MULTIBYTE_TRUE@ ../lib/libtre.la \
+@TRE_DEBUG_TRUE@@TRE_MULTIBYTE_TRUE@ $(am__DEPENDENCIES_2)
+wretest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(wretest_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -I$(top_builddir)/lib
+depcomp = $(SHELL) $(top_srcdir)/utils/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libxtre_la_SOURCES) $(bench_SOURCES) $(randtest_SOURCES) \
+ $(retest_SOURCES) $(test_str_source_SOURCES) \
+ $(wretest_SOURCES)
+DIST_SOURCES = $(am__libxtre_la_SOURCES_DIST) $(bench_SOURCES) \
+ $(randtest_SOURCES) $(retest_SOURCES) \
+ $(test_str_source_SOURCES) $(am__wretest_SOURCES_DIST)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TRE_VERSION = @TRE_VERSION@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SUBDIRS = agrep
+LDADD = $(LTLIBINTL)
+retest_SOURCES = retest.c
+@TRE_MULTIBYTE_TRUE@wretest_SOURCES = retest.c
+@TRE_MULTIBYTE_TRUE@wretest_CPPFLAGS = -DWRETEST $(AM_CPPFLAGS)
+randtest_SOURCES = randtest.c
+bench_SOURCES = bench.c
+bench_LDADD = ../lib/libtre.la $(LDADD) -lm
+test_str_source_SOURCES = test-str-source.c
+test_str_source_LDADD = ../lib/libtre.la $(LDADD) -lm
+@TRE_DEBUG_FALSE@retest_LDADD = libxtre.la $(LDADD)
+@TRE_DEBUG_TRUE@retest_LDADD = ../lib/libtre.la $(LDADD)
+@TRE_DEBUG_FALSE@@TRE_MULTIBYTE_TRUE@wretest_LDADD = libxtre.la $(LDADD)
+@TRE_DEBUG_TRUE@@TRE_MULTIBYTE_TRUE@wretest_LDADD = ../lib/libtre.la $(LDADD)
+@TRE_DEBUG_FALSE@randtest_LDADD = libxtre.la $(LDADD)
+@TRE_DEBUG_TRUE@randtest_LDADD = ../lib/libtre.la $(LDADD)
+@TRE_DEBUG_FALSE@check_LTLIBRARIES = libxtre.la
+@TRE_DEBUG_FALSE@libxtre_la_SOURCES = ../lib/tre-mem.c \
+@TRE_DEBUG_FALSE@ ../lib/tre-stack.c ../lib/tre-ast.c \
+@TRE_DEBUG_FALSE@ ../lib/tre-parse.c ../lib/tre-compile.c \
+@TRE_DEBUG_FALSE@ ../lib/tre-match-parallel.c \
+@TRE_DEBUG_FALSE@ ../lib/tre-match-backtrack.c ../lib/regcomp.c \
+@TRE_DEBUG_FALSE@ ../lib/regexec.c ../lib/regerror.c \
+@TRE_DEBUG_FALSE@ ../lib/xmalloc.c $(am__append_2)
+@TRE_DEBUG_FALSE@libxtre_la_CFLAGS = -DMALLOC_DEBUGGING
+@TRE_DEBUG_FALSE@retest_CFLAGS = -DMALLOC_DEBUGGING
+@TRE_DEBUG_FALSE@@TRE_MULTIBYTE_TRUE@wretest_CFLAGS = -DMALLOC_DEBUGGING
+@TRE_DEBUG_FALSE@randtest_CFLAGS = -DMALLOC_DEBUGGING
+INCLUDES = -I$(top_srcdir)/lib
+EXTRA_DIST = build-tests.sh
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign tests/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-checkLTLIBRARIES:
+ -test -z "$(check_LTLIBRARIES)" || rm -f $(check_LTLIBRARIES)
+ @list='$(check_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libxtre.la: $(libxtre_la_OBJECTS) $(libxtre_la_DEPENDENCIES)
+ $(libxtre_la_LINK) $(am_libxtre_la_rpath) $(libxtre_la_OBJECTS) $(libxtre_la_LIBADD) $(LIBS)
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+bench$(EXEEXT): $(bench_OBJECTS) $(bench_DEPENDENCIES)
+ @rm -f bench$(EXEEXT)
+ $(LINK) $(bench_OBJECTS) $(bench_LDADD) $(LIBS)
+randtest$(EXEEXT): $(randtest_OBJECTS) $(randtest_DEPENDENCIES)
+ @rm -f randtest$(EXEEXT)
+ $(randtest_LINK) $(randtest_OBJECTS) $(randtest_LDADD) $(LIBS)
+retest$(EXEEXT): $(retest_OBJECTS) $(retest_DEPENDENCIES)
+ @rm -f retest$(EXEEXT)
+ $(retest_LINK) $(retest_OBJECTS) $(retest_LDADD) $(LIBS)
+test-str-source$(EXEEXT): $(test_str_source_OBJECTS) $(test_str_source_DEPENDENCIES)
+ @rm -f test-str-source$(EXEEXT)
+ $(LINK) $(test_str_source_OBJECTS) $(test_str_source_LDADD) $(LIBS)
+wretest$(EXEEXT): $(wretest_OBJECTS) $(wretest_DEPENDENCIES)
+ @rm -f wretest$(EXEEXT)
+ $(wretest_LINK) $(wretest_OBJECTS) $(wretest_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bench.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxtre_la-regcomp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxtre_la-regerror.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxtre_la-regexec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxtre_la-tre-ast.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxtre_la-tre-compile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxtre_la-tre-match-approx.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxtre_la-tre-match-backtrack.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxtre_la-tre-match-parallel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxtre_la-tre-mem.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxtre_la-tre-parse.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxtre_la-tre-stack.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxtre_la-xmalloc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/randtest-randtest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/retest-retest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-str-source.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wretest-retest.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+libxtre_la-tre-mem.lo: ../lib/tre-mem.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-tre-mem.lo -MD -MP -MF $(DEPDIR)/libxtre_la-tre-mem.Tpo -c -o libxtre_la-tre-mem.lo `test -f '../lib/tre-mem.c' || echo '$(srcdir)/'`../lib/tre-mem.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxtre_la-tre-mem.Tpo $(DEPDIR)/libxtre_la-tre-mem.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../lib/tre-mem.c' object='libxtre_la-tre-mem.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-tre-mem.lo `test -f '../lib/tre-mem.c' || echo '$(srcdir)/'`../lib/tre-mem.c
+
+libxtre_la-tre-stack.lo: ../lib/tre-stack.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-tre-stack.lo -MD -MP -MF $(DEPDIR)/libxtre_la-tre-stack.Tpo -c -o libxtre_la-tre-stack.lo `test -f '../lib/tre-stack.c' || echo '$(srcdir)/'`../lib/tre-stack.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxtre_la-tre-stack.Tpo $(DEPDIR)/libxtre_la-tre-stack.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../lib/tre-stack.c' object='libxtre_la-tre-stack.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-tre-stack.lo `test -f '../lib/tre-stack.c' || echo '$(srcdir)/'`../lib/tre-stack.c
+
+libxtre_la-tre-ast.lo: ../lib/tre-ast.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-tre-ast.lo -MD -MP -MF $(DEPDIR)/libxtre_la-tre-ast.Tpo -c -o libxtre_la-tre-ast.lo `test -f '../lib/tre-ast.c' || echo '$(srcdir)/'`../lib/tre-ast.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxtre_la-tre-ast.Tpo $(DEPDIR)/libxtre_la-tre-ast.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../lib/tre-ast.c' object='libxtre_la-tre-ast.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-tre-ast.lo `test -f '../lib/tre-ast.c' || echo '$(srcdir)/'`../lib/tre-ast.c
+
+libxtre_la-tre-parse.lo: ../lib/tre-parse.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-tre-parse.lo -MD -MP -MF $(DEPDIR)/libxtre_la-tre-parse.Tpo -c -o libxtre_la-tre-parse.lo `test -f '../lib/tre-parse.c' || echo '$(srcdir)/'`../lib/tre-parse.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxtre_la-tre-parse.Tpo $(DEPDIR)/libxtre_la-tre-parse.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../lib/tre-parse.c' object='libxtre_la-tre-parse.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-tre-parse.lo `test -f '../lib/tre-parse.c' || echo '$(srcdir)/'`../lib/tre-parse.c
+
+libxtre_la-tre-compile.lo: ../lib/tre-compile.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-tre-compile.lo -MD -MP -MF $(DEPDIR)/libxtre_la-tre-compile.Tpo -c -o libxtre_la-tre-compile.lo `test -f '../lib/tre-compile.c' || echo '$(srcdir)/'`../lib/tre-compile.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxtre_la-tre-compile.Tpo $(DEPDIR)/libxtre_la-tre-compile.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../lib/tre-compile.c' object='libxtre_la-tre-compile.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-tre-compile.lo `test -f '../lib/tre-compile.c' || echo '$(srcdir)/'`../lib/tre-compile.c
+
+libxtre_la-tre-match-parallel.lo: ../lib/tre-match-parallel.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-tre-match-parallel.lo -MD -MP -MF $(DEPDIR)/libxtre_la-tre-match-parallel.Tpo -c -o libxtre_la-tre-match-parallel.lo `test -f '../lib/tre-match-parallel.c' || echo '$(srcdir)/'`../lib/tre-match-parallel.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxtre_la-tre-match-parallel.Tpo $(DEPDIR)/libxtre_la-tre-match-parallel.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../lib/tre-match-parallel.c' object='libxtre_la-tre-match-parallel.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-tre-match-parallel.lo `test -f '../lib/tre-match-parallel.c' || echo '$(srcdir)/'`../lib/tre-match-parallel.c
+
+libxtre_la-tre-match-backtrack.lo: ../lib/tre-match-backtrack.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-tre-match-backtrack.lo -MD -MP -MF $(DEPDIR)/libxtre_la-tre-match-backtrack.Tpo -c -o libxtre_la-tre-match-backtrack.lo `test -f '../lib/tre-match-backtrack.c' || echo '$(srcdir)/'`../lib/tre-match-backtrack.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxtre_la-tre-match-backtrack.Tpo $(DEPDIR)/libxtre_la-tre-match-backtrack.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../lib/tre-match-backtrack.c' object='libxtre_la-tre-match-backtrack.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-tre-match-backtrack.lo `test -f '../lib/tre-match-backtrack.c' || echo '$(srcdir)/'`../lib/tre-match-backtrack.c
+
+libxtre_la-regcomp.lo: ../lib/regcomp.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-regcomp.lo -MD -MP -MF $(DEPDIR)/libxtre_la-regcomp.Tpo -c -o libxtre_la-regcomp.lo `test -f '../lib/regcomp.c' || echo '$(srcdir)/'`../lib/regcomp.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxtre_la-regcomp.Tpo $(DEPDIR)/libxtre_la-regcomp.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../lib/regcomp.c' object='libxtre_la-regcomp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-regcomp.lo `test -f '../lib/regcomp.c' || echo '$(srcdir)/'`../lib/regcomp.c
+
+libxtre_la-regexec.lo: ../lib/regexec.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-regexec.lo -MD -MP -MF $(DEPDIR)/libxtre_la-regexec.Tpo -c -o libxtre_la-regexec.lo `test -f '../lib/regexec.c' || echo '$(srcdir)/'`../lib/regexec.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxtre_la-regexec.Tpo $(DEPDIR)/libxtre_la-regexec.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../lib/regexec.c' object='libxtre_la-regexec.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-regexec.lo `test -f '../lib/regexec.c' || echo '$(srcdir)/'`../lib/regexec.c
+
+libxtre_la-regerror.lo: ../lib/regerror.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-regerror.lo -MD -MP -MF $(DEPDIR)/libxtre_la-regerror.Tpo -c -o libxtre_la-regerror.lo `test -f '../lib/regerror.c' || echo '$(srcdir)/'`../lib/regerror.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxtre_la-regerror.Tpo $(DEPDIR)/libxtre_la-regerror.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../lib/regerror.c' object='libxtre_la-regerror.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-regerror.lo `test -f '../lib/regerror.c' || echo '$(srcdir)/'`../lib/regerror.c
+
+libxtre_la-xmalloc.lo: ../lib/xmalloc.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-xmalloc.lo -MD -MP -MF $(DEPDIR)/libxtre_la-xmalloc.Tpo -c -o libxtre_la-xmalloc.lo `test -f '../lib/xmalloc.c' || echo '$(srcdir)/'`../lib/xmalloc.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxtre_la-xmalloc.Tpo $(DEPDIR)/libxtre_la-xmalloc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../lib/xmalloc.c' object='libxtre_la-xmalloc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-xmalloc.lo `test -f '../lib/xmalloc.c' || echo '$(srcdir)/'`../lib/xmalloc.c
+
+libxtre_la-tre-match-approx.lo: ../lib/tre-match-approx.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -MT libxtre_la-tre-match-approx.lo -MD -MP -MF $(DEPDIR)/libxtre_la-tre-match-approx.Tpo -c -o libxtre_la-tre-match-approx.lo `test -f '../lib/tre-match-approx.c' || echo '$(srcdir)/'`../lib/tre-match-approx.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxtre_la-tre-match-approx.Tpo $(DEPDIR)/libxtre_la-tre-match-approx.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../lib/tre-match-approx.c' object='libxtre_la-tre-match-approx.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxtre_la_CFLAGS) $(CFLAGS) -c -o libxtre_la-tre-match-approx.lo `test -f '../lib/tre-match-approx.c' || echo '$(srcdir)/'`../lib/tre-match-approx.c
+
+randtest-randtest.o: randtest.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(randtest_CFLAGS) $(CFLAGS) -MT randtest-randtest.o -MD -MP -MF $(DEPDIR)/randtest-randtest.Tpo -c -o randtest-randtest.o `test -f 'randtest.c' || echo '$(srcdir)/'`randtest.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/randtest-randtest.Tpo $(DEPDIR)/randtest-randtest.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='randtest.c' object='randtest-randtest.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(randtest_CFLAGS) $(CFLAGS) -c -o randtest-randtest.o `test -f 'randtest.c' || echo '$(srcdir)/'`randtest.c
+
+randtest-randtest.obj: randtest.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(randtest_CFLAGS) $(CFLAGS) -MT randtest-randtest.obj -MD -MP -MF $(DEPDIR)/randtest-randtest.Tpo -c -o randtest-randtest.obj `if test -f 'randtest.c'; then $(CYGPATH_W) 'randtest.c'; else $(CYGPATH_W) '$(srcdir)/randtest.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/randtest-randtest.Tpo $(DEPDIR)/randtest-randtest.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='randtest.c' object='randtest-randtest.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(randtest_CFLAGS) $(CFLAGS) -c -o randtest-randtest.obj `if test -f 'randtest.c'; then $(CYGPATH_W) 'randtest.c'; else $(CYGPATH_W) '$(srcdir)/randtest.c'; fi`
+
+retest-retest.o: retest.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(retest_CFLAGS) $(CFLAGS) -MT retest-retest.o -MD -MP -MF $(DEPDIR)/retest-retest.Tpo -c -o retest-retest.o `test -f 'retest.c' || echo '$(srcdir)/'`retest.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/retest-retest.Tpo $(DEPDIR)/retest-retest.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='retest.c' object='retest-retest.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(retest_CFLAGS) $(CFLAGS) -c -o retest-retest.o `test -f 'retest.c' || echo '$(srcdir)/'`retest.c
+
+retest-retest.obj: retest.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(retest_CFLAGS) $(CFLAGS) -MT retest-retest.obj -MD -MP -MF $(DEPDIR)/retest-retest.Tpo -c -o retest-retest.obj `if test -f 'retest.c'; then $(CYGPATH_W) 'retest.c'; else $(CYGPATH_W) '$(srcdir)/retest.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/retest-retest.Tpo $(DEPDIR)/retest-retest.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='retest.c' object='retest-retest.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(retest_CFLAGS) $(CFLAGS) -c -o retest-retest.obj `if test -f 'retest.c'; then $(CYGPATH_W) 'retest.c'; else $(CYGPATH_W) '$(srcdir)/retest.c'; fi`
+
+wretest-retest.o: retest.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(wretest_CPPFLAGS) $(CPPFLAGS) $(wretest_CFLAGS) $(CFLAGS) -MT wretest-retest.o -MD -MP -MF $(DEPDIR)/wretest-retest.Tpo -c -o wretest-retest.o `test -f 'retest.c' || echo '$(srcdir)/'`retest.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/wretest-retest.Tpo $(DEPDIR)/wretest-retest.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='retest.c' object='wretest-retest.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(wretest_CPPFLAGS) $(CPPFLAGS) $(wretest_CFLAGS) $(CFLAGS) -c -o wretest-retest.o `test -f 'retest.c' || echo '$(srcdir)/'`retest.c
+
+wretest-retest.obj: retest.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(wretest_CPPFLAGS) $(CPPFLAGS) $(wretest_CFLAGS) $(CFLAGS) -MT wretest-retest.obj -MD -MP -MF $(DEPDIR)/wretest-retest.Tpo -c -o wretest-retest.obj `if test -f 'retest.c'; then $(CYGPATH_W) 'retest.c'; else $(CYGPATH_W) '$(srcdir)/retest.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/wretest-retest.Tpo $(DEPDIR)/wretest-retest.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='retest.c' object='wretest-retest.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(wretest_CPPFLAGS) $(CPPFLAGS) $(wretest_CFLAGS) $(CFLAGS) -c -o wretest-retest.obj `if test -f 'retest.c'; then $(CYGPATH_W) 'retest.c'; else $(CYGPATH_W) '$(srcdir)/retest.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all tests failed"; \
+ else \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-checkLTLIBRARIES clean-checkPROGRAMS clean-generic \
+ clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-TESTS check-am clean \
+ clean-checkLTLIBRARIES clean-checkPROGRAMS clean-generic \
+ clean-libtool ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/tests/agrep/Makefile b/tests/agrep/Makefile
new file mode 100644
index 0000000000000..14553e6c2b9ec
--- /dev/null
+++ b/tests/agrep/Makefile
@@ -0,0 +1,441 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# tests/agrep/Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+
+pkgdatadir = $(datadir)/tre
+pkglibdir = $(libdir)/tre
+pkgincludedir = $(includedir)/tre
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = x86_64-unknown-freebsd8.0
+host_triplet = x86_64-unknown-freebsd8.0
+target_triplet = x86_64-unknown-freebsd8.0
+subdir = tests/agrep
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_libtool_tags.m4 \
+ $(top_srcdir)/m4/ax_check_funcs_comp.m4 \
+ $(top_srcdir)/m4/ax_check_sign.m4 \
+ $(top_srcdir)/m4/ax_decl_wchar_max.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/m4/vl_prog_cc_warnings.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/utils/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h \
+ $(top_builddir)/lib/tre-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /home/gabor/wrk/tre/tre-0.8.0/utils/missing --run aclocal-1.10
+ALLOCA =
+AMTAR = ${SHELL} /home/gabor/wrk/tre/tre-0.8.0/utils/missing --run tar
+AR = ar
+AS = as
+AUTOCONF = ${SHELL} /home/gabor/wrk/tre/tre-0.8.0/utils/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/gabor/wrk/tre/tre-0.8.0/utils/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/gabor/wrk/tre/tre-0.8.0/utils/missing --run automake-1.10
+AWK = nawk
+CC = gcc
+CCDEPMODE = depmode=gcc3
+CFLAGS = -g -O2 -Wall
+CPP = gcc -E
+CPPFLAGS =
+CYGPATH_W = echo
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+DLLTOOL = dlltool
+DSYMUTIL =
+ECHO = echo
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = /usr/bin/grep -E
+EXEEXT =
+GETTEXT_MACRO_VERSION = 0.17
+GMSGFMT = /usr/local/bin/msgfmt
+GMSGFMT_015 = /usr/local/bin/msgfmt
+GREP = /usr/bin/grep
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
+INTLLIBS =
+INTL_MACOSX_LIBS =
+LDFLAGS =
+LIBICONV = /usr/local/lib/libiconv.so -Wl,-rpath -Wl,/usr/local/lib
+LIBINTL =
+LIBOBJS =
+LIBS =
+LIBTOOL = $(SHELL) $(top_builddir)/libtool
+LN_S = ln -s
+LTLIBICONV = -L/usr/local/lib -liconv -R/usr/local/lib
+LTLIBINTL =
+LTLIBOBJS =
+MAKEINFO = ${SHELL} /home/gabor/wrk/tre/tre-0.8.0/utils/missing --run makeinfo
+MKDIR_P = ../../utils/install-sh -c -d
+MSGFMT = /usr/local/bin/msgfmt
+MSGFMT_015 = /usr/local/bin/msgfmt
+MSGMERGE = /usr/local/bin/msgmerge
+NMEDIT =
+OBJDUMP = objdump
+OBJEXT = o
+PACKAGE = tre
+PACKAGE_BUGREPORT = tre-general@lists.laurikari.net
+PACKAGE_NAME = TRE
+PACKAGE_STRING = TRE 0.8.0
+PACKAGE_TARNAME = tre
+PACKAGE_VERSION = 0.8.0
+PATH_SEPARATOR = :
+POSUB =
+RANLIB = ranlib
+SED = /usr/local/bin/gsed
+SET_MAKE =
+SHELL = /bin/sh
+STRIP = strip
+TRE_VERSION = 0.8.0
+USE_NLS = no
+VERSION = 0.8.0
+XGETTEXT = /usr/local/bin/xgettext
+XGETTEXT_015 = /usr/local/bin/xgettext
+XGETTEXT_EXTRA_OPTIONS =
+abs_builddir = /home/gabor/wrk/tre/tre-0.8.0/tests/agrep
+abs_srcdir = /home/gabor/wrk/tre/tre-0.8.0/tests/agrep
+abs_top_builddir = /home/gabor/wrk/tre/tre-0.8.0
+abs_top_srcdir = /home/gabor/wrk/tre/tre-0.8.0
+ac_ct_CC = gcc
+am__include = include
+am__leading_dot = .
+am__quote =
+am__tar = ${AMTAR} chof - "$$tardir"
+am__untar = ${AMTAR} xf -
+bindir = ${exec_prefix}/bin
+build = x86_64-unknown-freebsd8.0
+build_alias =
+build_cpu = x86_64
+build_os = freebsd8.0
+build_vendor = unknown
+builddir = .
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
+dvidir = ${docdir}
+exec_prefix = ${prefix}
+host = x86_64-unknown-freebsd8.0
+host_alias =
+host_cpu = x86_64
+host_os = freebsd8.0
+host_vendor = unknown
+htmldir = ${docdir}
+includedir = ${prefix}/include
+infodir = ${datarootdir}/info
+install_sh = $(SHELL) /home/gabor/wrk/tre/tre-0.8.0/utils/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localedir = ${datarootdir}/locale
+localstatedir = ${prefix}/var
+mandir = ${datarootdir}/man
+mkdir_p = $(top_builddir)/utils/install-sh -c -d
+oldincludedir = /usr/include
+pdfdir = ${docdir}
+prefix = /usr/local
+program_transform_name = s,x,x,
+psdir = ${docdir}
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+srcdir = .
+sysconfdir = ${prefix}/etc
+target = x86_64-unknown-freebsd8.0
+target_alias =
+target_cpu = x86_64
+target_os = freebsd8.0
+target_vendor = unknown
+top_builddir = ../..
+top_srcdir = ../..
+TESTS = run-tests.sh
+TESTS_ENVIRONMENT = \
+ top_builddir=$(top_builddir) \
+ host_triplet=$(host_triplet)
+
+EXTRA_DIST = run-tests.sh
+CLEANFILES = *.out
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/agrep/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign tests/agrep/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all tests failed"; \
+ else \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
+ dist-hook
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-TESTS check-am clean clean-generic \
+ clean-libtool dist-hook distclean distclean-generic \
+ distclean-libtool distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am
+
+
+dist-hook:
+ cp -p $(srcdir)/*.args $(srcdir)/*.ok $(srcdir)/*.input $(distdir)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/tests/agrep/Makefile.am b/tests/agrep/Makefile.am
new file mode 100644
index 0000000000000..44c547c643eac
--- /dev/null
+++ b/tests/agrep/Makefile.am
@@ -0,0 +1,16 @@
+
+if !TRE_DEBUG
+if TRE_AGREP
+TESTS = run-tests.sh
+endif TRE_AGREP
+endif !TRE_DEBUG
+
+TESTS_ENVIRONMENT = \
+ top_builddir=$(top_builddir) \
+ host_triplet=$(host_triplet)
+EXTRA_DIST = run-tests.sh
+
+dist-hook:
+ cp -p $(srcdir)/*.args $(srcdir)/*.ok $(srcdir)/*.input $(distdir)
+
+CLEANFILES = *.out
diff --git a/tests/agrep/Makefile.in b/tests/agrep/Makefile.in
new file mode 100644
index 0000000000000..2a2d2befd5069
--- /dev/null
+++ b/tests/agrep/Makefile.in
@@ -0,0 +1,441 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = tests/agrep
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_libtool_tags.m4 \
+ $(top_srcdir)/m4/ax_check_funcs_comp.m4 \
+ $(top_srcdir)/m4/ax_check_sign.m4 \
+ $(top_srcdir)/m4/ax_decl_wchar_max.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/m4/vl_prog_cc_warnings.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/utils/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h \
+ $(top_builddir)/lib/tre-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TRE_VERSION = @TRE_VERSION@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+@TRE_AGREP_TRUE@@TRE_DEBUG_FALSE@TESTS = run-tests.sh
+TESTS_ENVIRONMENT = \
+ top_builddir=$(top_builddir) \
+ host_triplet=$(host_triplet)
+
+EXTRA_DIST = run-tests.sh
+CLEANFILES = *.out
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/agrep/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign tests/agrep/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all tests failed"; \
+ else \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
+ dist-hook
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-TESTS check-am clean clean-generic \
+ clean-libtool dist-hook distclean distclean-generic \
+ distclean-libtool distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am
+
+
+dist-hook:
+ cp -p $(srcdir)/*.args $(srcdir)/*.ok $(srcdir)/*.input $(distdir)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/tests/agrep/basic.args b/tests/agrep/basic.args
new file mode 100644
index 0000000000000..97d5ab90f9189
--- /dev/null
+++ b/tests/agrep/basic.args
@@ -0,0 +1,6 @@
+# Very basic tests with simple string searches.
+random
+-v random
+-i extra
+-e -ding
+-w micro
diff --git a/tests/agrep/basic.input b/tests/agrep/basic.input
new file mode 100644
index 0000000000000..54893594570fc
--- /dev/null
+++ b/tests/agrep/basic.input
@@ -0,0 +1,8 @@
+Some random text here.
+Foo bar quux.
+Let's hear an example of correct microphone placing.
+I suppose for something like that one would use a very large number of microphones.
+Extraordinary.
+Take California.
+A-ding-ing-ng-WROOOOM-ding-ding-boing!
+They are micro, mega, mini, mono, and multi.
diff --git a/tests/agrep/basic.ok b/tests/agrep/basic.ok
new file mode 100644
index 0000000000000..58a7fd2c44544
--- /dev/null
+++ b/tests/agrep/basic.ok
@@ -0,0 +1,496 @@
+#### TEST: agrep random basic.in
+Some random text here.
+
+Exit status 0.
+#### TEST: agrep random < basic.in
+Some random text here.
+
+Exit status 0.
+#### TEST: agrep -c random basic.in
+1
+
+Exit status 0.
+#### TEST: agrep -c random < basic.in
+1
+
+Exit status 0.
+#### TEST: agrep -H random basic.in
+basic.in:Some random text here.
+
+Exit status 0.
+#### TEST: agrep -H random < basic.in
+(standard input):Some random text here.
+
+Exit status 0.
+#### TEST: agrep -l random basic.in
+basic.in
+
+Exit status 0.
+#### TEST: agrep -l random < basic.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n random basic.in
+1:Some random text here.
+
+Exit status 0.
+#### TEST: agrep -n random < basic.in
+1:Some random text here.
+
+Exit status 0.
+#### TEST: agrep -s random basic.in
+0:Some random text here.
+
+Exit status 0.
+#### TEST: agrep -s random < basic.in
+0:Some random text here.
+
+Exit status 0.
+#### TEST: agrep -M random basic.in
+Some random text here.
+
+Exit status 0.
+#### TEST: agrep -M random < basic.in
+Some random text here.
+
+Exit status 0.
+#### TEST: agrep --show-position random basic.in
+5-11:Some random text here.
+
+Exit status 0.
+#### TEST: agrep --show-position random < basic.in
+5-11:Some random text here.
+
+Exit status 0.
+#### TEST: agrep --color random basic.in
+Some random text here.
+
+Exit status 0.
+#### TEST: agrep --color random < basic.in
+Some random text here.
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position random basic.in
+basic.in:1:0:5-11:Some random text here.
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position random < basic.in
+(standard input):1:0:5-11:Some random text here.
+
+Exit status 0.
+#### TEST: agrep -v random basic.in
+Foo bar quux.
+Let's hear an example of correct microphone placing.
+I suppose for something like that one would use a very large number of microphones.
+Extraordinary.
+Take California.
+A-ding-ing-ng-WROOOOM-ding-ding-boing!
+They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -v random < basic.in
+Foo bar quux.
+Let's hear an example of correct microphone placing.
+I suppose for something like that one would use a very large number of microphones.
+Extraordinary.
+Take California.
+A-ding-ing-ng-WROOOOM-ding-ding-boing!
+They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -c -v random basic.in
+7
+
+Exit status 0.
+#### TEST: agrep -c -v random < basic.in
+7
+
+Exit status 0.
+#### TEST: agrep -H -v random basic.in
+basic.in:Foo bar quux.
+basic.in:Let's hear an example of correct microphone placing.
+basic.in:I suppose for something like that one would use a very large number of microphones.
+basic.in:Extraordinary.
+basic.in:Take California.
+basic.in:A-ding-ing-ng-WROOOOM-ding-ding-boing!
+basic.in:They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -H -v random < basic.in
+(standard input):Foo bar quux.
+(standard input):Let's hear an example of correct microphone placing.
+(standard input):I suppose for something like that one would use a very large number of microphones.
+(standard input):Extraordinary.
+(standard input):Take California.
+(standard input):A-ding-ing-ng-WROOOOM-ding-ding-boing!
+(standard input):They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -l -v random basic.in
+basic.in
+
+Exit status 0.
+#### TEST: agrep -l -v random < basic.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n -v random basic.in
+2:Foo bar quux.
+3:Let's hear an example of correct microphone placing.
+4:I suppose for something like that one would use a very large number of microphones.
+5:Extraordinary.
+6:Take California.
+7:A-ding-ing-ng-WROOOOM-ding-ding-boing!
+8:They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -n -v random < basic.in
+2:Foo bar quux.
+3:Let's hear an example of correct microphone placing.
+4:I suppose for something like that one would use a very large number of microphones.
+5:Extraordinary.
+6:Take California.
+7:A-ding-ing-ng-WROOOOM-ding-ding-boing!
+8:They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -s -v random basic.in
+0:Foo bar quux.
+0:Let's hear an example of correct microphone placing.
+0:I suppose for something like that one would use a very large number of microphones.
+0:Extraordinary.
+0:Take California.
+0:A-ding-ing-ng-WROOOOM-ding-ding-boing!
+0:They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -s -v random < basic.in
+0:Foo bar quux.
+0:Let's hear an example of correct microphone placing.
+0:I suppose for something like that one would use a very large number of microphones.
+0:Extraordinary.
+0:Take California.
+0:A-ding-ing-ng-WROOOOM-ding-ding-boing!
+0:They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -M -v random basic.in
+Foo bar quux.
+Let's hear an example of correct microphone placing.
+I suppose for something like that one would use a very large number of microphones.
+Extraordinary.
+Take California.
+A-ding-ing-ng-WROOOOM-ding-ding-boing!
+They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -M -v random < basic.in
+Foo bar quux.
+Let's hear an example of correct microphone placing.
+I suppose for something like that one would use a very large number of microphones.
+Extraordinary.
+Take California.
+A-ding-ing-ng-WROOOOM-ding-ding-boing!
+They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep --show-position -v random basic.in
+0-13:Foo bar quux.
+0-52:Let's hear an example of correct microphone placing.
+0-83:I suppose for something like that one would use a very large number of microphones.
+0-14:Extraordinary.
+0-16:Take California.
+0-38:A-ding-ing-ng-WROOOOM-ding-ding-boing!
+0-44:They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep --show-position -v random < basic.in
+0-13:Foo bar quux.
+0-52:Let's hear an example of correct microphone placing.
+0-83:I suppose for something like that one would use a very large number of microphones.
+0-14:Extraordinary.
+0-16:Take California.
+0-38:A-ding-ing-ng-WROOOOM-ding-ding-boing!
+0-44:They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep --color -v random basic.in
+Foo bar quux.
+Let's hear an example of correct microphone placing.
+I suppose for something like that one would use a very large number of microphones.
+Extraordinary.
+Take California.
+A-ding-ing-ng-WROOOOM-ding-ding-boing!
+They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep --color -v random < basic.in
+Foo bar quux.
+Let's hear an example of correct microphone placing.
+I suppose for something like that one would use a very large number of microphones.
+Extraordinary.
+Take California.
+A-ding-ing-ng-WROOOOM-ding-ding-boing!
+They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -v random basic.in
+basic.in:2:0:0-13:Foo bar quux.
+basic.in:3:0:0-52:Let's hear an example of correct microphone placing.
+basic.in:4:0:0-83:I suppose for something like that one would use a very large number of microphones.
+basic.in:5:0:0-14:Extraordinary.
+basic.in:6:0:0-16:Take California.
+basic.in:7:0:0-38:A-ding-ing-ng-WROOOOM-ding-ding-boing!
+basic.in:8:0:0-44:They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -v random < basic.in
+(standard input):2:0:0-13:Foo bar quux.
+(standard input):3:0:0-52:Let's hear an example of correct microphone placing.
+(standard input):4:0:0-83:I suppose for something like that one would use a very large number of microphones.
+(standard input):5:0:0-14:Extraordinary.
+(standard input):6:0:0-16:Take California.
+(standard input):7:0:0-38:A-ding-ing-ng-WROOOOM-ding-ding-boing!
+(standard input):8:0:0-44:They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -i extra basic.in
+Extraordinary.
+
+Exit status 0.
+#### TEST: agrep -i extra < basic.in
+Extraordinary.
+
+Exit status 0.
+#### TEST: agrep -c -i extra basic.in
+1
+
+Exit status 0.
+#### TEST: agrep -c -i extra < basic.in
+1
+
+Exit status 0.
+#### TEST: agrep -H -i extra basic.in
+basic.in:Extraordinary.
+
+Exit status 0.
+#### TEST: agrep -H -i extra < basic.in
+(standard input):Extraordinary.
+
+Exit status 0.
+#### TEST: agrep -l -i extra basic.in
+basic.in
+
+Exit status 0.
+#### TEST: agrep -l -i extra < basic.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n -i extra basic.in
+5:Extraordinary.
+
+Exit status 0.
+#### TEST: agrep -n -i extra < basic.in
+5:Extraordinary.
+
+Exit status 0.
+#### TEST: agrep -s -i extra basic.in
+0:Extraordinary.
+
+Exit status 0.
+#### TEST: agrep -s -i extra < basic.in
+0:Extraordinary.
+
+Exit status 0.
+#### TEST: agrep -M -i extra basic.in
+Extraordinary.
+
+Exit status 0.
+#### TEST: agrep -M -i extra < basic.in
+Extraordinary.
+
+Exit status 0.
+#### TEST: agrep --show-position -i extra basic.in
+0-5:Extraordinary.
+
+Exit status 0.
+#### TEST: agrep --show-position -i extra < basic.in
+0-5:Extraordinary.
+
+Exit status 0.
+#### TEST: agrep --color -i extra basic.in
+Extraordinary.
+
+Exit status 0.
+#### TEST: agrep --color -i extra < basic.in
+Extraordinary.
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -i extra basic.in
+basic.in:5:0:0-5:Extraordinary.
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -i extra < basic.in
+(standard input):5:0:0-5:Extraordinary.
+
+Exit status 0.
+#### TEST: agrep -e -ding basic.in
+A-ding-ing-ng-WROOOOM-ding-ding-boing!
+
+Exit status 0.
+#### TEST: agrep -e -ding < basic.in
+A-ding-ing-ng-WROOOOM-ding-ding-boing!
+
+Exit status 0.
+#### TEST: agrep -c -e -ding basic.in
+1
+
+Exit status 0.
+#### TEST: agrep -c -e -ding < basic.in
+1
+
+Exit status 0.
+#### TEST: agrep -H -e -ding basic.in
+basic.in:A-ding-ing-ng-WROOOOM-ding-ding-boing!
+
+Exit status 0.
+#### TEST: agrep -H -e -ding < basic.in
+(standard input):A-ding-ing-ng-WROOOOM-ding-ding-boing!
+
+Exit status 0.
+#### TEST: agrep -l -e -ding basic.in
+basic.in
+
+Exit status 0.
+#### TEST: agrep -l -e -ding < basic.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n -e -ding basic.in
+7:A-ding-ing-ng-WROOOOM-ding-ding-boing!
+
+Exit status 0.
+#### TEST: agrep -n -e -ding < basic.in
+7:A-ding-ing-ng-WROOOOM-ding-ding-boing!
+
+Exit status 0.
+#### TEST: agrep -s -e -ding basic.in
+0:A-ding-ing-ng-WROOOOM-ding-ding-boing!
+
+Exit status 0.
+#### TEST: agrep -s -e -ding < basic.in
+0:A-ding-ing-ng-WROOOOM-ding-ding-boing!
+
+Exit status 0.
+#### TEST: agrep -M -e -ding basic.in
+A-ding-ing-ng-WROOOOM-ding-ding-boing!
+
+Exit status 0.
+#### TEST: agrep -M -e -ding < basic.in
+A-ding-ing-ng-WROOOOM-ding-ding-boing!
+
+Exit status 0.
+#### TEST: agrep --show-position -e -ding basic.in
+1-6:A-ding-ing-ng-WROOOOM-ding-ding-boing!
+
+Exit status 0.
+#### TEST: agrep --show-position -e -ding < basic.in
+1-6:A-ding-ing-ng-WROOOOM-ding-ding-boing!
+
+Exit status 0.
+#### TEST: agrep --color -e -ding basic.in
+A-ding-ing-ng-WROOOOM-ding-ding-boing!
+
+Exit status 0.
+#### TEST: agrep --color -e -ding < basic.in
+A-ding-ing-ng-WROOOOM-ding-ding-boing!
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -e -ding basic.in
+basic.in:7:0:1-6:A-ding-ing-ng-WROOOOM-ding-ding-boing!
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -e -ding < basic.in
+(standard input):7:0:1-6:A-ding-ing-ng-WROOOOM-ding-ding-boing!
+
+Exit status 0.
+#### TEST: agrep -w micro basic.in
+They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -w micro < basic.in
+They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -c -w micro basic.in
+1
+
+Exit status 0.
+#### TEST: agrep -c -w micro < basic.in
+1
+
+Exit status 0.
+#### TEST: agrep -H -w micro basic.in
+basic.in:They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -H -w micro < basic.in
+(standard input):They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -l -w micro basic.in
+basic.in
+
+Exit status 0.
+#### TEST: agrep -l -w micro < basic.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n -w micro basic.in
+8:They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -n -w micro < basic.in
+8:They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -s -w micro basic.in
+0:They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -s -w micro < basic.in
+0:They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -M -w micro basic.in
+They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -M -w micro < basic.in
+They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep --show-position -w micro basic.in
+9-14:They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep --show-position -w micro < basic.in
+9-14:They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep --color -w micro basic.in
+They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep --color -w micro < basic.in
+They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -w micro basic.in
+basic.in:8:0:9-14:They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -w micro < basic.in
+(standard input):8:0:9-14:They are micro, mega, mini, mono, and multi.
+
+Exit status 0.
diff --git a/tests/agrep/delimiters.args b/tests/agrep/delimiters.args
new file mode 100644
index 0000000000000..949a3fa9deba3
--- /dev/null
+++ b/tests/agrep/delimiters.args
@@ -0,0 +1,9 @@
+# There used to be a bug in agrep where the record delimiter was
+# considered to be part of the record, causing '$' at the end of the
+# regexp to work in an unexpected way.
+^foobar$
+foobar$
+^foobar
+foobar
+-d X ^xyzzy$
+-d X -M ^xyzzy$
diff --git a/tests/agrep/delimiters.input b/tests/agrep/delimiters.input
new file mode 100644
index 0000000000000..c128d4d19afeb
--- /dev/null
+++ b/tests/agrep/delimiters.input
@@ -0,0 +1,5 @@
+xfoobarx
+xfoobar
+foobarx
+foobar
+XtadaaXxyzzyXX
diff --git a/tests/agrep/delimiters.ok b/tests/agrep/delimiters.ok
new file mode 100644
index 0000000000000..c7ae82c5924e3
--- /dev/null
+++ b/tests/agrep/delimiters.ok
@@ -0,0 +1,528 @@
+#### TEST: agrep ^foobar$ delimiters.in
+foobar
+
+Exit status 0.
+#### TEST: agrep ^foobar$ < delimiters.in
+foobar
+
+Exit status 0.
+#### TEST: agrep -c ^foobar$ delimiters.in
+1
+
+Exit status 0.
+#### TEST: agrep -c ^foobar$ < delimiters.in
+1
+
+Exit status 0.
+#### TEST: agrep -H ^foobar$ delimiters.in
+delimiters.in:foobar
+
+Exit status 0.
+#### TEST: agrep -H ^foobar$ < delimiters.in
+(standard input):foobar
+
+Exit status 0.
+#### TEST: agrep -l ^foobar$ delimiters.in
+delimiters.in
+
+Exit status 0.
+#### TEST: agrep -l ^foobar$ < delimiters.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n ^foobar$ delimiters.in
+4:foobar
+
+Exit status 0.
+#### TEST: agrep -n ^foobar$ < delimiters.in
+4:foobar
+
+Exit status 0.
+#### TEST: agrep -s ^foobar$ delimiters.in
+0:foobar
+
+Exit status 0.
+#### TEST: agrep -s ^foobar$ < delimiters.in
+0:foobar
+
+Exit status 0.
+#### TEST: agrep -M ^foobar$ delimiters.in
+foobar
+
+Exit status 0.
+#### TEST: agrep -M ^foobar$ < delimiters.in
+foobar
+
+Exit status 0.
+#### TEST: agrep --show-position ^foobar$ delimiters.in
+0-6:foobar
+
+Exit status 0.
+#### TEST: agrep --show-position ^foobar$ < delimiters.in
+0-6:foobar
+
+Exit status 0.
+#### TEST: agrep --color ^foobar$ delimiters.in
+foobar
+
+Exit status 0.
+#### TEST: agrep --color ^foobar$ < delimiters.in
+foobar
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position ^foobar$ delimiters.in
+delimiters.in:4:0:0-6:foobar
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position ^foobar$ < delimiters.in
+(standard input):4:0:0-6:foobar
+
+Exit status 0.
+#### TEST: agrep foobar$ delimiters.in
+xfoobar
+foobar
+
+Exit status 0.
+#### TEST: agrep foobar$ < delimiters.in
+xfoobar
+foobar
+
+Exit status 0.
+#### TEST: agrep -c foobar$ delimiters.in
+2
+
+Exit status 0.
+#### TEST: agrep -c foobar$ < delimiters.in
+2
+
+Exit status 0.
+#### TEST: agrep -H foobar$ delimiters.in
+delimiters.in:xfoobar
+delimiters.in:foobar
+
+Exit status 0.
+#### TEST: agrep -H foobar$ < delimiters.in
+(standard input):xfoobar
+(standard input):foobar
+
+Exit status 0.
+#### TEST: agrep -l foobar$ delimiters.in
+delimiters.in
+
+Exit status 0.
+#### TEST: agrep -l foobar$ < delimiters.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n foobar$ delimiters.in
+2:xfoobar
+4:foobar
+
+Exit status 0.
+#### TEST: agrep -n foobar$ < delimiters.in
+2:xfoobar
+4:foobar
+
+Exit status 0.
+#### TEST: agrep -s foobar$ delimiters.in
+0:xfoobar
+0:foobar
+
+Exit status 0.
+#### TEST: agrep -s foobar$ < delimiters.in
+0:xfoobar
+0:foobar
+
+Exit status 0.
+#### TEST: agrep -M foobar$ delimiters.in
+xfoobar
+foobar
+
+Exit status 0.
+#### TEST: agrep -M foobar$ < delimiters.in
+xfoobar
+foobar
+
+Exit status 0.
+#### TEST: agrep --show-position foobar$ delimiters.in
+1-7:xfoobar
+0-6:foobar
+
+Exit status 0.
+#### TEST: agrep --show-position foobar$ < delimiters.in
+1-7:xfoobar
+0-6:foobar
+
+Exit status 0.
+#### TEST: agrep --color foobar$ delimiters.in
+xfoobar
+foobar
+
+Exit status 0.
+#### TEST: agrep --color foobar$ < delimiters.in
+xfoobar
+foobar
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position foobar$ delimiters.in
+delimiters.in:2:0:1-7:xfoobar
+delimiters.in:4:0:0-6:foobar
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position foobar$ < delimiters.in
+(standard input):2:0:1-7:xfoobar
+(standard input):4:0:0-6:foobar
+
+Exit status 0.
+#### TEST: agrep ^foobar delimiters.in
+foobarx
+foobar
+
+Exit status 0.
+#### TEST: agrep ^foobar < delimiters.in
+foobarx
+foobar
+
+Exit status 0.
+#### TEST: agrep -c ^foobar delimiters.in
+2
+
+Exit status 0.
+#### TEST: agrep -c ^foobar < delimiters.in
+2
+
+Exit status 0.
+#### TEST: agrep -H ^foobar delimiters.in
+delimiters.in:foobarx
+delimiters.in:foobar
+
+Exit status 0.
+#### TEST: agrep -H ^foobar < delimiters.in
+(standard input):foobarx
+(standard input):foobar
+
+Exit status 0.
+#### TEST: agrep -l ^foobar delimiters.in
+delimiters.in
+
+Exit status 0.
+#### TEST: agrep -l ^foobar < delimiters.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n ^foobar delimiters.in
+3:foobarx
+4:foobar
+
+Exit status 0.
+#### TEST: agrep -n ^foobar < delimiters.in
+3:foobarx
+4:foobar
+
+Exit status 0.
+#### TEST: agrep -s ^foobar delimiters.in
+0:foobarx
+0:foobar
+
+Exit status 0.
+#### TEST: agrep -s ^foobar < delimiters.in
+0:foobarx
+0:foobar
+
+Exit status 0.
+#### TEST: agrep -M ^foobar delimiters.in
+foobarx
+foobar
+
+Exit status 0.
+#### TEST: agrep -M ^foobar < delimiters.in
+foobarx
+foobar
+
+Exit status 0.
+#### TEST: agrep --show-position ^foobar delimiters.in
+0-6:foobarx
+0-6:foobar
+
+Exit status 0.
+#### TEST: agrep --show-position ^foobar < delimiters.in
+0-6:foobarx
+0-6:foobar
+
+Exit status 0.
+#### TEST: agrep --color ^foobar delimiters.in
+foobarx
+foobar
+
+Exit status 0.
+#### TEST: agrep --color ^foobar < delimiters.in
+foobarx
+foobar
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position ^foobar delimiters.in
+delimiters.in:3:0:0-6:foobarx
+delimiters.in:4:0:0-6:foobar
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position ^foobar < delimiters.in
+(standard input):3:0:0-6:foobarx
+(standard input):4:0:0-6:foobar
+
+Exit status 0.
+#### TEST: agrep foobar delimiters.in
+xfoobarx
+xfoobar
+foobarx
+foobar
+
+Exit status 0.
+#### TEST: agrep foobar < delimiters.in
+xfoobarx
+xfoobar
+foobarx
+foobar
+
+Exit status 0.
+#### TEST: agrep -c foobar delimiters.in
+4
+
+Exit status 0.
+#### TEST: agrep -c foobar < delimiters.in
+4
+
+Exit status 0.
+#### TEST: agrep -H foobar delimiters.in
+delimiters.in:xfoobarx
+delimiters.in:xfoobar
+delimiters.in:foobarx
+delimiters.in:foobar
+
+Exit status 0.
+#### TEST: agrep -H foobar < delimiters.in
+(standard input):xfoobarx
+(standard input):xfoobar
+(standard input):foobarx
+(standard input):foobar
+
+Exit status 0.
+#### TEST: agrep -l foobar delimiters.in
+delimiters.in
+
+Exit status 0.
+#### TEST: agrep -l foobar < delimiters.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n foobar delimiters.in
+1:xfoobarx
+2:xfoobar
+3:foobarx
+4:foobar
+
+Exit status 0.
+#### TEST: agrep -n foobar < delimiters.in
+1:xfoobarx
+2:xfoobar
+3:foobarx
+4:foobar
+
+Exit status 0.
+#### TEST: agrep -s foobar delimiters.in
+0:xfoobarx
+0:xfoobar
+0:foobarx
+0:foobar
+
+Exit status 0.
+#### TEST: agrep -s foobar < delimiters.in
+0:xfoobarx
+0:xfoobar
+0:foobarx
+0:foobar
+
+Exit status 0.
+#### TEST: agrep -M foobar delimiters.in
+xfoobarx
+xfoobar
+foobarx
+foobar
+
+Exit status 0.
+#### TEST: agrep -M foobar < delimiters.in
+xfoobarx
+xfoobar
+foobarx
+foobar
+
+Exit status 0.
+#### TEST: agrep --show-position foobar delimiters.in
+1-7:xfoobarx
+1-7:xfoobar
+0-6:foobarx
+0-6:foobar
+
+Exit status 0.
+#### TEST: agrep --show-position foobar < delimiters.in
+1-7:xfoobarx
+1-7:xfoobar
+0-6:foobarx
+0-6:foobar
+
+Exit status 0.
+#### TEST: agrep --color foobar delimiters.in
+xfoobarx
+xfoobar
+foobarx
+foobar
+
+Exit status 0.
+#### TEST: agrep --color foobar < delimiters.in
+xfoobarx
+xfoobar
+foobarx
+foobar
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position foobar delimiters.in
+delimiters.in:1:0:1-7:xfoobarx
+delimiters.in:2:0:1-7:xfoobar
+delimiters.in:3:0:0-6:foobarx
+delimiters.in:4:0:0-6:foobar
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position foobar < delimiters.in
+(standard input):1:0:1-7:xfoobarx
+(standard input):2:0:1-7:xfoobar
+(standard input):3:0:0-6:foobarx
+(standard input):4:0:0-6:foobar
+
+Exit status 0.
+#### TEST: agrep -d X ^xyzzy$ delimiters.in
+Xxyzzy
+Exit status 0.
+#### TEST: agrep -d X ^xyzzy$ < delimiters.in
+Xxyzzy
+Exit status 0.
+#### TEST: agrep -c -d X ^xyzzy$ delimiters.in
+1
+
+Exit status 0.
+#### TEST: agrep -c -d X ^xyzzy$ < delimiters.in
+1
+
+Exit status 0.
+#### TEST: agrep -H -d X ^xyzzy$ delimiters.in
+delimiters.in:Xxyzzy
+Exit status 0.
+#### TEST: agrep -H -d X ^xyzzy$ < delimiters.in
+(standard input):Xxyzzy
+Exit status 0.
+#### TEST: agrep -l -d X ^xyzzy$ delimiters.in
+delimiters.in
+
+Exit status 0.
+#### TEST: agrep -l -d X ^xyzzy$ < delimiters.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n -d X ^xyzzy$ delimiters.in
+3:Xxyzzy
+Exit status 0.
+#### TEST: agrep -n -d X ^xyzzy$ < delimiters.in
+3:Xxyzzy
+Exit status 0.
+#### TEST: agrep -s -d X ^xyzzy$ delimiters.in
+0:Xxyzzy
+Exit status 0.
+#### TEST: agrep -s -d X ^xyzzy$ < delimiters.in
+0:Xxyzzy
+Exit status 0.
+#### TEST: agrep -M -d X ^xyzzy$ delimiters.in
+xyzzyX
+Exit status 0.
+#### TEST: agrep -M -d X ^xyzzy$ < delimiters.in
+xyzzyX
+Exit status 0.
+#### TEST: agrep --show-position -d X ^xyzzy$ delimiters.in
+0-5:Xxyzzy
+Exit status 0.
+#### TEST: agrep --show-position -d X ^xyzzy$ < delimiters.in
+0-5:Xxyzzy
+Exit status 0.
+#### TEST: agrep --color -d X ^xyzzy$ delimiters.in
+Xxyzzy
+Exit status 0.
+#### TEST: agrep --color -d X ^xyzzy$ < delimiters.in
+Xxyzzy
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -d X ^xyzzy$ delimiters.in
+delimiters.in:3:0:0-5:Xxyzzy
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -d X ^xyzzy$ < delimiters.in
+(standard input):3:0:0-5:Xxyzzy
+Exit status 0.
+#### TEST: agrep -d X -M ^xyzzy$ delimiters.in
+xyzzyX
+Exit status 0.
+#### TEST: agrep -d X -M ^xyzzy$ < delimiters.in
+xyzzyX
+Exit status 0.
+#### TEST: agrep -c -d X -M ^xyzzy$ delimiters.in
+1
+
+Exit status 0.
+#### TEST: agrep -c -d X -M ^xyzzy$ < delimiters.in
+1
+
+Exit status 0.
+#### TEST: agrep -H -d X -M ^xyzzy$ delimiters.in
+delimiters.in:xyzzyX
+Exit status 0.
+#### TEST: agrep -H -d X -M ^xyzzy$ < delimiters.in
+(standard input):xyzzyX
+Exit status 0.
+#### TEST: agrep -l -d X -M ^xyzzy$ delimiters.in
+delimiters.in
+
+Exit status 0.
+#### TEST: agrep -l -d X -M ^xyzzy$ < delimiters.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n -d X -M ^xyzzy$ delimiters.in
+3:xyzzyX
+Exit status 0.
+#### TEST: agrep -n -d X -M ^xyzzy$ < delimiters.in
+3:xyzzyX
+Exit status 0.
+#### TEST: agrep -s -d X -M ^xyzzy$ delimiters.in
+0:xyzzyX
+Exit status 0.
+#### TEST: agrep -s -d X -M ^xyzzy$ < delimiters.in
+0:xyzzyX
+Exit status 0.
+#### TEST: agrep -M -d X -M ^xyzzy$ delimiters.in
+xyzzyX
+Exit status 0.
+#### TEST: agrep -M -d X -M ^xyzzy$ < delimiters.in
+xyzzyX
+Exit status 0.
+#### TEST: agrep --show-position -d X -M ^xyzzy$ delimiters.in
+0-5:xyzzyX
+Exit status 0.
+#### TEST: agrep --show-position -d X -M ^xyzzy$ < delimiters.in
+0-5:xyzzyX
+Exit status 0.
+#### TEST: agrep --color -d X -M ^xyzzy$ delimiters.in
+xyzzyX
+Exit status 0.
+#### TEST: agrep --color -d X -M ^xyzzy$ < delimiters.in
+xyzzyX
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -d X -M ^xyzzy$ delimiters.in
+delimiters.in:3:0:0-5:xyzzyX
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -d X -M ^xyzzy$ < delimiters.in
+(standard input):3:0:0-5:xyzzyX
+Exit status 0.
diff --git a/tests/agrep/exitstatus.args b/tests/agrep/exitstatus.args
new file mode 100644
index 0000000000000..808ae77561256
--- /dev/null
+++ b/tests/agrep/exitstatus.args
@@ -0,0 +1,10 @@
+this-will-be-found
+-v this-will-be-found
+this-wont-be-found
+-v this-wont-be-found
+.
+-v .
+# Some errors which should give exit status 2.
+-d .* dummy
+-d {1 dummy
+\
diff --git a/tests/agrep/exitstatus.input b/tests/agrep/exitstatus.input
new file mode 100644
index 0000000000000..c70a3febfcb12
--- /dev/null
+++ b/tests/agrep/exitstatus.input
@@ -0,0 +1,3 @@
+this-will-be-found
+so will this
+just some stuff
diff --git a/tests/agrep/exitstatus.ok b/tests/agrep/exitstatus.ok
new file mode 100644
index 0000000000000..28427bbba6c38
--- /dev/null
+++ b/tests/agrep/exitstatus.ok
@@ -0,0 +1,705 @@
+#### TEST: agrep this-will-be-found exitstatus.in
+this-will-be-found
+
+Exit status 0.
+#### TEST: agrep this-will-be-found < exitstatus.in
+this-will-be-found
+
+Exit status 0.
+#### TEST: agrep -c this-will-be-found exitstatus.in
+1
+
+Exit status 0.
+#### TEST: agrep -c this-will-be-found < exitstatus.in
+1
+
+Exit status 0.
+#### TEST: agrep -H this-will-be-found exitstatus.in
+exitstatus.in:this-will-be-found
+
+Exit status 0.
+#### TEST: agrep -H this-will-be-found < exitstatus.in
+(standard input):this-will-be-found
+
+Exit status 0.
+#### TEST: agrep -l this-will-be-found exitstatus.in
+exitstatus.in
+
+Exit status 0.
+#### TEST: agrep -l this-will-be-found < exitstatus.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n this-will-be-found exitstatus.in
+1:this-will-be-found
+
+Exit status 0.
+#### TEST: agrep -n this-will-be-found < exitstatus.in
+1:this-will-be-found
+
+Exit status 0.
+#### TEST: agrep -s this-will-be-found exitstatus.in
+0:this-will-be-found
+
+Exit status 0.
+#### TEST: agrep -s this-will-be-found < exitstatus.in
+0:this-will-be-found
+
+Exit status 0.
+#### TEST: agrep -M this-will-be-found exitstatus.in
+this-will-be-found
+
+Exit status 0.
+#### TEST: agrep -M this-will-be-found < exitstatus.in
+this-will-be-found
+
+Exit status 0.
+#### TEST: agrep --show-position this-will-be-found exitstatus.in
+0-18:this-will-be-found
+
+Exit status 0.
+#### TEST: agrep --show-position this-will-be-found < exitstatus.in
+0-18:this-will-be-found
+
+Exit status 0.
+#### TEST: agrep --color this-will-be-found exitstatus.in
+this-will-be-found
+
+Exit status 0.
+#### TEST: agrep --color this-will-be-found < exitstatus.in
+this-will-be-found
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position this-will-be-found exitstatus.in
+exitstatus.in:1:0:0-18:this-will-be-found
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position this-will-be-found < exitstatus.in
+(standard input):1:0:0-18:this-will-be-found
+
+Exit status 0.
+#### TEST: agrep -v this-will-be-found exitstatus.in
+so will this
+just some stuff
+
+Exit status 0.
+#### TEST: agrep -v this-will-be-found < exitstatus.in
+so will this
+just some stuff
+
+Exit status 0.
+#### TEST: agrep -c -v this-will-be-found exitstatus.in
+2
+
+Exit status 0.
+#### TEST: agrep -c -v this-will-be-found < exitstatus.in
+2
+
+Exit status 0.
+#### TEST: agrep -H -v this-will-be-found exitstatus.in
+exitstatus.in:so will this
+exitstatus.in:just some stuff
+
+Exit status 0.
+#### TEST: agrep -H -v this-will-be-found < exitstatus.in
+(standard input):so will this
+(standard input):just some stuff
+
+Exit status 0.
+#### TEST: agrep -l -v this-will-be-found exitstatus.in
+exitstatus.in
+
+Exit status 0.
+#### TEST: agrep -l -v this-will-be-found < exitstatus.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n -v this-will-be-found exitstatus.in
+2:so will this
+3:just some stuff
+
+Exit status 0.
+#### TEST: agrep -n -v this-will-be-found < exitstatus.in
+2:so will this
+3:just some stuff
+
+Exit status 0.
+#### TEST: agrep -s -v this-will-be-found exitstatus.in
+0:so will this
+0:just some stuff
+
+Exit status 0.
+#### TEST: agrep -s -v this-will-be-found < exitstatus.in
+0:so will this
+0:just some stuff
+
+Exit status 0.
+#### TEST: agrep -M -v this-will-be-found exitstatus.in
+so will this
+just some stuff
+
+Exit status 0.
+#### TEST: agrep -M -v this-will-be-found < exitstatus.in
+so will this
+just some stuff
+
+Exit status 0.
+#### TEST: agrep --show-position -v this-will-be-found exitstatus.in
+0-12:so will this
+0-15:just some stuff
+
+Exit status 0.
+#### TEST: agrep --show-position -v this-will-be-found < exitstatus.in
+0-12:so will this
+0-15:just some stuff
+
+Exit status 0.
+#### TEST: agrep --color -v this-will-be-found exitstatus.in
+so will this
+just some stuff
+
+Exit status 0.
+#### TEST: agrep --color -v this-will-be-found < exitstatus.in
+so will this
+just some stuff
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -v this-will-be-found exitstatus.in
+exitstatus.in:2:0:0-12:so will this
+exitstatus.in:3:0:0-15:just some stuff
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -v this-will-be-found < exitstatus.in
+(standard input):2:0:0-12:so will this
+(standard input):3:0:0-15:just some stuff
+
+Exit status 0.
+#### TEST: agrep this-wont-be-found exitstatus.in
+
+Exit status 1.
+#### TEST: agrep this-wont-be-found < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -c this-wont-be-found exitstatus.in
+0
+
+Exit status 1.
+#### TEST: agrep -c this-wont-be-found < exitstatus.in
+0
+
+Exit status 1.
+#### TEST: agrep -H this-wont-be-found exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -H this-wont-be-found < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -l this-wont-be-found exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -l this-wont-be-found < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -n this-wont-be-found exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -n this-wont-be-found < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -s this-wont-be-found exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -s this-wont-be-found < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -M this-wont-be-found exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -M this-wont-be-found < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep --show-position this-wont-be-found exitstatus.in
+
+Exit status 1.
+#### TEST: agrep --show-position this-wont-be-found < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep --color this-wont-be-found exitstatus.in
+
+Exit status 1.
+#### TEST: agrep --color this-wont-be-found < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -H -n -s --color --show-position this-wont-be-found exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -H -n -s --color --show-position this-wont-be-found < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -v this-wont-be-found exitstatus.in
+this-will-be-found
+so will this
+just some stuff
+
+Exit status 0.
+#### TEST: agrep -v this-wont-be-found < exitstatus.in
+this-will-be-found
+so will this
+just some stuff
+
+Exit status 0.
+#### TEST: agrep -c -v this-wont-be-found exitstatus.in
+3
+
+Exit status 0.
+#### TEST: agrep -c -v this-wont-be-found < exitstatus.in
+3
+
+Exit status 0.
+#### TEST: agrep -H -v this-wont-be-found exitstatus.in
+exitstatus.in:this-will-be-found
+exitstatus.in:so will this
+exitstatus.in:just some stuff
+
+Exit status 0.
+#### TEST: agrep -H -v this-wont-be-found < exitstatus.in
+(standard input):this-will-be-found
+(standard input):so will this
+(standard input):just some stuff
+
+Exit status 0.
+#### TEST: agrep -l -v this-wont-be-found exitstatus.in
+exitstatus.in
+
+Exit status 0.
+#### TEST: agrep -l -v this-wont-be-found < exitstatus.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n -v this-wont-be-found exitstatus.in
+1:this-will-be-found
+2:so will this
+3:just some stuff
+
+Exit status 0.
+#### TEST: agrep -n -v this-wont-be-found < exitstatus.in
+1:this-will-be-found
+2:so will this
+3:just some stuff
+
+Exit status 0.
+#### TEST: agrep -s -v this-wont-be-found exitstatus.in
+0:this-will-be-found
+0:so will this
+0:just some stuff
+
+Exit status 0.
+#### TEST: agrep -s -v this-wont-be-found < exitstatus.in
+0:this-will-be-found
+0:so will this
+0:just some stuff
+
+Exit status 0.
+#### TEST: agrep -M -v this-wont-be-found exitstatus.in
+this-will-be-found
+so will this
+just some stuff
+
+Exit status 0.
+#### TEST: agrep -M -v this-wont-be-found < exitstatus.in
+this-will-be-found
+so will this
+just some stuff
+
+Exit status 0.
+#### TEST: agrep --show-position -v this-wont-be-found exitstatus.in
+0-18:this-will-be-found
+0-12:so will this
+0-15:just some stuff
+
+Exit status 0.
+#### TEST: agrep --show-position -v this-wont-be-found < exitstatus.in
+0-18:this-will-be-found
+0-12:so will this
+0-15:just some stuff
+
+Exit status 0.
+#### TEST: agrep --color -v this-wont-be-found exitstatus.in
+this-will-be-found
+so will this
+just some stuff
+
+Exit status 0.
+#### TEST: agrep --color -v this-wont-be-found < exitstatus.in
+this-will-be-found
+so will this
+just some stuff
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -v this-wont-be-found exitstatus.in
+exitstatus.in:1:0:0-18:this-will-be-found
+exitstatus.in:2:0:0-12:so will this
+exitstatus.in:3:0:0-15:just some stuff
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -v this-wont-be-found < exitstatus.in
+(standard input):1:0:0-18:this-will-be-found
+(standard input):2:0:0-12:so will this
+(standard input):3:0:0-15:just some stuff
+
+Exit status 0.
+#### TEST: agrep . exitstatus.in
+this-will-be-found
+so will this
+just some stuff
+
+Exit status 0.
+#### TEST: agrep . < exitstatus.in
+this-will-be-found
+so will this
+just some stuff
+
+Exit status 0.
+#### TEST: agrep -c . exitstatus.in
+3
+
+Exit status 0.
+#### TEST: agrep -c . < exitstatus.in
+3
+
+Exit status 0.
+#### TEST: agrep -H . exitstatus.in
+exitstatus.in:this-will-be-found
+exitstatus.in:so will this
+exitstatus.in:just some stuff
+
+Exit status 0.
+#### TEST: agrep -H . < exitstatus.in
+(standard input):this-will-be-found
+(standard input):so will this
+(standard input):just some stuff
+
+Exit status 0.
+#### TEST: agrep -l . exitstatus.in
+exitstatus.in
+
+Exit status 0.
+#### TEST: agrep -l . < exitstatus.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n . exitstatus.in
+1:this-will-be-found
+2:so will this
+3:just some stuff
+
+Exit status 0.
+#### TEST: agrep -n . < exitstatus.in
+1:this-will-be-found
+2:so will this
+3:just some stuff
+
+Exit status 0.
+#### TEST: agrep -s . exitstatus.in
+0:this-will-be-found
+0:so will this
+0:just some stuff
+
+Exit status 0.
+#### TEST: agrep -s . < exitstatus.in
+0:this-will-be-found
+0:so will this
+0:just some stuff
+
+Exit status 0.
+#### TEST: agrep -M . exitstatus.in
+this-will-be-found
+so will this
+just some stuff
+
+Exit status 0.
+#### TEST: agrep -M . < exitstatus.in
+this-will-be-found
+so will this
+just some stuff
+
+Exit status 0.
+#### TEST: agrep --show-position . exitstatus.in
+0-1:this-will-be-found
+0-1:so will this
+0-1:just some stuff
+
+Exit status 0.
+#### TEST: agrep --show-position . < exitstatus.in
+0-1:this-will-be-found
+0-1:so will this
+0-1:just some stuff
+
+Exit status 0.
+#### TEST: agrep --color . exitstatus.in
+this-will-be-found
+so will this
+just some stuff
+
+Exit status 0.
+#### TEST: agrep --color . < exitstatus.in
+this-will-be-found
+so will this
+just some stuff
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position . exitstatus.in
+exitstatus.in:1:0:0-1:this-will-be-found
+exitstatus.in:2:0:0-1:so will this
+exitstatus.in:3:0:0-1:just some stuff
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position . < exitstatus.in
+(standard input):1:0:0-1:this-will-be-found
+(standard input):2:0:0-1:so will this
+(standard input):3:0:0-1:just some stuff
+
+Exit status 0.
+#### TEST: agrep -v . exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -v . < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -c -v . exitstatus.in
+0
+
+Exit status 1.
+#### TEST: agrep -c -v . < exitstatus.in
+0
+
+Exit status 1.
+#### TEST: agrep -H -v . exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -H -v . < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -l -v . exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -l -v . < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -n -v . exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -n -v . < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -s -v . exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -s -v . < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -M -v . exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -M -v . < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep --show-position -v . exitstatus.in
+
+Exit status 1.
+#### TEST: agrep --show-position -v . < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep --color -v . exitstatus.in
+
+Exit status 1.
+#### TEST: agrep --color -v . < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -H -n -s --color --show-position -v . exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -H -n -s --color --show-position -v . < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -d .* dummy exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -d .* dummy < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -c -d .* dummy exitstatus.in
+exitstatus.in:0
+
+Exit status 1.
+#### TEST: agrep -c -d .* dummy < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -H -d .* dummy exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -H -d .* dummy < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -l -d .* dummy exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -l -d .* dummy < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -n -d .* dummy exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -n -d .* dummy < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -s -d .* dummy exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -s -d .* dummy < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -M -d .* dummy exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -M -d .* dummy < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep --show-position -d .* dummy exitstatus.in
+
+Exit status 1.
+#### TEST: agrep --show-position -d .* dummy < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep --color -d .* dummy exitstatus.in
+
+Exit status 1.
+#### TEST: agrep --color -d .* dummy < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -H -n -s --color --show-position -d .* dummy exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -H -n -s --color --show-position -d .* dummy < exitstatus.in
+
+Exit status 1.
+#### TEST: agrep -d {1 dummy exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -d {1 dummy < exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -c -d {1 dummy exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -c -d {1 dummy < exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -H -d {1 dummy exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -H -d {1 dummy < exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -l -d {1 dummy exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -l -d {1 dummy < exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -n -d {1 dummy exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -n -d {1 dummy < exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -s -d {1 dummy exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -s -d {1 dummy < exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -M -d {1 dummy exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -M -d {1 dummy < exitstatus.in
+
+Exit status 2.
+#### TEST: agrep --show-position -d {1 dummy exitstatus.in
+
+Exit status 2.
+#### TEST: agrep --show-position -d {1 dummy < exitstatus.in
+
+Exit status 2.
+#### TEST: agrep --color -d {1 dummy exitstatus.in
+
+Exit status 2.
+#### TEST: agrep --color -d {1 dummy < exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -H -n -s --color --show-position -d {1 dummy exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -H -n -s --color --show-position -d {1 dummy < exitstatus.in
+
+Exit status 2.
+#### TEST: agrep \ exitstatus.in
+
+Exit status 2.
+#### TEST: agrep \ < exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -c \ exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -c \ < exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -H \ exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -H \ < exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -l \ exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -l \ < exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -n \ exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -n \ < exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -s \ exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -s \ < exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -M \ exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -M \ < exitstatus.in
+
+Exit status 2.
+#### TEST: agrep --show-position \ exitstatus.in
+
+Exit status 2.
+#### TEST: agrep --show-position \ < exitstatus.in
+
+Exit status 2.
+#### TEST: agrep --color \ exitstatus.in
+
+Exit status 2.
+#### TEST: agrep --color \ < exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -H -n -s --color --show-position \ exitstatus.in
+
+Exit status 2.
+#### TEST: agrep -H -n -s --color --show-position \ < exitstatus.in
+
+Exit status 2.
diff --git a/tests/agrep/records.args b/tests/agrep/records.args
new file mode 100644
index 0000000000000..b3c5e522c41c0
--- /dev/null
+++ b/tests/agrep/records.args
@@ -0,0 +1,9 @@
+# Find words which contain the letter 'a'.
+-d \s+ a
+# Find words which contain a capital letter.
+-d \s+ [A-Z]
+# Find sentences which contain certain words.
+-d \.\s+ -M error
+-d \.\s+ -M default
+# Find paragraphs which contain "PATTERN".
+-d \n\n -M PATTERN
diff --git a/tests/agrep/records.input b/tests/agrep/records.input
new file mode 100644
index 0000000000000..03c6b618b48f9
--- /dev/null
+++ b/tests/agrep/records.input
@@ -0,0 +1,23 @@
+Force PATTERN to match only whole words. A "whole word" is a
+substring which either starts at the beginning or the record or is
+preceded by a non-word constituent character. Similarly, the
+substring must either end at the end of the record or be followed by a
+non-word constituent character. Word-constituent characters are
+alphanumerics (as defined by the current locale) and the underscore
+character. Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+Set cost of incorrect characters to NUM. Note that a deletion (a
+missing character) and an insertion (an extra character) together
+constitute a substituted character, but the cost will be the that of a
+deletion and an insertion added together. Thus, if the const of a
+substitution is set to be larger than the sum of the costs of deletion
+and insertion, direct substitutions will never be done.
+
+Set the record delimiter regular expression to PATTERN. The text
+between two delimiters, before the first delimiter, and after the last
+delimiter is considered to be a record. The default record delimiter
+is the regexp "\n", so by default a record is a line. PATTERN can be
+any regular expression that does not match the empty string. For
+example, using -d "^From " defines mail messages as records in a
+Mailbox format file.
diff --git a/tests/agrep/records.ok b/tests/agrep/records.ok
new file mode 100644
index 0000000000000..9e05f9fe1f40f
--- /dev/null
+++ b/tests/agrep/records.ok
@@ -0,0 +1,812 @@
+#### TEST: agrep -d \s+ a records.in
+ match a starts at a character. Similarly, at a character. characters are
+alphanumerics (as locale) and
+character. that characters match; cannot as characters that a (a character) and an (an extra character) a character, that a and an added a larger than
+and regular and after last a default default a a can
+any regular that match
+example, mail messages as a
+Mailbox format
+Exit status 0.
+#### TEST: agrep -d \s+ a < records.in
+ match a starts at a character. Similarly, at a character. characters are
+alphanumerics (as locale) and
+character. that characters match; cannot as characters that a (a character) and an (an extra character) a character, that a and an added a larger than
+and regular and after last a default default a a can
+any regular that match
+example, mail messages as a
+Mailbox format
+Exit status 0.
+#### TEST: agrep -c -d \s+ a records.in
+64
+
+Exit status 0.
+#### TEST: agrep -c -d \s+ a < records.in
+64
+
+Exit status 0.
+#### TEST: agrep -H -d \s+ a records.in
+records.in: matchrecords.in: arecords.in: startsrecords.in: atrecords.in: arecords.in: character.records.in: Similarly,records.in: atrecords.in: arecords.in: character.records.in: charactersrecords.in: arerecords.in:
+alphanumericsrecords.in: (asrecords.in: locale)records.in: andrecords.in:
+character.records.in: thatrecords.in: charactersrecords.in: match;records.in: cannotrecords.in: asrecords.in: charactersrecords.in: thatrecords.in: arecords.in: (arecords.in: character)records.in: andrecords.in: anrecords.in: (anrecords.in: extrarecords.in: character)records.in: arecords.in: character,records.in: thatrecords.in: arecords.in: andrecords.in: anrecords.in: addedrecords.in: arecords.in: largerrecords.in: thanrecords.in:
+andrecords.in: regularrecords.in: andrecords.in: afterrecords.in: lastrecords.in: arecords.in: defaultrecords.in: defaultrecords.in: arecords.in: arecords.in: canrecords.in:
+anyrecords.in: regularrecords.in: thatrecords.in: matchrecords.in:
+example,records.in: mailrecords.in: messagesrecords.in: asrecords.in: arecords.in:
+Mailboxrecords.in: format
+Exit status 0.
+#### TEST: agrep -H -d \s+ a < records.in
+(standard input): match(standard input): a(standard input): starts(standard input): at(standard input): a(standard input): character.(standard input): Similarly,(standard input): at(standard input): a(standard input): character.(standard input): characters(standard input): are(standard input):
+alphanumerics(standard input): (as(standard input): locale)(standard input): and(standard input):
+character.(standard input): that(standard input): characters(standard input): match;(standard input): cannot(standard input): as(standard input): characters(standard input): that(standard input): a(standard input): (a(standard input): character)(standard input): and(standard input): an(standard input): (an(standard input): extra(standard input): character)(standard input): a(standard input): character,(standard input): that(standard input): a(standard input): and(standard input): an(standard input): added(standard input): a(standard input): larger(standard input): than(standard input):
+and(standard input): regular(standard input): and(standard input): after(standard input): last(standard input): a(standard input): default(standard input): default(standard input): a(standard input): a(standard input): can(standard input):
+any(standard input): regular(standard input): that(standard input): match(standard input):
+example,(standard input): mail(standard input): messages(standard input): as(standard input): a(standard input):
+Mailbox(standard input): format
+Exit status 0.
+#### TEST: agrep -l -d \s+ a records.in
+records.in
+
+Exit status 0.
+#### TEST: agrep -l -d \s+ a < records.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n -d \s+ a records.in
+4: match12: a16: starts17: at27: a30: character.31: Similarly,37: at47: a50: character.52: characters53: are54:
+alphanumerics55: (as60: locale)61: and64:
+character.66: that70: characters74: match;76: cannot79: as85: characters89: that90: a92: (a94: character)95: and96: an98: (an99: extra100: character)103: a105: character,112: that114: a116: and117: an119: added126: a132: larger133: than141:
+and153: regular166: and167: after169: last175: a178: default187: default188: a191: a194: can196:
+any197: regular199: that202: match207:
+example,213: mail214: messages215: as218: a219:
+Mailbox220: format
+Exit status 0.
+#### TEST: agrep -n -d \s+ a < records.in
+4: match12: a16: starts17: at27: a30: character.31: Similarly,37: at47: a50: character.52: characters53: are54:
+alphanumerics55: (as60: locale)61: and64:
+character.66: that70: characters74: match;76: cannot79: as85: characters89: that90: a92: (a94: character)95: and96: an98: (an99: extra100: character)103: a105: character,112: that114: a116: and117: an119: added126: a132: larger133: than141:
+and153: regular166: and167: after169: last175: a178: default187: default188: a191: a194: can196:
+any197: regular199: that202: match207:
+example,213: mail214: messages215: as218: a219:
+Mailbox220: format
+Exit status 0.
+#### TEST: agrep -s -d \s+ a records.in
+0: match0: a0: starts0: at0: a0: character.0: Similarly,0: at0: a0: character.0: characters0: are0:
+alphanumerics0: (as0: locale)0: and0:
+character.0: that0: characters0: match;0: cannot0: as0: characters0: that0: a0: (a0: character)0: and0: an0: (an0: extra0: character)0: a0: character,0: that0: a0: and0: an0: added0: a0: larger0: than0:
+and0: regular0: and0: after0: last0: a0: default0: default0: a0: a0: can0:
+any0: regular0: that0: match0:
+example,0: mail0: messages0: as0: a0:
+Mailbox0: format
+Exit status 0.
+#### TEST: agrep -s -d \s+ a < records.in
+0: match0: a0: starts0: at0: a0: character.0: Similarly,0: at0: a0: character.0: characters0: are0:
+alphanumerics0: (as0: locale)0: and0:
+character.0: that0: characters0: match;0: cannot0: as0: characters0: that0: a0: (a0: character)0: and0: an0: (an0: extra0: character)0: a0: character,0: that0: a0: and0: an0: added0: a0: larger0: than0:
+and0: regular0: and0: after0: last0: a0: default0: default0: a0: a0: can0:
+any0: regular0: that0: match0:
+example,0: mail0: messages0: as0: a0:
+Mailbox0: format
+Exit status 0.
+#### TEST: agrep -M -d \s+ a records.in
+match a
+starts at a character. Similarly, at a
+character. characters are
+alphanumerics (as locale) and character. that characters match; cannot as characters that a (a
+character) and an (an extra character) a character, that a
+and an added a
+larger than and regular and after last
+a default default a a can any regular that match example, mail messages as a
+Mailbox format
+Exit status 0.
+#### TEST: agrep -M -d \s+ a < records.in
+match a
+starts at a character. Similarly, at a
+character. characters are
+alphanumerics (as locale) and character. that characters match; cannot as characters that a (a
+character) and an (an extra character) a character, that a
+and an added a
+larger than and regular and after last
+a default default a a can any regular that match example, mail messages as a
+Mailbox format
+Exit status 0.
+#### TEST: agrep --show-position -d \s+ a records.in
+1-2: match0-1: a2-3: starts0-1: at0-1: a2-3: character.5-6: Similarly,0-1: at0-1: a2-3: character.2-3: characters0-1: are0-1:
+alphanumerics1-2: (as3-4: locale)0-1: and2-3:
+character.2-3: that2-3: characters1-2: match;1-2: cannot0-1: as2-3: characters2-3: that0-1: a1-2: (a2-3: character)0-1: and0-1: an1-2: (an4-5: extra2-3: character)0-1: a2-3: character,2-3: that0-1: a0-1: and0-1: an0-1: added0-1: a1-2: larger2-3: than0-1:
+and5-6: regular0-1: and0-1: after1-2: last0-1: a3-4: default3-4: default0-1: a0-1: a1-2: can0-1:
+any5-6: regular2-3: that1-2: match2-3:
+example,1-2: mail4-5: messages0-1: as0-1: a1-2:
+Mailbox4-5: format
+Exit status 0.
+#### TEST: agrep --show-position -d \s+ a < records.in
+1-2: match0-1: a2-3: starts0-1: at0-1: a2-3: character.5-6: Similarly,0-1: at0-1: a2-3: character.2-3: characters0-1: are0-1:
+alphanumerics1-2: (as3-4: locale)0-1: and2-3:
+character.2-3: that2-3: characters1-2: match;1-2: cannot0-1: as2-3: characters2-3: that0-1: a1-2: (a2-3: character)0-1: and0-1: an1-2: (an4-5: extra2-3: character)0-1: a2-3: character,2-3: that0-1: a0-1: and0-1: an0-1: added0-1: a1-2: larger2-3: than0-1:
+and5-6: regular0-1: and0-1: after1-2: last0-1: a3-4: default3-4: default0-1: a0-1: a1-2: can0-1:
+any5-6: regular2-3: that1-2: match2-3:
+example,1-2: mail4-5: messages0-1: as0-1: a1-2:
+Mailbox4-5: format
+Exit status 0.
+#### TEST: agrep --color -d \s+ a records.in
+ match a starts at a character. Similarly, at a character. characters are
+alphanumerics (as locale) and
+character. that characters match; cannot as characters that a (a character) and an (an extra character) a character, that a and an added a larger than
+and regular and after last a default default a a can
+any regular that match
+example, mail messages as a
+Mailbox format
+Exit status 0.
+#### TEST: agrep --color -d \s+ a < records.in
+ match a starts at a character. Similarly, at a character. characters are
+alphanumerics (as locale) and
+character. that characters match; cannot as characters that a (a character) and an (an extra character) a character, that a and an added a larger than
+and regular and after last a default default a a can
+any regular that match
+example, mail messages as a
+Mailbox format
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -d \s+ a records.in
+records.in:4:0:1-2: matchrecords.in:12:0:0-1: arecords.in:16:0:2-3: startsrecords.in:17:0:0-1: atrecords.in:27:0:0-1: arecords.in:30:0:2-3: character.records.in:31:0:5-6: Similarly,records.in:37:0:0-1: atrecords.in:47:0:0-1: arecords.in:50:0:2-3: character.records.in:52:0:2-3: charactersrecords.in:53:0:0-1: arerecords.in:54:0:0-1:
+alphanumericsrecords.in:55:0:1-2: (asrecords.in:60:0:3-4: locale)records.in:61:0:0-1: andrecords.in:64:0:2-3:
+character.records.in:66:0:2-3: thatrecords.in:70:0:2-3: charactersrecords.in:74:0:1-2: match;records.in:76:0:1-2: cannotrecords.in:79:0:0-1: asrecords.in:85:0:2-3: charactersrecords.in:89:0:2-3: thatrecords.in:90:0:0-1: arecords.in:92:0:1-2: (arecords.in:94:0:2-3: character)records.in:95:0:0-1: andrecords.in:96:0:0-1: anrecords.in:98:0:1-2: (anrecords.in:99:0:4-5: extrarecords.in:100:0:2-3: character)records.in:103:0:0-1: arecords.in:105:0:2-3: character,records.in:112:0:2-3: thatrecords.in:114:0:0-1: arecords.in:116:0:0-1: andrecords.in:117:0:0-1: anrecords.in:119:0:0-1: addedrecords.in:126:0:0-1: arecords.in:132:0:1-2: largerrecords.in:133:0:2-3: thanrecords.in:141:0:0-1:
+andrecords.in:153:0:5-6: regularrecords.in:166:0:0-1: andrecords.in:167:0:0-1: afterrecords.in:169:0:1-2: lastrecords.in:175:0:0-1: arecords.in:178:0:3-4: defaultrecords.in:187:0:3-4: defaultrecords.in:188:0:0-1: arecords.in:191:0:0-1: arecords.in:194:0:1-2: canrecords.in:196:0:0-1:
+anyrecords.in:197:0:5-6: regularrecords.in:199:0:2-3: thatrecords.in:202:0:1-2: matchrecords.in:207:0:2-3:
+example,records.in:213:0:1-2: mailrecords.in:214:0:4-5: messagesrecords.in:215:0:0-1: asrecords.in:218:0:0-1: arecords.in:219:0:1-2:
+Mailboxrecords.in:220:0:4-5: format
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -d \s+ a < records.in
+(standard input):4:0:1-2: match(standard input):12:0:0-1: a(standard input):16:0:2-3: starts(standard input):17:0:0-1: at(standard input):27:0:0-1: a(standard input):30:0:2-3: character.(standard input):31:0:5-6: Similarly,(standard input):37:0:0-1: at(standard input):47:0:0-1: a(standard input):50:0:2-3: character.(standard input):52:0:2-3: characters(standard input):53:0:0-1: are(standard input):54:0:0-1:
+alphanumerics(standard input):55:0:1-2: (as(standard input):60:0:3-4: locale)(standard input):61:0:0-1: and(standard input):64:0:2-3:
+character.(standard input):66:0:2-3: that(standard input):70:0:2-3: characters(standard input):74:0:1-2: match;(standard input):76:0:1-2: cannot(standard input):79:0:0-1: as(standard input):85:0:2-3: characters(standard input):89:0:2-3: that(standard input):90:0:0-1: a(standard input):92:0:1-2: (a(standard input):94:0:2-3: character)(standard input):95:0:0-1: and(standard input):96:0:0-1: an(standard input):98:0:1-2: (an(standard input):99:0:4-5: extra(standard input):100:0:2-3: character)(standard input):103:0:0-1: a(standard input):105:0:2-3: character,(standard input):112:0:2-3: that(standard input):114:0:0-1: a(standard input):116:0:0-1: and(standard input):117:0:0-1: an(standard input):119:0:0-1: added(standard input):126:0:0-1: a(standard input):132:0:1-2: larger(standard input):133:0:2-3: than(standard input):141:0:0-1:
+and(standard input):153:0:5-6: regular(standard input):166:0:0-1: and(standard input):167:0:0-1: after(standard input):169:0:1-2: last(standard input):175:0:0-1: a(standard input):178:0:3-4: default(standard input):187:0:3-4: default(standard input):188:0:0-1: a(standard input):191:0:0-1: a(standard input):194:0:1-2: can(standard input):196:0:0-1:
+any(standard input):197:0:5-6: regular(standard input):199:0:2-3: that(standard input):202:0:1-2: match(standard input):207:0:2-3:
+example,(standard input):213:0:1-2: mail(standard input):214:0:4-5: messages(standard input):215:0:0-1: as(standard input):218:0:0-1: a(standard input):219:0:1-2:
+Mailbox(standard input):220:0:4-5: format
+Exit status 0.
+#### TEST: agrep -d \s+ [A-Z] records.in
+Force PATTERN A Similarly, Word-constituent Note
+
+Set NUM. Note Thus,
+
+Set PATTERN. The The PATTERN For "^From
+Mailbox
+Exit status 0.
+#### TEST: agrep -d \s+ [A-Z] < records.in
+Force PATTERN A Similarly, Word-constituent Note
+
+Set NUM. Note Thus,
+
+Set PATTERN. The The PATTERN For "^From
+Mailbox
+Exit status 0.
+#### TEST: agrep -c -d \s+ [A-Z] records.in
+18
+
+Exit status 0.
+#### TEST: agrep -c -d \s+ [A-Z] < records.in
+18
+
+Exit status 0.
+#### TEST: agrep -H -d \s+ [A-Z] records.in
+records.in:Forcerecords.in: PATTERNrecords.in: Arecords.in: Similarly,records.in: Word-constituentrecords.in: Noterecords.in:
+
+Setrecords.in: NUM.records.in: Noterecords.in: Thus,records.in:
+
+Setrecords.in: PATTERN.records.in: Therecords.in: Therecords.in: PATTERNrecords.in: Forrecords.in: "^Fromrecords.in:
+Mailbox
+Exit status 0.
+#### TEST: agrep -H -d \s+ [A-Z] < records.in
+(standard input):Force(standard input): PATTERN(standard input): A(standard input): Similarly,(standard input): Word-constituent(standard input): Note(standard input):
+
+Set(standard input): NUM.(standard input): Note(standard input): Thus,(standard input):
+
+Set(standard input): PATTERN.(standard input): The(standard input): The(standard input): PATTERN(standard input): For(standard input): "^From(standard input):
+Mailbox
+Exit status 0.
+#### TEST: agrep -l -d \s+ [A-Z] records.in
+records.in
+
+Exit status 0.
+#### TEST: agrep -l -d \s+ [A-Z] < records.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n -d \s+ [A-Z] records.in
+1:Force2: PATTERN8: A31: Similarly,51: Word-constituent65: Note81:
+
+Set87: NUM.88: Note121: Thus,149:
+
+Set156: PATTERN.157: The177: The193: PATTERN206: For210: "^From219:
+Mailbox
+Exit status 0.
+#### TEST: agrep -n -d \s+ [A-Z] < records.in
+1:Force2: PATTERN8: A31: Similarly,51: Word-constituent65: Note81:
+
+Set87: NUM.88: Note121: Thus,149:
+
+Set156: PATTERN.157: The177: The193: PATTERN206: For210: "^From219:
+Mailbox
+Exit status 0.
+#### TEST: agrep -s -d \s+ [A-Z] records.in
+0:Force0: PATTERN0: A0: Similarly,0: Word-constituent0: Note0:
+
+Set0: NUM.0: Note0: Thus,0:
+
+Set0: PATTERN.0: The0: The0: PATTERN0: For0: "^From0:
+Mailbox
+Exit status 0.
+#### TEST: agrep -s -d \s+ [A-Z] < records.in
+0:Force0: PATTERN0: A0: Similarly,0: Word-constituent0: Note0:
+
+Set0: NUM.0: Note0: Thus,0:
+
+Set0: PATTERN.0: The0: The0: PATTERN0: For0: "^From0:
+Mailbox
+Exit status 0.
+#### TEST: agrep -M -d \s+ [A-Z] records.in
+Force PATTERN A Similarly, Word-constituent Note Set NUM. Note Thus, Set PATTERN. The The PATTERN For
+"^From Mailbox
+Exit status 0.
+#### TEST: agrep -M -d \s+ [A-Z] < records.in
+Force PATTERN A Similarly, Word-constituent Note Set NUM. Note Thus, Set PATTERN. The The PATTERN For
+"^From Mailbox
+Exit status 0.
+#### TEST: agrep --show-position -d \s+ [A-Z] records.in
+0-1:Force0-1: PATTERN0-1: A0-1: Similarly,0-1: Word-constituent0-1: Note0-1:
+
+Set0-1: NUM.0-1: Note0-1: Thus,0-1:
+
+Set0-1: PATTERN.0-1: The0-1: The0-1: PATTERN0-1: For2-3: "^From0-1:
+Mailbox
+Exit status 0.
+#### TEST: agrep --show-position -d \s+ [A-Z] < records.in
+0-1:Force0-1: PATTERN0-1: A0-1: Similarly,0-1: Word-constituent0-1: Note0-1:
+
+Set0-1: NUM.0-1: Note0-1: Thus,0-1:
+
+Set0-1: PATTERN.0-1: The0-1: The0-1: PATTERN0-1: For2-3: "^From0-1:
+Mailbox
+Exit status 0.
+#### TEST: agrep --color -d \s+ [A-Z] records.in
+Force PATTERN A Similarly, Word-constituent Note
+
+Set NUM. Note Thus,
+
+Set PATTERN. The The PATTERN For "^From
+Mailbox
+Exit status 0.
+#### TEST: agrep --color -d \s+ [A-Z] < records.in
+Force PATTERN A Similarly, Word-constituent Note
+
+Set NUM. Note Thus,
+
+Set PATTERN. The The PATTERN For "^From
+Mailbox
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -d \s+ [A-Z] records.in
+records.in:1:0:0-1:Forcerecords.in:2:0:0-1: PATTERNrecords.in:8:0:0-1: Arecords.in:31:0:0-1: Similarly,records.in:51:0:0-1: Word-constituentrecords.in:65:0:0-1: Noterecords.in:81:0:0-1:
+
+Setrecords.in:87:0:0-1: NUM.records.in:88:0:0-1: Noterecords.in:121:0:0-1: Thus,records.in:149:0:0-1:
+
+Setrecords.in:156:0:0-1: PATTERN.records.in:157:0:0-1: Therecords.in:177:0:0-1: Therecords.in:193:0:0-1: PATTERNrecords.in:206:0:0-1: Forrecords.in:210:0:2-3: "^Fromrecords.in:219:0:0-1:
+Mailbox
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -d \s+ [A-Z] < records.in
+(standard input):1:0:0-1:Force(standard input):2:0:0-1: PATTERN(standard input):8:0:0-1: A(standard input):31:0:0-1: Similarly,(standard input):51:0:0-1: Word-constituent(standard input):65:0:0-1: Note(standard input):81:0:0-1:
+
+Set(standard input):87:0:0-1: NUM.(standard input):88:0:0-1: Note(standard input):121:0:0-1: Thus,(standard input):149:0:0-1:
+
+Set(standard input):156:0:0-1: PATTERN.(standard input):157:0:0-1: The(standard input):177:0:0-1: The(standard input):193:0:0-1: PATTERN(standard input):206:0:0-1: For(standard input):210:0:2-3: "^From(standard input):219:0:0-1:
+Mailbox
+Exit status 0.
+#### TEST: agrep -d \.\s+ -M error records.in
+Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+
+Exit status 0.
+#### TEST: agrep -d \.\s+ -M error < records.in
+Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+
+Exit status 0.
+#### TEST: agrep -c -d \.\s+ -M error records.in
+1
+
+Exit status 0.
+#### TEST: agrep -c -d \.\s+ -M error < records.in
+1
+
+Exit status 0.
+#### TEST: agrep -H -d \.\s+ -M error records.in
+records.in:Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+
+Exit status 0.
+#### TEST: agrep -H -d \.\s+ -M error < records.in
+(standard input):Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+
+Exit status 0.
+#### TEST: agrep -l -d \.\s+ -M error records.in
+records.in
+
+Exit status 0.
+#### TEST: agrep -l -d \.\s+ -M error < records.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n -d \.\s+ -M error records.in
+5:Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+
+Exit status 0.
+#### TEST: agrep -n -d \.\s+ -M error < records.in
+5:Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+
+Exit status 0.
+#### TEST: agrep -s -d \.\s+ -M error records.in
+0:Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+
+Exit status 0.
+#### TEST: agrep -s -d \.\s+ -M error < records.in
+0:Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+
+Exit status 0.
+#### TEST: agrep -M -d \.\s+ -M error records.in
+Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+
+Exit status 0.
+#### TEST: agrep -M -d \.\s+ -M error < records.in
+Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+
+Exit status 0.
+#### TEST: agrep --show-position -d \.\s+ -M error records.in
+97-102:Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+
+Exit status 0.
+#### TEST: agrep --show-position -d \.\s+ -M error < records.in
+97-102:Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+
+Exit status 0.
+#### TEST: agrep --color -d \.\s+ -M error records.in
+Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+
+Exit status 0.
+#### TEST: agrep --color -d \.\s+ -M error < records.in
+Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -d \.\s+ -M error records.in
+records.in:5:0:97-102:Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -d \.\s+ -M error < records.in
+(standard input):5:0:97-102:Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+
+Exit status 0.
+#### TEST: agrep -d \.\s+ -M default records.in
+The default record delimiter
+is the regexp "\n", so by default a record is a line.
+Exit status 0.
+#### TEST: agrep -d \.\s+ -M default < records.in
+The default record delimiter
+is the regexp "\n", so by default a record is a line.
+Exit status 0.
+#### TEST: agrep -c -d \.\s+ -M default records.in
+1
+
+Exit status 0.
+#### TEST: agrep -c -d \.\s+ -M default < records.in
+1
+
+Exit status 0.
+#### TEST: agrep -H -d \.\s+ -M default records.in
+records.in:The default record delimiter
+is the regexp "\n", so by default a record is a line.
+Exit status 0.
+#### TEST: agrep -H -d \.\s+ -M default < records.in
+(standard input):The default record delimiter
+is the regexp "\n", so by default a record is a line.
+Exit status 0.
+#### TEST: agrep -l -d \.\s+ -M default records.in
+records.in
+
+Exit status 0.
+#### TEST: agrep -l -d \.\s+ -M default < records.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n -d \.\s+ -M default records.in
+11:The default record delimiter
+is the regexp "\n", so by default a record is a line.
+Exit status 0.
+#### TEST: agrep -n -d \.\s+ -M default < records.in
+11:The default record delimiter
+is the regexp "\n", so by default a record is a line.
+Exit status 0.
+#### TEST: agrep -s -d \.\s+ -M default records.in
+0:The default record delimiter
+is the regexp "\n", so by default a record is a line.
+Exit status 0.
+#### TEST: agrep -s -d \.\s+ -M default < records.in
+0:The default record delimiter
+is the regexp "\n", so by default a record is a line.
+Exit status 0.
+#### TEST: agrep -M -d \.\s+ -M default records.in
+The default record delimiter
+is the regexp "\n", so by default a record is a line.
+Exit status 0.
+#### TEST: agrep -M -d \.\s+ -M default < records.in
+The default record delimiter
+is the regexp "\n", so by default a record is a line.
+Exit status 0.
+#### TEST: agrep --show-position -d \.\s+ -M default records.in
+4-11:The default record delimiter
+is the regexp "\n", so by default a record is a line.
+Exit status 0.
+#### TEST: agrep --show-position -d \.\s+ -M default < records.in
+4-11:The default record delimiter
+is the regexp "\n", so by default a record is a line.
+Exit status 0.
+#### TEST: agrep --color -d \.\s+ -M default records.in
+The default record delimiter
+is the regexp "\n", so by default a record is a line.
+Exit status 0.
+#### TEST: agrep --color -d \.\s+ -M default < records.in
+The default record delimiter
+is the regexp "\n", so by default a record is a line.
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -d \.\s+ -M default records.in
+records.in:11:0:4-11:The default record delimiter
+is the regexp "\n", so by default a record is a line.
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -d \.\s+ -M default < records.in
+(standard input):11:0:4-11:The default record delimiter
+is the regexp "\n", so by default a record is a line.
+Exit status 0.
+#### TEST: agrep -d \n\n -M PATTERN records.in
+Force PATTERN to match only whole words. A "whole word" is a
+substring which either starts at the beginning or the record or is
+preceded by a non-word constituent character. Similarly, the
+substring must either end at the end of the record or be followed by a
+non-word constituent character. Word-constituent characters are
+alphanumerics (as defined by the current locale) and the underscore
+character. Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+Set the record delimiter regular expression to PATTERN. The text
+between two delimiters, before the first delimiter, and after the last
+delimiter is considered to be a record. The default record delimiter
+is the regexp "\n", so by default a record is a line. PATTERN can be
+any regular expression that does not match the empty string. For
+example, using -d "^From " defines mail messages as records in a
+Mailbox format file.
+ c
+Exit status 0.
+#### TEST: agrep -d \n\n -M PATTERN < records.in
+Force PATTERN to match only whole words. A "whole word" is a
+substring which either starts at the beginning or the record or is
+preceded by a non-word constituent character. Similarly, the
+substring must either end at the end of the record or be followed by a
+non-word constituent character. Word-constituent characters are
+alphanumerics (as defined by the current locale) and the underscore
+character. Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+Set the record delimiter regular expression to PATTERN. The text
+between two delimiters, before the first delimiter, and after the last
+delimiter is considered to be a record. The default record delimiter
+is the regexp "\n", so by default a record is a line. PATTERN can be
+any regular expression that does not match the empty string. For
+example, using -d "^From " defines mail messages as records in a
+Mailbox format file.
+ c
+Exit status 0.
+#### TEST: agrep -c -d \n\n -M PATTERN records.in
+2
+
+Exit status 0.
+#### TEST: agrep -c -d \n\n -M PATTERN < records.in
+2
+
+Exit status 0.
+#### TEST: agrep -H -d \n\n -M PATTERN records.in
+records.in:Force PATTERN to match only whole words. A "whole word" is a
+substring which either starts at the beginning or the record or is
+preceded by a non-word constituent character. Similarly, the
+substring must either end at the end of the record or be followed by a
+non-word constituent character. Word-constituent characters are
+alphanumerics (as defined by the current locale) and the underscore
+character. Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+records.in:Set the record delimiter regular expression to PATTERN. The text
+between two delimiters, before the first delimiter, and after the last
+delimiter is considered to be a record. The default record delimiter
+is the regexp "\n", so by default a record is a line. PATTERN can be
+any regular expression that does not match the empty string. For
+example, using -d "^From " defines mail messages as records in a
+Mailbox format file.
+ c
+Exit status 0.
+#### TEST: agrep -H -d \n\n -M PATTERN < records.in
+(standard input):Force PATTERN to match only whole words. A "whole word" is a
+substring which either starts at the beginning or the record or is
+preceded by a non-word constituent character. Similarly, the
+substring must either end at the end of the record or be followed by a
+non-word constituent character. Word-constituent characters are
+alphanumerics (as defined by the current locale) and the underscore
+character. Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+(standard input):Set the record delimiter regular expression to PATTERN. The text
+between two delimiters, before the first delimiter, and after the last
+delimiter is considered to be a record. The default record delimiter
+is the regexp "\n", so by default a record is a line. PATTERN can be
+any regular expression that does not match the empty string. For
+example, using -d "^From " defines mail messages as records in a
+Mailbox format file.
+ c
+Exit status 0.
+#### TEST: agrep -l -d \n\n -M PATTERN records.in
+records.in
+
+Exit status 0.
+#### TEST: agrep -l -d \n\n -M PATTERN < records.in
+(standard input)
+
+Exit status 0.
+#### TEST: agrep -n -d \n\n -M PATTERN records.in
+1:Force PATTERN to match only whole words. A "whole word" is a
+substring which either starts at the beginning or the record or is
+preceded by a non-word constituent character. Similarly, the
+substring must either end at the end of the record or be followed by a
+non-word constituent character. Word-constituent characters are
+alphanumerics (as defined by the current locale) and the underscore
+character. Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+3:Set the record delimiter regular expression to PATTERN. The text
+between two delimiters, before the first delimiter, and after the last
+delimiter is considered to be a record. The default record delimiter
+is the regexp "\n", so by default a record is a line. PATTERN can be
+any regular expression that does not match the empty string. For
+example, using -d "^From " defines mail messages as records in a
+Mailbox format file.
+ c
+Exit status 0.
+#### TEST: agrep -n -d \n\n -M PATTERN < records.in
+1:Force PATTERN to match only whole words. A "whole word" is a
+substring which either starts at the beginning or the record or is
+preceded by a non-word constituent character. Similarly, the
+substring must either end at the end of the record or be followed by a
+non-word constituent character. Word-constituent characters are
+alphanumerics (as defined by the current locale) and the underscore
+character. Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+3:Set the record delimiter regular expression to PATTERN. The text
+between two delimiters, before the first delimiter, and after the last
+delimiter is considered to be a record. The default record delimiter
+is the regexp "\n", so by default a record is a line. PATTERN can be
+any regular expression that does not match the empty string. For
+example, using -d "^From " defines mail messages as records in a
+Mailbox format file.
+ c
+Exit status 0.
+#### TEST: agrep -s -d \n\n -M PATTERN records.in
+0:Force PATTERN to match only whole words. A "whole word" is a
+substring which either starts at the beginning or the record or is
+preceded by a non-word constituent character. Similarly, the
+substring must either end at the end of the record or be followed by a
+non-word constituent character. Word-constituent characters are
+alphanumerics (as defined by the current locale) and the underscore
+character. Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+0:Set the record delimiter regular expression to PATTERN. The text
+between two delimiters, before the first delimiter, and after the last
+delimiter is considered to be a record. The default record delimiter
+is the regexp "\n", so by default a record is a line. PATTERN can be
+any regular expression that does not match the empty string. For
+example, using -d "^From " defines mail messages as records in a
+Mailbox format file.
+ c
+Exit status 0.
+#### TEST: agrep -s -d \n\n -M PATTERN < records.in
+0:Force PATTERN to match only whole words. A "whole word" is a
+substring which either starts at the beginning or the record or is
+preceded by a non-word constituent character. Similarly, the
+substring must either end at the end of the record or be followed by a
+non-word constituent character. Word-constituent characters are
+alphanumerics (as defined by the current locale) and the underscore
+character. Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+0:Set the record delimiter regular expression to PATTERN. The text
+between two delimiters, before the first delimiter, and after the last
+delimiter is considered to be a record. The default record delimiter
+is the regexp "\n", so by default a record is a line. PATTERN can be
+any regular expression that does not match the empty string. For
+example, using -d "^From " defines mail messages as records in a
+Mailbox format file.
+ c
+Exit status 0.
+#### TEST: agrep -M -d \n\n -M PATTERN records.in
+Force PATTERN to match only whole words. A "whole word" is a
+substring which either starts at the beginning or the record or is
+preceded by a non-word constituent character. Similarly, the
+substring must either end at the end of the record or be followed by a
+non-word constituent character. Word-constituent characters are
+alphanumerics (as defined by the current locale) and the underscore
+character. Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+Set the record delimiter regular expression to PATTERN. The text
+between two delimiters, before the first delimiter, and after the last
+delimiter is considered to be a record. The default record delimiter
+is the regexp "\n", so by default a record is a line. PATTERN can be
+any regular expression that does not match the empty string. For
+example, using -d "^From " defines mail messages as records in a
+Mailbox format file.
+ c
+Exit status 0.
+#### TEST: agrep -M -d \n\n -M PATTERN < records.in
+Force PATTERN to match only whole words. A "whole word" is a
+substring which either starts at the beginning or the record or is
+preceded by a non-word constituent character. Similarly, the
+substring must either end at the end of the record or be followed by a
+non-word constituent character. Word-constituent characters are
+alphanumerics (as defined by the current locale) and the underscore
+character. Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+Set the record delimiter regular expression to PATTERN. The text
+between two delimiters, before the first delimiter, and after the last
+delimiter is considered to be a record. The default record delimiter
+is the regexp "\n", so by default a record is a line. PATTERN can be
+any regular expression that does not match the empty string. For
+example, using -d "^From " defines mail messages as records in a
+Mailbox format file.
+ c
+Exit status 0.
+#### TEST: agrep --show-position -d \n\n -M PATTERN records.in
+6-13:Force PATTERN to match only whole words. A "whole word" is a
+substring which either starts at the beginning or the record or is
+preceded by a non-word constituent character. Similarly, the
+substring must either end at the end of the record or be followed by a
+non-word constituent character. Word-constituent characters are
+alphanumerics (as defined by the current locale) and the underscore
+character. Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+47-54:Set the record delimiter regular expression to PATTERN. The text
+between two delimiters, before the first delimiter, and after the last
+delimiter is considered to be a record. The default record delimiter
+is the regexp "\n", so by default a record is a line. PATTERN can be
+any regular expression that does not match the empty string. For
+example, using -d "^From " defines mail messages as records in a
+Mailbox format file.
+ c
+Exit status 0.
+#### TEST: agrep --show-position -d \n\n -M PATTERN < records.in
+6-13:Force PATTERN to match only whole words. A "whole word" is a
+substring which either starts at the beginning or the record or is
+preceded by a non-word constituent character. Similarly, the
+substring must either end at the end of the record or be followed by a
+non-word constituent character. Word-constituent characters are
+alphanumerics (as defined by the current locale) and the underscore
+character. Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+47-54:Set the record delimiter regular expression to PATTERN. The text
+between two delimiters, before the first delimiter, and after the last
+delimiter is considered to be a record. The default record delimiter
+is the regexp "\n", so by default a record is a line. PATTERN can be
+any regular expression that does not match the empty string. For
+example, using -d "^From " defines mail messages as records in a
+Mailbox format file.
+ c
+Exit status 0.
+#### TEST: agrep --color -d \n\n -M PATTERN records.in
+Force PATTERN to match only whole words. A "whole word" is a
+substring which either starts at the beginning or the record or is
+preceded by a non-word constituent character. Similarly, the
+substring must either end at the end of the record or be followed by a
+non-word constituent character. Word-constituent characters are
+alphanumerics (as defined by the current locale) and the underscore
+character. Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+Set the record delimiter regular expression to PATTERN. The text
+between two delimiters, before the first delimiter, and after the last
+delimiter is considered to be a record. The default record delimiter
+is the regexp "\n", so by default a record is a line. PATTERN can be
+any regular expression that does not match the empty string. For
+example, using -d "^From " defines mail messages as records in a
+Mailbox format file.
+ c
+Exit status 0.
+#### TEST: agrep --color -d \n\n -M PATTERN < records.in
+Force PATTERN to match only whole words. A "whole word" is a
+substring which either starts at the beginning or the record or is
+preceded by a non-word constituent character. Similarly, the
+substring must either end at the end of the record or be followed by a
+non-word constituent character. Word-constituent characters are
+alphanumerics (as defined by the current locale) and the underscore
+character. Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+Set the record delimiter regular expression to PATTERN. The text
+between two delimiters, before the first delimiter, and after the last
+delimiter is considered to be a record. The default record delimiter
+is the regexp "\n", so by default a record is a line. PATTERN can be
+any regular expression that does not match the empty string. For
+example, using -d "^From " defines mail messages as records in a
+Mailbox format file.
+ c
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -d \n\n -M PATTERN records.in
+records.in:1:0:6-13:Force PATTERN to match only whole words. A "whole word" is a
+substring which either starts at the beginning or the record or is
+preceded by a non-word constituent character. Similarly, the
+substring must either end at the end of the record or be followed by a
+non-word constituent character. Word-constituent characters are
+alphanumerics (as defined by the current locale) and the underscore
+character. Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+records.in:3:0:47-54:Set the record delimiter regular expression to PATTERN. The text
+between two delimiters, before the first delimiter, and after the last
+delimiter is considered to be a record. The default record delimiter
+is the regexp "\n", so by default a record is a line. PATTERN can be
+any regular expression that does not match the empty string. For
+example, using -d "^From " defines mail messages as records in a
+Mailbox format file.
+ c
+Exit status 0.
+#### TEST: agrep -H -n -s --color --show-position -d \n\n -M PATTERN < records.in
+(standard input):1:0:6-13:Force PATTERN to match only whole words. A "whole word" is a
+substring which either starts at the beginning or the record or is
+preceded by a non-word constituent character. Similarly, the
+substring must either end at the end of the record or be followed by a
+non-word constituent character. Word-constituent characters are
+alphanumerics (as defined by the current locale) and the underscore
+character. Note that the non-word constituent characters must
+surround the match; they cannot be counted as errors.
+
+(standard input):3:0:47-54:Set the record delimiter regular expression to PATTERN. The text
+between two delimiters, before the first delimiter, and after the last
+delimiter is considered to be a record. The default record delimiter
+is the regexp "\n", so by default a record is a line. PATTERN can be
+any regular expression that does not match the empty string. For
+example, using -d "^From " defines mail messages as records in a
+Mailbox format file.
+ c
+Exit status 0.
diff --git a/tests/agrep/run-tests.sh b/tests/agrep/run-tests.sh
new file mode 100755
index 0000000000000..cdc76a555d86f
--- /dev/null
+++ b/tests/agrep/run-tests.sh
@@ -0,0 +1,96 @@
+#! /bin/sh
+
+set -e
+
+agrep="$top_builddir/src/agrep"
+
+echo "$builddir $top_builddir $srcdir"
+
+num_cases=0
+num_expanded=0
+num_tests=0
+num_fail=0
+num_ok=0
+
+SIFS="$IFS"
+
+for args in $srcdir/*.args; do
+ dir=`dirname $args`
+ base=`basename $args .args`
+ orig_input=$dir/$base.input
+ input=$base.in
+ ok=$dir/$base.ok
+ out=$base.out
+
+ rm -f $out
+ IFS="
+"
+ for arg in `cat $args`; do
+ IFS="$SIFS"
+ case "$arg" in
+ \#*) continue;;
+ esac
+
+ num_cases=`expr $num_cases + 1`
+ cp "$orig_input" $input
+
+ for extra in "" -c -H -l -n -s -M --show-position --color \
+ "-H -n -s --color --show-position"; do
+ num_expanded=`expr $num_expanded + 1`
+ # Note that `echo' cannot be used since it works differently on
+ # different platforms with regards to expanding \n (IRIX expands
+ # it, others typically do not). `cat' doesn't process its output.
+ cat >> $out <<EOF
+#### TEST: agrep $extra $arg $input
+EOF
+ cat <<EOF
+agrep $extra $arg $input
+EOF
+ set +e
+ $agrep $extra $arg $input >> $out
+ status=$?
+ set -e
+ cat >> $out <<EOF
+
+Exit status $status.
+EOF
+
+ num_expanded=`expr $num_expanded + 1`
+ cat >> $out <<EOF
+#### TEST: agrep $extra $arg < $input
+EOF
+ cat <<EOF
+agrep $extra $arg < $input
+EOF
+ set +e
+ $agrep $extra $arg < $input >> $out
+ status=$?
+ set -e
+ cat >> $out <<EOF
+
+Exit status $status.
+EOF
+ done
+ done
+ num_tests=`expr $num_tests + 1`
+ case $host_triplet in
+ *-mingw*)
+ # On MinGW something causes \r\n newlines to be output to $out,
+ # and our reference results don't have them.
+ tr -d '\015' < $out > $out.tmp
+ mv $out.tmp $out
+ ;;
+ esac
+ if diff $ok $out; then
+ num_ok=`expr $num_ok + 1`
+ else
+ echo "FAILED (see above)"
+ num_fail=`expr $num_fail + 1`
+ fi
+done
+
+echo "Ran $num_cases tests ($num_expanded expanded) from $num_tests suites."
+echo "$num_ok/$num_tests tests OK"
+
+test $num_fail -eq 0
+exit $?
diff --git a/tests/bench.c b/tests/bench.c
new file mode 100644
index 0000000000000..705fd385bcd48
--- /dev/null
+++ b/tests/bench.c
@@ -0,0 +1,466 @@
+/*
+ bench.c - simple regex benchmark program
+
+ This software is released under a BSD-style license.
+ See the file LICENSE for details and copyright.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* HAVE_CONFIG_H */
+
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif /* HAVE_GETOPT_H */
+#include <time.h>
+#include <unistd.h>
+#include <math.h>
+#include <sys/types.h>
+
+#if 0
+#include <hackerlab/rx-posix/regex.h>
+#else
+#include <regex.h>
+#endif
+
+/* T distribution for alpha = 0.025 (for 95% confidence). XXX - is
+ this correct? */
+double t_distribution[] = {
+ 12.71,
+ 4.303,
+ 3.182,
+ 2.776,
+ 2.571,
+ 2.447,
+ 2.365,
+ 2.306,
+ 2.262,
+ 2.228,
+ 2.201,
+ 2.179,
+ 2.160,
+ 2.145,
+ 2.131,
+ 2.120,
+ 2.110,
+ 2.101,
+ 2.093,
+ 2.086,
+ 2.080,
+ 2.074,
+ 2.069,
+ 2.064,
+ 2.060,
+ 2.056,
+ 2.052,
+ 2.048,
+ 2.045,
+ 2.042
+};
+
+void
+stats(double *sample_data, int samples, int len)
+{
+ double mean, tmp1, tmp2, variance, stddev, error, percent;
+ int i;
+
+ mean = 0;
+ for (i = 0; i < samples; i++)
+ mean += sample_data[i];
+ mean = mean/i;
+ printf("# mean: %.5f\n", mean);
+
+ tmp1 = 0;
+ for (i = 0; i < samples; i++) {
+ tmp2 = sample_data[i] - mean;
+ tmp1 += tmp2*tmp2;
+ }
+ if (samples > 1)
+ variance = tmp1 / (samples-1);
+ else
+ variance = 0;
+ stddev = sqrt(variance);
+ printf("# variance: %.16f\n", variance);
+ printf("# standard deviation: %.16f\n", stddev);
+
+ error = t_distribution[samples-1] * stddev / sqrt(samples);
+ if (mean != 0)
+ percent = 100*error/mean;
+ else
+ percent = 0;
+ printf("# error: ±%.16f (±%.4f%%)\n", error, percent);
+
+ printf("%d\t%.5f\t%.5f\n", len, mean, error);
+
+ fflush(stdout);
+}
+
+void
+run_tests(int len, int samples, double *sample_data, int repeats,
+ regex_t *reobj, char *str, char *tmpbuf)
+{
+ int i, j, errcode;
+ clock_t c1, c2;
+ regmatch_t pmatch[10];
+
+
+ printf("# len = %d\n", len);
+ fflush(stdout);
+ for (i = 0; i < samples; i++) {
+ c1 = clock();
+ for (j = 0; j < repeats; j++)
+ if ((errcode = tre_regexec(reobj, str, 10, pmatch, 0))) {
+ tre_regerror(errcode, reobj, tmpbuf, 255);
+ printf("error: %s\n", tmpbuf);
+ }
+ c2 = clock();
+
+ sample_data[i] = (double)(c2-c1)/(CLOCKS_PER_SEC*repeats);
+
+ printf("# sample: %.5f sec, clocks: %ld\n",
+ (double)(c2-c1)/(CLOCKS_PER_SEC*repeats),
+ (long)(c2-c1));
+ fflush(stdout);
+ }
+ fflush(stdout);
+
+ for (i = 0; i < 10; i += 2) {
+ printf("# pmatch[%d].rm_so = %d\n", i/2, (int)pmatch[i/2].rm_so);
+ printf("# pmatch[%d].rm_eo = %d\n", i/2, (int)pmatch[i/2].rm_eo);
+ }
+}
+
+
+int
+main(int argc, char **argv)
+{
+ regex_t reobj;
+ char *str;
+ char tmpbuf[256];
+ int i, j;
+ int max_len = 1024*1024*10;
+ int steps = 20;
+ int repeats = 10;
+ int samples = 20;
+ int len;
+ clock_t c1, c2;
+ int opt;
+ double sample_data[30];
+
+ int test_id = -1;
+
+ while ((opt = getopt(argc, argv, "r:l:s:j:t:")) != -1) {
+ switch (opt) {
+ case 't':
+ test_id = atoi(optarg);
+ break;
+ case 'l':
+ max_len = atoi(optarg);
+ break;
+ case 'j':
+ steps = atoi(optarg);
+ break;
+ case 's':
+ samples = atoi(optarg);
+ break;
+ case 'r':
+ repeats = atoi(optarg);
+ break;
+ default:
+ printf("Pälli.\n");
+ return 1;
+ }
+ }
+
+ /* XXX - Check that the correct results are returned. For example, GNU
+ regex-0.12 returns incorrect results for very long strings in
+ test number 1. */
+
+ switch (test_id) {
+ case 0:
+ printf("# pattern: \"a*\"\n");
+ printf("# string: \"aaaaaa...\"\n");
+ len = 0;
+ tre_regcomp(&reobj, "a*", REG_EXTENDED);
+ while (len <= max_len) {
+
+ str = malloc(sizeof(char) * (len+1));
+ for (i = 0; i < len; i++)
+ str[i] = 'a';
+ str[len-1] = '\0';
+
+ run_tests(len, samples, sample_data, repeats, &reobj, str, tmpbuf);
+ stats(sample_data, samples, len);
+ len = len + (max_len/steps);
+ free(str);
+ }
+ break;
+
+
+ case 1:
+ printf("# pattern: \"(a)*\"\n");
+ printf("# string: \"aaaaaa...\"\n");
+ len = 0;
+ tre_regcomp(&reobj, "(a)*", REG_EXTENDED);
+ while (len <= max_len) {
+
+ str = malloc(sizeof(char) * (len+1));
+ for (i = 0; i < len; i++)
+ str[i] = 'a';
+ str[len-1] = '\0';
+
+ run_tests(len, samples, sample_data, repeats, &reobj, str, tmpbuf);
+ stats(sample_data, samples, len);
+ len = len + (max_len/steps);
+ free(str);
+ }
+ break;
+
+
+ case 2:
+ printf("# pattern: \"(a*)\"\n");
+ printf("# string: \"aaaaaa...\"\n"); len = 0;
+ tre_regcomp(&reobj, "(a*)", REG_EXTENDED);
+ while (len <= max_len) {
+
+ str = malloc(sizeof(char) * (len+1));
+ for (i = 0; i < len; i++)
+ str[i] = 'a';
+ str[len-1] = '\0';
+
+ run_tests(len, samples, sample_data, repeats, &reobj, str, tmpbuf);
+ stats(sample_data, samples, len);
+ len = len + (max_len/steps);
+ free(str);
+ }
+ break;
+
+ case 3:
+ printf("# pattern: \"(a*)*|b*\"\n");
+ printf("# string: \"aaaaaa...b\"\n");
+ len = 0;
+ tre_regcomp(&reobj, "(a*)*|b*", REG_EXTENDED);
+ while (len <= max_len) {
+ str = malloc(sizeof(char) * (len+1));
+ for (i = 0; i < len-1; i++)
+ str[i] = 'a';
+ if (len > 0)
+ str[len-1] = 'b';
+ str[len] = '\0';
+
+ run_tests(len, samples, sample_data, repeats, &reobj, str, tmpbuf);
+ stats(sample_data, samples, len);
+ len = len + (max_len/steps);
+ free(str);
+ }
+ break;
+
+ case 4:
+ printf("# pattern: \"(a|a|a|...|a)\"\n");
+ printf("# string: \"aaaaaa...\"\n");
+ len = 1024*1024;
+ str = malloc(sizeof(char) * (len+1));
+ for (i = 0; i < len-1; i++)
+ str[i] = 'a';
+ str[len] = '\0';
+ len = 0;
+ while (len <= max_len) {
+ tmpbuf[0] = '(';
+ for (i = 1; i < (len*2); i++) {
+ tmpbuf[i] = 'a';
+ if (i < len*2-2) {
+ i++;
+ tmpbuf[i] = '|';
+ }
+ }
+ printf("# i = %d\n", i);
+ tmpbuf[i] = ')';
+ tmpbuf[i+1] = '*';
+ tmpbuf[i+2] = '\0';
+ printf("# pat = %s\n", tmpbuf);
+ tre_regcomp(&reobj, tmpbuf, REG_EXTENDED);
+
+ run_tests(len, samples, sample_data, repeats, &reobj, str, tmpbuf);
+ stats(sample_data, samples, len);
+ len = len + (max_len/steps);
+ tre_regfree(&reobj);
+ }
+ free(str);
+ break;
+
+ case 5:
+ printf("# pattern: \"foobar\"\n");
+ printf("# string: \"aaaaaa...foobar\"\n");
+ len = 0;
+ tre_regcomp(&reobj, "foobar", REG_EXTENDED);
+ while (len <= max_len) {
+ str = malloc(sizeof(char) * (len+7));
+ for (i = 0; i < len; i++) {
+ if (i*i % 3)
+ str[i] = 'a';
+ else
+ str[i] = 'a';
+ }
+ str[len+0] = 'f';
+ str[len+1] = 'o';
+ str[len+2] = 'o';
+ str[len+3] = 'b';
+ str[len+4] = 'a';
+ str[len+5] = 'r';
+ str[len+6] = '\0';
+
+ run_tests(len, samples, sample_data, repeats, &reobj, str, tmpbuf);
+ stats(sample_data, samples, len);
+ len = len + (max_len/steps);
+ free(str);
+ }
+ break;
+
+
+ case 6:
+ printf("# pattern: \"a*foobar\"\n");
+ printf("# string: \"aaaaaa...foobar\"\n");
+ len = 0;
+ tre_regcomp(&reobj, "a*foobar", REG_EXTENDED);
+ while (len <= max_len) {
+ str = malloc(sizeof(char) * (len+7));
+ for (i = 0; i < len; i++) {
+ str[i] = 'a';
+ }
+ str[len+0] = 'f';
+ str[len+1] = 'o';
+ str[len+2] = 'o';
+ str[len+3] = 'b';
+ str[len+4] = 'a';
+ str[len+5] = 'r';
+ str[len+6] = '\0';
+
+ run_tests(len, samples, sample_data, repeats, &reobj, str, tmpbuf);
+ stats(sample_data, samples, len);
+ len = len + (max_len/steps);
+ free(str);
+ }
+ break;
+
+
+ case 7:
+ printf("# pattern: \"(a)*foobar\"\n");
+ printf("# string: \"aaaaabbaaab...foobar\"\n");
+ len = 0;
+ tre_regcomp(&reobj, "(a)*foobar", REG_EXTENDED);
+ while (len <= max_len) {
+ str = malloc(sizeof(char) * (len+7));
+ for (i = 0; i < len; i++) {
+ /* Without this GNU regex won't find a match! */
+ if (i*(i-1) % 3)
+ str[i] = 'b';
+ else
+ str[i] = 'a';
+ }
+ str[len+0] = 'f';
+ str[len+1] = 'o';
+ str[len+2] = 'o';
+ str[len+3] = 'b';
+ str[len+4] = 'a';
+ str[len+5] = 'r';
+ str[len+6] = '\0';
+
+ run_tests(len, samples, sample_data, repeats, &reobj, str, tmpbuf);
+ stats(sample_data, samples, len);
+ len = len + (max_len/steps);
+ free(str);
+ }
+ break;
+
+
+ case 8:
+ printf("# pattern: \"(a|b)*foobar\"\n");
+ printf("# string: \"aaaaabbaaab...foobar\"\n");
+ len = 0;
+ tre_regcomp(&reobj, "(a|b)*foobar", REG_EXTENDED);
+ while (len <= max_len) {
+ str = malloc(sizeof(char) * (len+7));
+ for (i = 0; i < len; i++) {
+ if (i*(i-1) % 3)
+ str[i] = 'b';
+ else
+ str[i] = 'a';
+ /* Without this GNU regex won't find a match! */
+ if (i % (1024*1024*10 - 100))
+ str[i] = 'f';
+ }
+ str[len+0] = 'f';
+ str[len+1] = 'o';
+ str[len+2] = 'o';
+ str[len+3] = 'b';
+ str[len+4] = 'a';
+ str[len+5] = 'r';
+ str[len+6] = '\0';
+
+ run_tests(len, samples, sample_data, repeats, &reobj, str, tmpbuf);
+ stats(sample_data, samples, len);
+ len = len + (max_len/steps);
+ free(str);
+ }
+ break;
+
+
+ case 9:
+ printf("# pattern: hand-coded a*\n");
+ printf("# string: \"aaaaaa...\"\n");
+ len = 0;
+ while (len <= max_len) {
+ printf("# len = %d\n", len);
+
+ str = malloc(sizeof(char)*(len+1));
+ for (i = 0; i < len; i++)
+ str[i] = 'a';
+ str[len-1] = '\0';
+
+ for (i = 0; i < samples; i++) {
+ c1 = clock();
+ for (j = 0; j < repeats; j++) {
+ char *s;
+ int l;
+
+ s = str;
+ l = 0;
+
+
+ while (s != '\0') {
+ if (*s == 'a') {
+ s++;
+ l++;
+ } else
+ break;
+ }
+ }
+ c2 = clock();
+ sample_data[i] = (double)(c2-c1)/(CLOCKS_PER_SEC*repeats);
+
+ printf("# sample: %.5f sec, clocks: %ld\n",
+ (double)(c2-c1)/(CLOCKS_PER_SEC*repeats),
+ (long)(c2-c1));
+ fflush(stdout);
+ }
+ fflush(stdout);
+
+ stats(sample_data, samples, len);
+ len = len + (max_len/steps);
+ free(str);
+ }
+ break;
+
+
+ default:
+ printf("Pelle.\n");
+ return 1;
+ }
+
+ tre_regfree(&reobj);
+
+ return 0;
+}
diff --git a/tests/build-tests.sh b/tests/build-tests.sh
new file mode 100755
index 0000000000000..0bbd3698a3571
--- /dev/null
+++ b/tests/build-tests.sh
@@ -0,0 +1,34 @@
+#! /bin/sh
+
+set -e
+
+if test -z "$make"; then
+ make=make
+fi
+
+hostname=`hostname`
+
+for opts in \
+ "" \
+ "--enable-debug" \
+ "--disable-wchar" \
+ "--disable-multibyte" \
+ "--without-alloca" \
+ "--disable-wchar --without-alloca" \
+ "--disable-approx" \
+ "--disable-agrep" \
+ "--enable-system-abi" \
+ "--disable-largefile" \
+ "--disable-nls" \
+ "--disable-warnings"; do
+
+ rm -rf tmp-build
+ mkdir tmp-build
+ cd tmp-build
+
+ echo "$hostname: Configure options \"$opts\"..." >&2
+ ../configure $opts > build-log.txt 2>&1
+ $make >> build-log.txt 2>&1
+ $make check >> build-log.txt 2>&1
+ cd ..
+done
diff --git a/tests/randtest.c b/tests/randtest.c
new file mode 100644
index 0000000000000..773c9e15b97b3
--- /dev/null
+++ b/tests/randtest.c
@@ -0,0 +1,76 @@
+/*
+ randtest.c - tests with random regexps
+
+ This software is released under a BSD-style license.
+ See the file LICENSE for details and copyright.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* HAVE_CONFIG_H */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <regex.h>
+#include <time.h>
+
+#undef MALLOC_DEBUGGING
+#ifdef MALLOC_DEBUGGING
+#include "xmalloc.h"
+#endif /* MALLOC_DEBUGGING */
+
+#define REGEXP_MAX_LEN 16
+
+int
+main(int argc, char **argv)
+{
+ int len, i, flags, n;
+ char regex[50];
+ char *buf;
+ regex_t preg;
+ int status, seed;
+
+ seed = time(NULL);
+ seed = 1028358583;
+ printf("seed = %d\n", seed);
+ srand(seed);
+ n = 0;
+
+ for (n = 0; n < 0; n++)
+ rand();
+
+ while (1)
+ {
+ printf("*");
+ fflush(stdout);
+
+ printf("n = %d\n", n);
+ len = 1 + (int)(REGEXP_MAX_LEN * (rand() / (RAND_MAX + 1.0)));
+ n++;
+
+ for (i = 0; i < len; i++)
+ {
+ regex[i] = 1 + (int)(255 * (rand() / (RAND_MAX + 1.0)));
+ n++;
+ }
+ regex[i] = L'\0';
+
+ printf("len = %d, regexp = \"%s\"\n", len, regex);
+
+ for (flags = 0;
+ flags < (REG_EXTENDED | REG_ICASE | REG_NEWLINE | REG_NOSUB);
+ flags++)
+ {
+ buf = malloc(sizeof(*buf) * len);
+ strncpy(buf, regex, len - 1);
+ status = tre_regncomp(&preg, buf, len, flags);
+ if (status == REG_OK)
+ tre_regfree(&preg);
+ }
+ printf("\n");
+ }
+
+ return 0;
+}
diff --git a/tests/retest.c b/tests/retest.c
new file mode 100644
index 0000000000000..298af0f264427
--- /dev/null
+++ b/tests/retest.c
@@ -0,0 +1,1681 @@
+/*
+ retest.c - TRE regression test program
+
+ This software is released under a BSD-style license.
+ See the file LICENSE for details and copyright.
+
+*/
+
+/*
+ This is just a simple test application containing various hands-written
+ tests for regression testing TRE. I've tried to surround TRE specific
+ tests inside ifdefs, so this can be used to test any POSIX compatible
+ regexp implementation.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* HAVE_CONFIG_H */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <sys/types.h>
+#include <locale.h>
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif /* HAVE_MALLOC_H */
+#include <regex.h>
+
+#ifdef TRE_VERSION
+#define HAVE_REGNEXEC 1
+#define HAVE_REGNCOMP 1
+#include "xmalloc.h"
+#else /* !TRE_VERSION */
+#define xmalloc malloc
+#define xfree free
+#endif /* !TRE_VERSION */
+#include "tre-internal.h"
+
+#ifdef WRETEST
+#include <wchar.h>
+#define CHAR_T wchar_t
+#define L(x) (L ## x)
+
+#define MAXSTRSIZE 1024
+static wchar_t wstr[MAXSTRSIZE];
+static wchar_t wregex[MAXSTRSIZE];
+static int woffs[MAXSTRSIZE];
+
+#define tre_regexec tre_regwexec
+#define tre_regnexec tre_regwnexec
+#define tre_regcomp tre_regwcomp
+#define tre_regncomp tre_regwncomp
+
+/* Iterate mbrtowc over the multi-byte sequence STR of length LEN,
+ store the result in BUF and memoize the successive byte offsets
+ in OFF. */
+
+static int
+mbntowc (wchar_t *buf, const char *str, size_t len, int *off)
+{
+ int n, wlen;
+#ifdef HAVE_MBSTATE_T
+ mbstate_t cst;
+ memset(&cst, 0, sizeof(cst));
+#endif
+
+ if (len >= MAXSTRSIZE)
+ {
+ fprintf(stderr, "Increase MAXSTRSIZE to %ld or more and recompile!\n",
+ (long)len + 1);
+ exit(EXIT_FAILURE);
+ }
+
+ if (off)
+ {
+ memset(off + 1, -1, len * sizeof(int));
+ *off = 0;
+ }
+
+ wlen = 0;
+ while (len > 0)
+ {
+ n = tre_mbrtowc(buf ? buf++ : NULL, str, len, &cst);
+ if (n < 0)
+ return n;
+ if (n == 0)
+ n = 1;
+ str += n;
+ len -= n;
+ wlen += 1;
+ if (off)
+ *(off += n) = wlen;
+ }
+
+ return(wlen);
+}
+
+#else /* !WRETEST */
+#define CHAR_T char
+#define L(x) (x)
+#endif /* !WRETEST */
+
+static int valid_reobj = 0;
+static regex_t reobj;
+static regmatch_t pmatch_global[32];
+static const CHAR_T *regex_pattern;
+static int cflags_global;
+static int use_regnexec = 0;
+static int use_regncomp = 0;
+static int avoid_eflags = 0;
+
+static int comp_tests = 0;
+static int exec_tests = 0;
+static int comp_errors = 0;
+static int exec_errors = 0;
+
+#ifndef REG_OK
+#define REG_OK 0
+#endif /* REG_OK */
+
+#define END -2
+
+static void
+test_status(char c)
+{
+ static int k = 0;
+ printf("%c", c);
+ if (++k % 79 == 0)
+ printf("\n");
+ fflush(stdout);
+}
+
+
+static int
+wrap_regexec(const CHAR_T *data, size_t len,
+ size_t pmatch_len, regmatch_t *pmatch, int eflags)
+{
+ CHAR_T *buf = NULL;
+ int result;
+
+ if (len == 0 && use_regnexec)
+ {
+ /* Zero length string and using tre_regnexec(), the pointer we give
+ should not be dereferenced at all. */
+ buf = NULL;
+ }
+ else
+ {
+ /* Copy the data to a separate buffer to make a better test for
+ tre_regexec() and tre_regnexec(). */
+ buf = xmalloc((len + !use_regnexec) * sizeof(CHAR_T));
+ if (!buf)
+ return REG_ESPACE;
+ memcpy(buf, data, len * sizeof(CHAR_T));
+ test_status('#');
+ }
+
+#ifdef HAVE_REGNEXEC
+ if (use_regnexec)
+ {
+ if (len == 0)
+ result = tre_regnexec(&reobj, NULL, len, pmatch_len, pmatch, eflags);
+ else
+ result = tre_regnexec(&reobj, buf, len, pmatch_len, pmatch, eflags);
+ }
+ else
+#endif /* HAVE_REGNEXEC */
+ {
+ buf[len] = L('\0');
+ result = tre_regexec(&reobj, buf, pmatch_len, pmatch, eflags);
+ }
+
+ xfree(buf);
+ return result;
+}
+
+static int
+wrap_regcomp(regex_t *preg, const CHAR_T *data, size_t len, int cflags)
+{
+#ifdef HAVE_REGNCOMP
+ if (use_regncomp)
+ return tre_regncomp(preg, data, len, cflags);
+ else
+ return tre_regcomp(preg, data, cflags);
+#else /* !HAVE_REGNCOMP */
+ fprintf(stderr, "%s\n", data);
+ return tre_regcomp(preg, data, cflags);
+#endif /* !HAVE_REGNCOMP */
+}
+
+static int
+execute(const CHAR_T *data, int len, size_t pmatch_len, regmatch_t *pmatch,
+ int eflags)
+{
+#ifdef MALLOC_DEBUGGING
+ int i = 0;
+ int ret;
+
+ while (1)
+ {
+ xmalloc_configure(i);
+ comp_tests++;
+ ret = wrap_regexec(data, len, pmatch_len, pmatch, eflags);
+ if (ret != REG_ESPACE)
+ {
+ break;
+ }
+#ifdef REGEX_DEBUG
+ xmalloc_dump_leaks();
+#endif /* REGEX_DEBUG */
+ i++;
+ }
+ return ret;
+#else /* !MALLOC_DEBUGGING */
+ return wrap_regexec(data, len, pmatch_len, pmatch, eflags);
+#endif /* !MALLOC_DEBUGGING */
+}
+
+static int
+check(va_list ap, int ret, const CHAR_T *str,
+ size_t pmatch_len, regmatch_t *pmatch, int eflags)
+{
+ int fail = 0;
+
+ if (ret != va_arg(ap, int))
+ {
+#ifndef WRETEST
+ printf("Exec error, regex: \"%s\", cflags %d, "
+ "string: \"%s\", eflags %d\n", regex_pattern, cflags_global,
+ str, eflags);
+#else /* WRETEST */
+ printf("Exec error, regex: \"%ls\", cflags %d, "
+ "string: \"%ls\", eflags %d\n", regex_pattern, cflags_global,
+ str, eflags);
+#endif /* WRETEST */
+ printf(" got %smatch (tre_regexec returned %d)\n", ret ? "no " : "", ret);
+ return 1;
+ }
+
+ if (ret == 0)
+ {
+ unsigned int i;
+
+ for (i = 0; i < pmatch_len; i++)
+ {
+ int rm_so, rm_eo;
+ rm_so = va_arg(ap, int);
+ if (rm_so == END)
+ break;
+ rm_eo = va_arg(ap, int);
+#ifdef WRETEST
+ if (rm_so >= 0)
+ {
+ int n = rm_so;
+
+ if ((rm_so = woffs[rm_so]) < 0 ||
+ (n = rm_eo, rm_eo = woffs[rm_eo]) < 0)
+ {
+ printf("Invalid or incomplete multi-byte sequence "
+ "in string %ls before byte offset %d\n", str, n);
+ return 1;
+ }
+ }
+#endif /* WRETEST */
+ if (pmatch[i].rm_so != rm_so
+ || pmatch[i].rm_eo != rm_eo)
+ {
+#ifndef WRETEST
+ printf("Exec error, regex: \"%s\", string: \"%s\"\n",
+ regex_pattern, str);
+ printf(" group %d: expected (%d, %d) \"%.*s\", "
+ "got (%d, %d) \"%.*s\"\n",
+#else /* WRETEST */
+ printf("Exec error, regex: \"%ls\", string: \"%ls\"\n",
+ regex_pattern, str);
+ printf(" group %d: expected (%d, %d) \"%.*ls\", "
+ "got (%d, %d) \"%.*ls\"\n",
+#endif /* WRETEST */
+ i, rm_so, rm_eo, rm_eo - rm_so, str + rm_so,
+ (int)pmatch[i].rm_so, (int)pmatch[i].rm_eo,
+ (int)(pmatch[i].rm_eo - pmatch[i].rm_so),
+ str + pmatch[i].rm_so);
+ fail = 1;
+ }
+ }
+
+ if (!(cflags_global & REG_NOSUB) && reobj.re_nsub != i - 1
+ && reobj.re_nsub <= pmatch_len && pmatch)
+ {
+#ifndef WRETEST
+ printf("Comp error, regex: \"%s\"\n", regex_pattern);
+#else /* WRETEST */
+ printf("Comp error, regex: \"%ls\"\n", regex_pattern);
+#endif /* WRETEST */
+ printf(" re_nsub is %d, should be %d\n", (int)reobj.re_nsub, i - 1);
+ fail = 1;
+ }
+
+
+ for (; i < pmatch_len; i++)
+ if (pmatch[i].rm_so != -1 || pmatch[i].rm_eo != -1)
+ {
+ if (!fail)
+#ifndef WRETEST
+ printf("Exec error, regex: \"%s\", string: \"%s\"\n",
+ regex_pattern, str);
+#else /* WRETEST */
+ printf("Exec error, regex: \"%ls\", string: \"%ls\"\n",
+ regex_pattern, str);
+#endif /* WRETEST */
+ printf(" group %d: expected (-1, -1), got (%d, %d)\n",
+ i, (int)pmatch[i].rm_so, (int)pmatch[i].rm_eo);
+ fail = 1;
+ }
+ }
+
+ return fail;
+}
+
+
+static void
+test_nexec(const char *data, size_t len, int eflags, ...)
+{
+ int m;
+ int fail = 0;
+ int extra_flags[] = {0, REG_BACKTRACKING_MATCHER, REG_APPROX_MATCHER};
+ size_t i;
+ va_list ap;
+
+ if (!valid_reobj)
+ {
+ exec_errors++;
+ return;
+ }
+
+#ifdef WRETEST
+ {
+ int wlen = mbntowc(wstr, data, len, woffs);
+ if (wlen < 0)
+ {
+ exec_errors++;
+ printf("Invalid or incomplete multi-byte sequence in %s\n", data);
+ return;
+ }
+ wstr[wlen] = L'\0';
+ len = wlen;
+ }
+#define data wstr
+#endif /* WRETEST */
+
+ use_regnexec = 1;
+
+ for (i = 0; i < elementsof(extra_flags); i++)
+ {
+ int final_flags = eflags | extra_flags[i];
+
+ if ((final_flags & REG_BACKTRACKING_MATCHER
+ && tre_have_approx(&reobj))
+ || (final_flags & REG_APPROX_MATCHER
+ && tre_have_backrefs(&reobj))
+ || (final_flags & avoid_eflags))
+ continue;
+
+ /* Test with a pmatch array. */
+ exec_tests++;
+ m = execute(data, len, elementsof(pmatch_global), pmatch_global,
+ final_flags);
+ va_start(ap, eflags);
+ fail |= check(ap, m, data, elementsof(pmatch_global), pmatch_global,
+ final_flags);
+ va_end(ap);
+
+ /* Same test with a NULL pmatch. */
+ exec_tests++;
+ m = execute(data, len, 0, NULL, final_flags);
+ va_start(ap, eflags);
+ fail |= check(ap, m, data, 0, NULL, final_flags);
+ va_end(ap);
+ }
+
+#ifdef WRETEST
+#undef data
+#endif /* WRETEST */
+
+ if (fail)
+ exec_errors++;
+}
+
+
+
+static void
+test_exec(const char *str, int eflags, ...)
+{
+ int m;
+ int fail = 0;
+ size_t len = strlen(str);
+ int extra_flags[] = {0,
+ REG_BACKTRACKING_MATCHER,
+ REG_APPROX_MATCHER,
+ REG_BACKTRACKING_MATCHER | REG_APPROX_MATCHER};
+ size_t i;
+ va_list ap;
+
+ if (!valid_reobj)
+ {
+ exec_errors++;
+ return;
+ }
+
+#ifdef WRETEST
+ {
+ int wlen = mbntowc(wstr, str, len, woffs);
+ if (wlen < 0)
+ {
+ exec_errors++;
+ printf("Invalid or incomplete multi-byte sequence in %s\n", str);
+ return;
+ }
+ wstr[wlen] = L'\0';
+ len = wlen;
+ }
+#define str wstr
+#endif /* WRETEST */
+
+ for (use_regnexec = 0; use_regnexec < 2; use_regnexec++)
+ {
+ for (i = 0; i < elementsof(extra_flags); i++)
+ {
+ int final_flags = eflags | extra_flags[i];
+
+ if ((final_flags & REG_BACKTRACKING_MATCHER
+ && tre_have_approx(&reobj))
+ || (final_flags & REG_APPROX_MATCHER
+ && tre_have_backrefs(&reobj))
+ || (final_flags & avoid_eflags))
+ continue;
+
+ /* Test with a pmatch array. */
+ exec_tests++;
+ m = execute(str, len, elementsof(pmatch_global), pmatch_global,
+ final_flags);
+ va_start(ap, eflags);
+ fail |= check(ap, m, str, elementsof(pmatch_global), pmatch_global,
+ final_flags);
+ va_end(ap);
+
+ /* Same test with a NULL pmatch. */
+ exec_tests++;
+ m = execute(str, len, 0, NULL, final_flags);
+ va_start(ap, eflags);
+ fail |= check(ap, m, str, 0, NULL, final_flags);
+ va_end(ap);
+ }
+ }
+
+#ifdef WRETEST
+#undef str
+#endif /* WRETEST */
+
+ if (fail)
+ exec_errors++;
+}
+
+
+static void
+test_comp(const char *re, int flags, int ret)
+{
+ int errcode = 0;
+ int len = strlen(re);
+
+ if (valid_reobj)
+ {
+ tre_regfree(&reobj);
+ valid_reobj = 0;
+ }
+
+ comp_tests++;
+
+#ifdef WRETEST
+ {
+ int wlen = mbntowc(wregex, re, len, NULL);
+
+ if (wlen < 0)
+ {
+ comp_errors++;
+ printf("Invalid or incomplete multi-byte sequence in %s\n", re);
+ return;
+ }
+ wregex[wlen] = L'\0';
+ len = wlen;
+ }
+#define re wregex
+#endif /* WRETEST */
+ regex_pattern = re;
+ cflags_global = flags;
+
+#ifdef MALLOC_DEBUGGING
+ {
+ static int j = 0;
+ int i = 0;
+ while (1)
+ {
+ xmalloc_configure(i);
+ comp_tests++;
+ if (j++ % 20 == 0)
+ test_status('.');
+ errcode = wrap_regcomp(&reobj, re, len, flags);
+ if (errcode != REG_ESPACE)
+ {
+ test_status('*');
+ break;
+ }
+#ifdef REGEX_DEBUG
+ xmalloc_dump_leaks();
+#endif /* REGEX_DEBUG */
+ i++;
+ }
+ }
+#else /* !MALLOC_DEBUGGING */
+ errcode = wrap_regcomp(&reobj, re, len, flags);
+#endif /* !MALLOC_DEBUGGING */
+
+#ifdef WRETEST
+#undef re
+#endif /* WRETEST */
+
+ if (errcode != ret)
+ {
+#ifndef WRETEST
+ printf("Comp error, regex: \"%s\"\n", regex_pattern);
+#else /* WRETEST */
+ printf("Comp error, regex: \"%ls\"\n", regex_pattern);
+#endif /* WRETEST */
+ printf(" expected return code %d, got %d.\n",
+ ret, errcode);
+ comp_errors++;
+ }
+
+ if (errcode == 0)
+ valid_reobj = 1;
+}
+
+
+
+/* To enable tests for known bugs, set this to 1. */
+#define KNOWN_BUG 0
+
+int
+main(int argc, char **argv)
+{
+
+#ifdef WRETEST
+ /* Need an 8-bit locale. Or move the two tests with non-ascii
+ characters to the localized internationalization tests. */
+ if (setlocale(LC_CTYPE, "en_US.ISO-8859-1") == NULL)
+ fprintf(stderr, "Could not set locale en_US.ISO-8859-1. Expect some\n"
+ "`Invalid or incomplete multi-byte sequence' errors.\n");
+#endif /* WRETEST */
+ /* Large number of macros in one regexp. */
+ test_comp("[A-Z]\\d\\s?\\d[A-Z]{2}|[A-Z]\\d{2}\\s?\\d[A-Z]{2}|[A-Z]{2}\\d"
+ "\\s?\\d[A-Z]{2}|[A-Z]{2}\\d{2}\\s?\\d[A-Z]{2}|[A-Z]\\d[A-Z]\\s?"
+ "\\d[A-Z]{2}|[A-Z]{2}\\d[A-Z]\\s?\\d[A-Z]{2}|[A-Z]{3}\\s?\\d[A-Z]"
+ "{2}", REG_EXTENDED, 0);
+
+ test_comp("a{11}(b{2}c){2}", REG_EXTENDED, 0);
+ test_comp("a{2}{2}xb+xc*xd?x", REG_EXTENDED, 0);
+ test_comp("^!packet [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3} [0-9]+",
+ REG_EXTENDED, 0);
+ test_comp("^!pfast [0-9]{1,15} ([0-9]{1,3}\\.){3}[0-9]{1,3}[0-9]{1,5}$",
+ REG_EXTENDED, 0);
+
+#if KNOWN_BUG
+ /* Should these match or not? */
+ test_comp("(a)*-\\1b", REG_EXTENDED, 0);
+ test_exec("aaa-b", 0, REG_NOMATCH);
+ test_comp("((.*)\\1)+", REG_EXTENDED, 0);
+ test_exec("xxxxxx", 0, REG_NOMATCH);
+#endif
+
+#ifdef TRE_APPROX
+ /*
+ * Approximate matching tests.
+ *
+ * The approximate matcher always searches for the best match, and returns
+ * the leftmost and longest one if there are several best matches.
+ */
+
+ test_comp("(fou){# ~1}", REG_EXTENDED, 0);
+ test_comp("(fuu){#}", REG_EXTENDED, 0);
+ test_comp("(fuu){# ~}", REG_EXTENDED, 0);
+ test_comp("(anaconda){ 1i + 1d < 1, #1}", REG_EXTENDED, 0);
+ test_comp("(anaconda){ 1i + 1d < 1 #1 ~10 }", REG_EXTENDED, 0);
+ test_comp("(anaconda){ #1, ~1, 1i + 1d < 1 }", REG_EXTENDED, 0);
+
+ test_comp("(znacnda){ #1 ~3 1i + 1d < 1 }", REG_EXTENDED, 0);
+ test_exec("molasses anaconda foo bar baz smith anderson ",
+ 0, REG_NOMATCH);
+ test_comp("(znacnda){ #1 ~3 1i + 1d < 2 }", REG_EXTENDED, 0);
+ test_exec("molasses anaconda foo bar baz smith anderson ",
+ 0, REG_OK, 9, 17, 9, 17, END);
+ test_comp("(ananda){ 1i + 1d < 2 }", REG_EXTENDED, 0);
+ test_exec("molasses anaconda foo bar baz smith anderson ",
+ 0, REG_NOMATCH);
+
+ test_comp("(fuu){ +3 -3 ~5}", REG_EXTENDED, 0);
+ test_exec("anaconda foo bar baz smith anderson",
+ 0, REG_OK, 9, 10, 9, 10, END);
+ test_comp("(fuu){ +2 -2 ~5}", REG_EXTENDED, 0);
+ test_exec("anaconda foo bar baz smith anderson",
+ 0, REG_OK, 9, 10, 9, 10, END);
+ test_comp("(fuu){ +3 -3 ~}", REG_EXTENDED, 0);
+ test_exec("anaconda foo bar baz smith anderson",
+ 0, REG_OK, 9, 10, 9, 10, END);
+
+ test_comp("(laurikari){ #3, 1i + 1d < 3 }", REG_EXTENDED, 0);
+
+ /* No cost limit. */
+ test_comp("(foobar){~}", REG_EXTENDED, 0);
+ test_exec("xirefoabralfobarxie", 0, REG_OK, 11, 16, 11, 16, END);
+
+ /* At most two errors. */
+ test_comp("(foobar){~2}", REG_EXTENDED, 0);
+ test_exec("xirefoabrzlfd", 0, REG_OK, 4, 9, 4, 9, END);
+ test_exec("xirefoabzlfd", 0, REG_NOMATCH);
+
+ /* At most two inserts or substitutions and max two errors total. */
+ test_comp("(foobar){+2#2~2}", REG_EXTENDED, 0);
+ test_exec("oobargoobaploowap", 0, REG_OK, 5, 11, 5, 11, END);
+
+ /* Find best whole word match for "foobar". */
+ test_comp("\\<(foobar){~}\\>", REG_EXTENDED, 0);
+ test_exec("zfoobarz", 0, REG_OK, 0, 8, 0, 8, END);
+ test_exec("boing zfoobarz goobar woop", 0, REG_OK, 15, 21, 15, 21, END);
+
+ /* Match whole string, allow only 1 error. */
+ test_comp("^(foobar){~1}$", REG_EXTENDED, 0);
+ test_exec("foobar", 0, REG_OK, 0, 6, 0, 6, END);
+ test_exec("xfoobar", 0, REG_OK, 0, 7, 0, 7, END);
+ /*
+ This currently fails.
+ test_exec("foobarx", 0, REG_OK, 0, 7, 0, 7, END);
+ */
+ test_exec("fooxbar", 0, REG_OK, 0, 7, 0, 7, END);
+ test_exec("foxbar", 0, REG_OK, 0, 6, 0, 6, END);
+ test_exec("xoobar", 0, REG_OK, 0, 6, 0, 6, END);
+ test_exec("foobax", 0, REG_OK, 0, 6, 0, 6, END);
+ test_exec("oobar", 0, REG_OK, 0, 5, 0, 5, END);
+ test_exec("fobar", 0, REG_OK, 0, 5, 0, 5, END);
+ test_exec("fooba", 0, REG_OK, 0, 5, 0, 5, END);
+ test_exec("xfoobarx", 0, REG_NOMATCH);
+ test_exec("foobarxx", 0, REG_NOMATCH);
+ test_exec("xxfoobar", 0, REG_NOMATCH);
+ test_exec("xfoxbar", 0, REG_NOMATCH);
+ test_exec("foxbarx", 0, REG_NOMATCH);
+
+ /* At most one insert, two deletes, and three substitutions.
+ Additionally, deletes cost two and substitutes one, and total
+ cost must be less than 4. */
+ test_comp("(foobar){+1 -2 #3, 2d + 1s < 4}", REG_EXTENDED, 0);
+ test_exec("3oifaowefbaoraofuiebofasebfaobfaorfeoaro",
+ 0, REG_OK, 26, 33, 26, 33, END);
+
+ /* Partially approximate matches. */
+ test_comp("foo(bar){~1}zap", REG_EXTENDED, 0);
+ test_exec("foobarzap", 0, REG_OK, 0, 9, 3, 6, END);
+ test_exec("fobarzap", 0, REG_NOMATCH);
+ test_exec("foobrzap", 0, REG_OK, 0, 8, 3, 5, END);
+ test_comp("^.*(dot.org){~}.*$", REG_EXTENDED, 0);
+ test_exec("www.cnn.com 64.236.16.20\n"
+ "www.slashdot.org 66.35.250.150\n"
+ "For useful information, use www.slashdot.org\n"
+ "this is demo data!\n",
+ 0, REG_OK, 0, 120, 93, 100, END);
+
+ /* Approximate matching and back referencing cannot be used together. */
+ test_comp("(foo{~})\\1", REG_EXTENDED, REG_BADPAT);
+
+#endif /* TRE_APPROX */
+
+ /*
+ * Basic tests with pure regular expressions
+ */
+
+ /* Basic string matching. */
+ test_comp("foobar", REG_EXTENDED, 0);
+ test_exec("foobar", 0, REG_OK, 0, 6, END);
+ test_exec("xxxfoobarzapzot", 0, REG_OK, 3, 9, END);
+ test_comp("foobar", REG_EXTENDED | REG_NOSUB, 0);
+ test_exec("foobar", 0, REG_OK, END);
+ test_comp("aaaa", REG_EXTENDED, 0);
+ test_exec("xxaaaaaaaaaaaaaaaaa", 0, REG_OK, 2, 6, END);
+
+ /* Test zero length matches. */
+ test_comp("(a*)", REG_EXTENDED, 0);
+ test_exec("", 0, REG_OK, 0, 0, 0, 0, END);
+
+ test_comp("(a*)*", REG_EXTENDED, 0);
+ test_exec("", 0, REG_OK, 0, 0, 0, 0, END);
+
+ test_comp("((a*)*)*", REG_EXTENDED, 0);
+ test_exec("", 0, REG_OK, 0, 0, 0, 0, 0, 0, END);
+ test_comp("(a*bcd)*", REG_EXTENDED, 0);
+ test_exec("aaaaaaaaaaaabcxbcxbcxaabcxaabcx", 0, REG_OK, 0, 0, -1, -1, END);
+ test_exec("aaaaaaaaaaaabcxbcxbcxaabcxaabc", 0, REG_OK, 0, 0, -1, -1, END);
+ test_exec("aaaaaaaaaaaabcxbcdbcxaabcxaabc", 0, REG_OK, 0, 0, -1, -1, END);
+ test_exec("aaaaaaaaaaaabcdbcdbcxaabcxaabc", 0, REG_OK, 0, 18, 15, 18, END);
+
+ test_comp("(a*)+", REG_EXTENDED, 0);
+ test_exec("-", 0, REG_OK, 0, 0, 0, 0, END);
+
+ /* This test blows up the backtracking matcher. */
+ avoid_eflags = REG_BACKTRACKING_MATCHER;
+ test_comp("((a*)*b)*b", REG_EXTENDED, 0);
+ test_exec("aaaaaaaaaaaaaaaaaaaaaaaaab", 0, REG_OK,
+ 25, 26, -1, -1, -1, -1, END);
+ avoid_eflags = 0;
+
+ test_comp("", 0, 0);
+ test_exec("", 0, REG_OK, 0, 0, END);
+ test_exec("foo", 0, REG_OK, 0, 0, END);
+
+ /* Test for submatch addressing which requires arbitrary lookahead. */
+ test_comp("(a*)aaaaaa", REG_EXTENDED, 0);
+ test_exec("aaaaaaaaaaaaaaax", 0, REG_OK, 0, 15, 0, 9, END);
+
+ /* Test leftmost and longest matching and some tricky submatches. */
+ test_comp("(a*)(a*)", REG_EXTENDED, 0);
+ test_exec("aaaa", 0, REG_OK, 0, 4, 0, 4, 4, 4, END);
+ test_comp("(abcd|abc)(d?)", REG_EXTENDED, 0);
+ test_exec("abcd", 0, REG_OK, 0, 4, 0, 4, 4, 4, END);
+ test_comp("(abc|abcd)(d?)", REG_EXTENDED, 0);
+ test_exec("abcd", 0, REG_OK, 0, 4, 0, 4, 4, 4, END);
+ test_comp("(abc|abcd)(d?)e", REG_EXTENDED, 0);
+ test_exec("abcde", 0, REG_OK, 0, 5, 0, 4, 4, 4, END);
+ test_comp("(abcd|abc)(d?)e", REG_EXTENDED, 0);
+ test_exec("abcde", 0, REG_OK, 0, 5, 0, 4, 4, 4, END);
+ test_comp("a(bc|bcd)(d?)", REG_EXTENDED, 0);
+ test_exec("abcd", 0, REG_OK, 0, 4, 1, 4, 4, 4, END);
+ test_comp("a(bcd|bc)(d?)", REG_EXTENDED, 0);
+ test_exec("abcd", 0, REG_OK, 0, 4, 1, 4, 4, 4, END);
+ test_comp("a*(a?bc|bcd)(d?)", REG_EXTENDED, 0);
+ test_exec("aaabcd", 0, REG_OK, 0, 6, 3, 6, 6, 6, END);
+ test_comp("a*(bcd|a?bc)(d?)", REG_EXTENDED, 0);
+ test_exec("aaabcd", 0, REG_OK, 0, 6, 3, 6, 6, 6, END);
+ test_comp("(a|(a*b*))*", REG_EXTENDED, 0);
+ test_exec("", 0, REG_OK, 0, 0, 0, 0, 0, 0, END);
+ test_exec("a", 0, REG_OK, 0, 1, 0, 1, -1, -1, END);
+ test_exec("aa", 0, REG_OK, 0, 2, 0, 2, 0, 2, END);
+ test_exec("aaa", 0, REG_OK, 0, 3, 0, 3, 0, 3, END);
+ test_exec("bbb", 0, REG_OK, 0, 3, 0, 3, 0, 3, END);
+ test_exec("aaabbb", 0, REG_OK, 0, 6, 0, 6, 0, 6, END);
+ test_exec("bbbaaa", 0, REG_OK, 0, 6, 3, 6, 3, 6, END);
+ test_comp("((a*b*)|a)*", REG_EXTENDED, 0);
+ test_exec("", 0, REG_OK, 0, 0, 0, 0, 0, 0, END);
+ test_exec("a", 0, REG_OK, 0, 1, 0, 1, 0, 1, END);
+ test_exec("aa", 0, REG_OK, 0, 2, 0, 2, 0, 2, END);
+ test_exec("aaa", 0, REG_OK, 0, 3, 0, 3, 0, 3, END);
+ test_exec("bbb", 0, REG_OK, 0, 3, 0, 3, 0, 3, END);
+ test_exec("aaabbb", 0, REG_OK, 0, 6, 0, 6, 0, 6, END);
+ test_exec("bbbaaa", 0, REG_OK, 0, 6, 3, 6, 3, 6, END);
+ test_comp("a.*(.*b.*(.*c.*).*d.*).*e.*(.*f.*).*g", REG_EXTENDED, 0);
+ test_exec("aabbccddeeffgg", 0, REG_OK, 0, 14, 3, 9, 5, 7, 11, 13, END);
+ test_comp("(wee|week)(night|knights)s*", REG_EXTENDED, 0);
+ test_exec("weeknights", 0, REG_OK, 0, 10, 0, 3, 3, 10, END);
+ test_exec("weeknightss", 0, REG_OK, 0, 11, 0, 3, 3, 10, END);
+ test_comp("a*", REG_EXTENDED, 0);
+ test_exec("aaaaaaaaaa", 0, REG_OK, 0, 10, END);
+ test_comp("aa*", REG_EXTENDED, 0);
+ test_exec("aaaaaaaaaa", 0, REG_OK, 0, 10, END);
+ test_comp("aaa*", REG_EXTENDED, 0);
+ test_exec("aaaaaaaaaa", 0, REG_OK, 0, 10, END);
+ test_comp("aaaa*", REG_EXTENDED, 0);
+ test_exec("aaaaaaaaaa", 0, REG_OK, 0, 10, END);
+
+ /* Test clearing old submatch data with nesting parentheses
+ and iteration. */
+ test_comp("((a)|(b))*c", REG_EXTENDED, 0);
+ test_exec("aaabc", 0, REG_OK, 0, 5, 3, 4, -1, -1, 3, 4, END);
+ test_exec("aaaac", 0, REG_OK, 0, 5, 3, 4, 3, 4, -1, -1, END);
+ test_comp("foo((bar)*)*zot", REG_EXTENDED, 0);
+ test_exec("foozot", 0, REG_OK, 0, 6, 3, 3, -1, -1, END);
+ test_exec("foobarzot", 0, REG_OK, 0, 9, 3, 6, 3, 6, END);
+ test_exec("foobarbarzot", 0, REG_OK, 0, 12, 3, 9, 6, 9, END);
+
+ test_comp("foo((zup)*|(bar)*|(zap)*)*zot", REG_EXTENDED, 0);
+ test_exec("foobarzapzot", 0, REG_OK,
+ 0, 12, 6, 9, -1, -1, -1, -1, 6, 9, END);
+ test_exec("foobarbarzapzot", 0, REG_OK,
+ 0, 15, 9, 12, -1, -1, -1, -1, 9, 12, END);
+ test_exec("foozupzot", 0, REG_OK,
+ 0, 9, 3, 6, 3, 6, -1, -1, -1, -1, END);
+ test_exec("foobarzot", 0, REG_OK,
+ 0, 9, 3, 6, -1, -1, 3, 6, -1, -1, END);
+ test_exec("foozapzot", 0, REG_OK,
+ 0, 9, 3, 6, -1, -1, -1, -1, 3, 6, END);
+ test_exec("foozot", 0, REG_OK,
+ 0, 6, 3, 3, -1, -1, -1, -1, -1, -1, END);
+
+
+ /* Test case where, e.g., Perl and Python regexp functions, and many
+ other backtracking matchers, fail to produce the longest match.
+ It is not exactly a bug since Perl does not claim to find the
+ longest match, but a confusing feature and, in my opinion, a bad
+ design choice because the union operator is traditionally defined
+ to be commutative (with respect to the language denoted by the RE). */
+ test_comp("(a|ab)(blip)?", REG_EXTENDED, 0);
+ test_exec("ablip", 0, REG_OK, 0, 5, 0, 1, 1, 5, END);
+ test_exec("ab", 0, REG_OK, 0, 2, 0, 2, -1, -1, END);
+ test_comp("(ab|a)(blip)?", REG_EXTENDED, 0);
+ test_exec("ablip", 0, REG_OK, 0, 5, 0, 1, 1, 5, END);
+ test_exec("ab", 0, REG_OK, 0, 2, 0, 2, -1, -1, END);
+
+ /* Test more submatch addressing. */
+ test_comp("((a|b)*)a(a|b)*", REG_EXTENDED, 0);
+ test_exec("aaaaabaaaba", 0, REG_OK, 0, 11, 0, 10, 9, 10, -1, -1, END);
+ test_exec("aaaaabaaab", 0, REG_OK, 0, 10, 0, 8, 7, 8, 9, 10, END);
+ test_exec("caa", 0, REG_OK, 1, 3, 1, 2, 1, 2, -1, -1, END);
+ test_comp("((a|aba)*)(ababbaba)((a|b)*)", REG_EXTENDED, 0);
+ test_exec("aabaababbabaaababbab", 0, REG_OK,
+ 0, 20, 0, 4, 1, 4, 4, 12, 12, 20, 19, 20, END);
+ test_exec("aaaaababbaba", 0, REG_OK,
+ 0, 12, 0, 4, 3, 4, 4, 12, 12, 12, -1, -1, END);
+ test_comp("((a|aba|abb|bba|bab)*)(ababbababbabbbabbbbbbabbaba)((a|b)*)",
+ REG_EXTENDED, 0);
+ test_exec("aabaabbbbabababaababbababbabbbabbbbbbabbabababbababababbabababa",
+ 0, REG_OK, 0, 63, 0, 16, 13, 16, 16, 43, 43, 63, 62, 63, END);
+
+ /* Test for empty subexpressions. */
+ test_comp("", 0, 0);
+ test_exec("", 0, REG_OK, 0, 0, END);
+ test_exec("foo", 0, REG_OK, 0, 0, END);
+ test_comp("(a|)", REG_EXTENDED, 0);
+ test_exec("a", 0, REG_OK, 0, 1, 0, 1, END);
+ test_exec("b", 0, REG_OK, 0, 0, 0, 0, END);
+ test_exec("", 0, REG_OK, 0, 0, 0, 0, END);
+ test_comp("a|", REG_EXTENDED, 0);
+ test_exec("a", 0, REG_OK, 0, 1, END);
+ test_exec("b", 0, REG_OK, 0, 0, END);
+ test_exec("", 0, REG_OK, 0, 0, END);
+ test_comp("|a", REG_EXTENDED, 0);
+ test_exec("a", 0, REG_OK, 0, 1, END);
+ test_exec("b", 0, REG_OK, 0, 0, END);
+ test_exec("", 0, REG_OK, 0, 0, END);
+
+ /* Miscellaneous tests. */
+ test_comp("(a*)b(c*)", REG_EXTENDED, 0);
+ test_exec("abc", 0, REG_OK, 0, 3, 0, 1, 2, 3, END);
+ test_exec("***abc***", 0, REG_OK, 3, 6, 3, 4, 5, 6, END);
+ test_comp("(a)", REG_EXTENDED, 0);
+ test_exec("a", 0, REG_OK, 0, 1, 0, 1, END);
+ test_comp("((a))", REG_EXTENDED, 0);
+ test_exec("a", 0, REG_OK, 0, 1, 0, 1, 0, 1, END);
+ test_comp("(((a)))", REG_EXTENDED, 0);
+ test_exec("a", 0, REG_OK, 0, 1, 0, 1, 0, 1, 0, 1, END);
+ test_comp("((((((((((((((((((((a))))))))))))))))))))", REG_EXTENDED, 0);
+ test_exec("a", 0, REG_OK, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
+ 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
+ 0, 1, 0, 1, 0, 1, END);
+
+ test_comp("ksntoeaiksntoeaikstneoaiksnteoaiksntoeaiskntoeaiskntoekainstoei"
+ "askntoeakisntoeksaitnokesantiksoentaikosentaiksoentaiksnoeaiskn"
+ "teoaksintoekasitnoeksaitkosetniaksoetnaisknoetakistoeksintokesa"
+ "nitksoentaisknoetaisknoetiaksotneaikstoekasitoeskatioksentaikso"
+ "enatiksoetnaiksonateiksoteaeskanotisknetaiskntoeasknitoskenatis"
+ "konetaisknoteai", 0, 0);
+
+ test_comp("((aab)|(aac)|(aa*))c", REG_EXTENDED, 0);
+ test_exec("aabc", 0, REG_OK, 0, 4, 0, 3, 0, 3, -1, -1, -1, -1, END);
+ test_exec("aacc", 0, REG_OK, 0, 4, 0, 3, -1, -1, 0, 3, -1, -1, END);
+ test_exec("aaac", 0, REG_OK, 0, 4, 0, 3, -1, -1, -1, -1, 0, 3, END);
+
+ test_comp("^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$",
+ REG_EXTENDED, 0);
+ test_exec("foo!bar!bas", 0, REG_OK,
+ 0, 11, 0, 11, -1, -1, -1, -1, 4, 8, 8, 11, END);
+ test_comp("^([^!]+!)?([^!]+)$|^.+!([^!]+!)([^!]+)$",
+ REG_EXTENDED, 0);
+ test_exec("foo!bar!bas", 0, REG_OK,
+ 0, 11, -1, -1, -1, -1, 4, 8, 8, 11, END);
+ test_comp("^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$",
+ REG_EXTENDED, 0);
+ test_exec("foo!bar!bas", 0, REG_OK,
+ 0, 11, 0, 11, -1, -1, -1, -1, 4, 8, 8, 11, END);
+
+ test_comp("M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]",
+ REG_EXTENDED, 0);
+ test_exec("Muammar Quathafi", 0, REG_OK, 0, 16, -1, -1, 11, 13, END);
+
+ test_comp("(Ab|cD)*", REG_EXTENDED | REG_ICASE, 0);
+ test_exec("aBcD", 0, REG_OK, 0, 4, 2, 4, END);
+
+ test_comp("a**", REG_EXTENDED, REG_BADRPT);
+ test_comp("a*+", REG_EXTENDED, REG_BADRPT);
+ test_comp("a+*", REG_EXTENDED, REG_BADRPT);
+ test_comp("a++", REG_EXTENDED, REG_BADRPT);
+ test_comp("a?+", REG_EXTENDED, REG_BADRPT);
+ test_comp("a?*", REG_EXTENDED, REG_BADRPT);
+ test_comp("a{1,2}*", REG_EXTENDED, REG_BADRPT);
+ test_comp("a{1,2}+", REG_EXTENDED, REG_BADRPT);
+
+ /*
+ * Many of the following tests were mostly inspired by (or copied from) the
+ * libhackerlab posix test suite by Tom Lord.
+ */
+
+ test_comp("a", 0, 0);
+ test_exec("a", 0, REG_OK, 0, 1, END);
+ test_comp("\\.", 0, 0);
+ test_exec(".", 0, REG_OK, 0, 1, END);
+ test_comp("\\[", 0, 0);
+ test_exec("[", 0, REG_OK, 0, 1, END);
+ test_comp("\\\\", 0, 0);
+ test_exec("\\", 0, REG_OK, 0, 1, END);
+ test_comp("\\*", 0, 0);
+ test_exec("*", 0, REG_OK, 0, 1, END);
+ test_comp("\\^", 0, 0);
+ test_exec("^", 0, REG_OK, 0, 1, END);
+ test_comp("\\$", 0, 0);
+ test_exec("$", 0, REG_OK, 0, 1, END);
+
+ test_comp("\\", 0, REG_EESCAPE);
+
+ test_comp("x\\.", 0, 0);
+ test_exec("x.", 0, REG_OK, 0, 2, END);
+ test_comp("x\\[", 0, 0);
+ test_exec("x[", 0, REG_OK, 0, 2, END);
+ test_comp("x\\\\", 0, 0);
+ test_exec("x\\", 0, REG_OK, 0, 2, END);
+ test_comp("x\\*", 0, 0);
+ test_exec("x*", 0, REG_OK, 0, 2, END);
+ test_comp("x\\^", 0, 0);
+ test_exec("x^", 0, REG_OK, 0, 2, END);
+ test_comp("x\\$", 0, 0);
+ test_exec("x$", 0, REG_OK, 0, 2, END);
+
+ test_comp("x\\", 0, REG_EESCAPE);
+
+ test_comp(".", 0, 0);
+ test_exec("a", 0, REG_OK, 0, 1, END);
+ test_exec("\n", 0, REG_OK, 0, 1, END);
+
+ test_comp("(+|?)", 0, 0);
+ test_exec("(+|?)", 0, REG_OK, 0, 5, END);
+ test_exec("+|?", 0, REG_NOMATCH);
+ test_exec("(+)", 0, REG_NOMATCH);
+ test_exec("+", 0, REG_NOMATCH);
+
+
+ /*
+ * Test bracket expressions.
+ */
+
+ test_comp("[", 0, REG_EBRACK);
+ test_comp("[]", 0, REG_EBRACK);
+ test_comp("[^]", 0, REG_EBRACK);
+
+ test_comp("[]x]", 0, 0);
+ test_exec("]", 0, REG_OK, 0, 1, END);
+ test_exec("x", 0, REG_OK, 0, 1, END);
+
+ test_comp("[.]", 0, 0);
+ test_exec(".", 0, REG_OK, 0, 1, END);
+ test_exec("a", 0, REG_NOMATCH);
+
+ test_comp("[*]", 0, 0);
+ test_exec("*", 0, REG_OK, 0, 1, END);
+
+ test_comp("[[]", 0, 0);
+ test_exec("[", 0, REG_OK, 0, 1, END);
+
+ test_comp("[\\]", 0, 0);
+ test_exec("\\", 0, REG_OK, 0, 1, END);
+
+ test_comp("[-x]", 0, 0);
+ test_exec("-", 0, REG_OK, 0, 1, END);
+ test_exec("x", 0, REG_OK, 0, 1, END);
+ test_comp("[x-]", 0, 0);
+ test_exec("-", 0, REG_OK, 0, 1, END);
+ test_exec("x", 0, REG_OK, 0, 1, END);
+ test_comp("[-]", 0, 0);
+ test_exec("-", 0, REG_OK, 0, 1, END);
+
+ test_comp("[abc]", 0, 0);
+ test_exec("a", 0, REG_OK, 0, 1, END);
+ test_exec("b", 0, REG_OK, 0, 1, END);
+ test_exec("c", 0, REG_OK, 0, 1, END);
+ test_exec("d", 0, REG_NOMATCH);
+ test_exec("xa", 0, REG_OK, 1, 2, END);
+ test_exec("xb", 0, REG_OK, 1, 2, END);
+ test_exec("xc", 0, REG_OK, 1, 2, END);
+ test_exec("xd", 0, REG_NOMATCH);
+ test_comp("x[abc]", 0, 0);
+ test_exec("xa", 0, REG_OK, 0, 2, END);
+ test_exec("xb", 0, REG_OK, 0, 2, END);
+ test_exec("xc", 0, REG_OK, 0, 2, END);
+ test_exec("xd", 0, REG_NOMATCH);
+ test_comp("[^abc]", 0, 0);
+ test_exec("a", 0, REG_NOMATCH);
+ test_exec("b", 0, REG_NOMATCH);
+ test_exec("c", 0, REG_NOMATCH);
+ test_exec("d", 0, REG_OK, 0, 1, END);
+ test_exec("xa", 0, REG_OK, 0, 1, END);
+ test_exec("xb", 0, REG_OK, 0, 1, END);
+ test_exec("xc", 0, REG_OK, 0, 1, END);
+ test_exec("xd", 0, REG_OK, 0, 1, END);
+ test_comp("x[^abc]", 0, 0);
+ test_exec("xa", 0, REG_NOMATCH);
+ test_exec("xb", 0, REG_NOMATCH);
+ test_exec("xc", 0, REG_NOMATCH);
+ test_exec("xd", 0, REG_OK, 0, 2, END);
+
+ test_comp("[()+?*\\]+", REG_EXTENDED, 0);
+ test_exec("x\\*?+()x", 0, REG_OK, 1, 7, END);
+
+ /* Standard character classes. */
+ test_comp("[[:alnum:]]+", REG_EXTENDED, 0);
+ test_exec("%abc123890XYZ=", 0, REG_OK, 1, 13, END);
+ test_comp("[[:cntrl:]]+", REG_EXTENDED, 0);
+ test_exec("%\n\t\015\f ", 0, REG_OK, 1, 5, END);
+ test_comp("[[:lower:]]+", REG_EXTENDED, 0);
+ test_exec("AbcdE", 0, REG_OK, 1, 4, END);
+ test_comp("[[:lower:]]+", REG_EXTENDED | REG_ICASE, 0);
+ test_exec("AbcdE", 0, REG_OK, 0, 5, END);
+ test_comp("[[:space:]]+", REG_EXTENDED, 0);
+ test_exec("x \t\f\nx", 0, REG_OK, 1, 5, END);
+ test_comp("[[:alpha:]]+", REG_EXTENDED, 0);
+ test_exec("%abC123890xyz=", 0, REG_OK, 1, 4, END);
+ test_comp("[[:digit:]]+", REG_EXTENDED, 0);
+ test_exec("%abC123890xyz=", 0, REG_OK, 4, 10, END);
+ test_comp("[^[:digit:]]+", REG_EXTENDED, 0);
+ test_exec("%abC123890xyz=", 0, REG_OK, 0, 4, END);
+ test_comp("[[:print:]]+", REG_EXTENDED, 0);
+ test_exec("\n %abC12\f", 0, REG_OK, 1, 8, END);
+ test_comp("[[:upper:]]+", REG_EXTENDED, 0);
+ test_exec("\n aBCDEFGHIJKLMNOPQRSTUVWXYz", 0, REG_OK, 3, 27, END);
+ test_comp("[[:upper:]]+", REG_EXTENDED | REG_ICASE, 0);
+ test_exec("\n aBCDEFGHIJKLMNOPQRSTUVWXYz", 0, REG_OK, 2, 28, END);
+#ifdef HAVE_ISWBLANK
+#ifdef HAVE_ISBLANK
+ test_comp("[[:blank:]]+", REG_EXTENDED, 0);
+ test_exec("\na \t b", 0, REG_OK, 2, 5, END);
+#endif /* HAVE_ISBLANK */
+#endif /* HAVE_ISWBLANK */
+ test_comp("[[:graph:]]+", REG_EXTENDED, 0);
+ test_exec("\n %abC12\f", 0, REG_OK, 2, 8, END);
+ test_comp("[[:punct:]]+", REG_EXTENDED, 0);
+ test_exec("a~!@#$%^&*()_+=-`[]{};':\"|\\,./?>< ",
+ 0, REG_OK, 1, 33, END);
+ test_comp("[[:xdigit:]]+", REG_EXTENDED, 0);
+ test_exec("-0123456789ABCDEFabcdef", 0, REG_OK, 1, 23, END);
+ test_comp("[[:bogus-character-class-name:]", REG_EXTENDED, REG_ECTYPE);
+
+
+ /* Range expressions (assuming that the C locale is being used). */
+ test_comp("[a-z]+", REG_EXTENDED, 0);
+ test_exec("ABCabcxyzABC", 0, REG_OK, 3, 9, END);
+ test_comp("[z-a]+", REG_EXTENDED, REG_ERANGE);
+ test_comp("[a-b-c]", 0, REG_ERANGE);
+ test_comp("[a-a]+", REG_EXTENDED, 0);
+ test_exec("zaaaaab", 0, REG_OK, 1, 6, END);
+ test_comp("[--Z]+", REG_EXTENDED, 0);
+ test_exec("!ABC-./XYZ~", 0, REG_OK, 1, 10, END);
+ test_comp("[*--]", 0, 0);
+ test_exec("-", 0, REG_OK, 0, 1, END);
+ test_exec("*", 0, REG_OK, 0, 1, END);
+ test_comp("[*--Z]+", REG_EXTENDED, 0);
+ test_exec("!+*,---ABC", 0, REG_OK, 1, 7, END);
+ test_comp("[a-]+", REG_EXTENDED, 0);
+ test_exec("xa-a--a-ay", 0, REG_OK, 1, 9, END);
+
+ /* REG_ICASE and character sets. */
+ test_comp("[a-c]*", REG_ICASE | REG_EXTENDED, 0);
+ test_exec("cABbage", 0, REG_OK, 0, 5, END);
+ test_comp("[^a-c]*", REG_ICASE | REG_EXTENDED, 0);
+ test_exec("tObAcCo", 0, REG_OK, 0, 2, END);
+ test_comp("[A-C]*", REG_ICASE | REG_EXTENDED, 0);
+ test_exec("cABbage", 0, REG_OK, 0, 5, END);
+ test_comp("[^A-C]*", REG_ICASE | REG_EXTENDED, 0);
+ test_exec("tObAcCo", 0, REG_OK, 0, 2, END);
+
+ /* Complex character sets. */
+ test_comp("[[:digit:]a-z#$%]+", REG_EXTENDED, 0);
+ test_exec("__abc#lmn012$x%yz789*", 0, REG_OK, 2, 20, END);
+ test_comp("[[:digit:]a-z#$%]+", REG_ICASE | REG_EXTENDED, 0);
+ test_exec("__abcLMN012x%#$yz789*", 0, REG_OK, 2, 20, END);
+ test_comp("[^[:digit:]a-z#$%]+", REG_EXTENDED, 0);
+ test_exec("abc#lmn012$x%yz789--@*,abc", 0, REG_OK, 18, 23, END);
+ test_comp("[^[:digit:]a-z#$%]+", REG_ICASE | REG_EXTENDED, 0);
+ test_exec("abc#lmn012$x%yz789--@*,abc", 0, REG_OK, 18, 23, END);
+ test_comp("[^[:digit:]#$%[:xdigit:]]+", REG_ICASE | REG_EXTENDED, 0);
+ test_exec("abc#lmn012$x%yz789--@*,abc", 0, REG_OK, 4, 7, END);
+ test_comp("[^-]+", REG_EXTENDED, 0);
+ test_exec("---afd*(&,ml---", 0, REG_OK, 3, 12, END);
+ test_comp("[^--Z]+", REG_EXTENDED, 0);
+ test_exec("---AFD*(&,ml---", 0, REG_OK, 6, 12, END);
+ test_comp("[^--Z]+", REG_ICASE | REG_EXTENDED, 0);
+ test_exec("---AFD*(&,ml---", 0, REG_OK, 6, 10, END);
+
+ /* Unsupported things (equivalence classes and multicharacter collating
+ elements) */
+ test_comp("[[.foo.]]", 0, REG_ECOLLATE);
+ test_comp("[[=foo=]]", 0, REG_ECOLLATE);
+ test_comp("[[..]]", 0, REG_ECOLLATE);
+ test_comp("[[==]]", 0, REG_ECOLLATE);
+ test_comp("[[.]]", 0, REG_ECOLLATE);
+ test_comp("[[=]]", 0, REG_ECOLLATE);
+ test_comp("[[.]", 0, REG_ECOLLATE);
+ test_comp("[[=]", 0, REG_ECOLLATE);
+ test_comp("[[.", 0, REG_ECOLLATE);
+ test_comp("[[=", 0, REG_ECOLLATE);
+
+
+
+ /* Miscellaneous tests. */
+ test_comp("abc\\(\\(de\\)\\(fg\\)\\)hi", 0, 0);
+ test_exec("xabcdefghiy", 0, REG_OK, 1, 10, 4, 8, 4, 6, 6, 8, END);
+
+ test_comp("abc*def", 0, 0);
+ test_exec("xabdefy", 0, REG_OK, 1, 6, END);
+ test_exec("xabcdefy", 0, REG_OK, 1, 7, END);
+ test_exec("xabcccccccdefy", 0, REG_OK, 1, 13, END);
+
+ test_comp("abc\\(def\\)*ghi", 0, 0);
+ test_exec("xabcghiy", 0, REG_OK, 1, 7, -1, -1, END);
+ test_exec("xabcdefghi", 0, REG_OK, 1, 10, 4, 7, END);
+ test_exec("xabcdefdefdefghi", 0, REG_OK, 1, 16, 10, 13, END);
+
+ test_comp("a?", REG_EXTENDED, REG_OK);
+ test_exec("aaaaa", 0, REG_OK, 0, 1, END);
+ test_exec("xaaaaa", 0, REG_OK, 0, 0, END);
+ test_comp("a+", REG_EXTENDED, REG_OK);
+ test_exec("aaaaa", 0, REG_OK, 0, 5, END);
+ test_exec("xaaaaa", 0, REG_OK, 1, 6, END);
+
+
+ /*
+ * Test anchors and their behaviour with the REG_NEWLINE compilation
+ * flag and the REG_NOTBOL, REG_NOTEOL execution flags.
+ */
+
+ /* Normally, `^' matches the empty string at beginning of input.
+ If REG_NOTBOL is used, `^' won't match the zero length string. */
+ test_comp("^abc", 0, 0);
+ test_exec("abcdef", 0, REG_OK, 0, 3, END);
+ test_exec("abcdef", REG_NOTBOL, REG_NOMATCH);
+ test_exec("xyzabcdef", 0, REG_NOMATCH);
+ test_exec("xyzabcdef", REG_NOTBOL, REG_NOMATCH);
+ test_exec("\nabcdef", 0, REG_NOMATCH);
+ test_exec("\nabcdef", REG_NOTBOL, REG_NOMATCH);
+
+ /* Normally, `$' matches the empty string at end of input.
+ If REG_NOTEOL is used, `$' won't match the zero length string. */
+ test_comp("abc$", 0, 0);
+ test_exec("defabc", 0, REG_OK, 3, 6, END);
+ test_exec("defabc", REG_NOTEOL, REG_NOMATCH);
+ test_exec("defabcxyz", 0, REG_NOMATCH);
+ test_exec("defabcxyz", REG_NOTEOL, REG_NOMATCH);
+ test_exec("defabc\n", 0, REG_NOMATCH);
+ test_exec("defabc\n", REG_NOTEOL, REG_NOMATCH);
+
+ test_comp("^abc$", 0, 0);
+ test_exec("abc", 0, REG_OK, 0, 3, END);
+ test_exec("abc", REG_NOTBOL, REG_NOMATCH);
+ test_exec("abc", REG_NOTEOL, REG_NOMATCH);
+ test_exec("abc", REG_NOTBOL | REG_NOTEOL, REG_NOMATCH);
+ test_exec("\nabc\n", 0, REG_NOMATCH);
+ test_exec("defabc\n", 0, REG_NOMATCH);
+ test_exec("\nabcdef", 0, REG_NOMATCH);
+ test_exec("abcdef", 0, REG_NOMATCH);
+ test_exec("defabc", 0, REG_NOMATCH);
+ test_exec("abc\ndef", 0, REG_NOMATCH);
+ test_exec("def\nabc", 0, REG_NOMATCH);
+
+ /* If REG_NEWLINE is used, `^' matches the empty string immediately after
+ a newline, regardless of whether execution flags contain REG_NOTBOL.
+ Similarly, if REG_NEWLINE is used, `$' matches the empty string
+ immediately before a newline, regardless of execution flags. */
+ test_comp("^abc", REG_NEWLINE, 0);
+ test_exec("abcdef", 0, REG_OK, 0, 3, END);
+ test_exec("abcdef", REG_NOTBOL, REG_NOMATCH);
+ test_exec("xyzabcdef", 0, REG_NOMATCH);
+ test_exec("xyzabcdef", REG_NOTBOL, REG_NOMATCH);
+ test_exec("\nabcdef", 0, REG_OK, 1, 4, END);
+ test_exec("\nabcdef", REG_NOTBOL, 0, 1, 4, END);
+ test_comp("abc$", REG_NEWLINE, 0);
+ test_exec("defabc", 0, REG_OK, 3, 6, END);
+ test_exec("defabc", REG_NOTEOL, REG_NOMATCH);
+ test_exec("defabcxyz", 0, REG_NOMATCH);
+ test_exec("defabcxyz", REG_NOTEOL, REG_NOMATCH);
+ test_exec("defabc\n", 0, REG_OK, 3, 6, END);
+ test_exec("defabc\n", REG_NOTEOL, 0, 3, 6, END);
+ test_comp("^abc$", REG_NEWLINE, 0);
+ test_exec("abc", 0, REG_OK, 0, 3, END);
+ test_exec("abc", REG_NOTBOL, REG_NOMATCH);
+ test_exec("abc", REG_NOTEOL, REG_NOMATCH);
+ test_exec("abc", REG_NOTBOL | REG_NOTEOL, REG_NOMATCH);
+ test_exec("\nabc\n", 0, REG_OK, 1, 4, END);
+ test_exec("defabc\n", 0, REG_NOMATCH);
+ test_exec("\nabcdef", 0, REG_NOMATCH);
+ test_exec("abcdef", 0, REG_NOMATCH);
+ test_exec("abcdef", REG_NOTBOL, REG_NOMATCH);
+ test_exec("defabc", 0, REG_NOMATCH);
+ test_exec("defabc", REG_NOTEOL, REG_NOMATCH);
+ test_exec("abc\ndef", 0, REG_OK, 0, 3, END);
+ test_exec("abc\ndef", REG_NOTBOL, REG_NOMATCH);
+ test_exec("abc\ndef", REG_NOTEOL, 0, 0, 3, END);
+ test_exec("abc\ndef", REG_NOTBOL | REG_NOTEOL, REG_NOMATCH);
+ test_exec("def\nabc", 0, REG_OK, 4, 7, END);
+ test_exec("def\nabc", REG_NOTBOL, 0, 4, 7, END);
+ test_exec("def\nabc", REG_NOTEOL, REG_NOMATCH);
+ test_exec("def\nabc", REG_NOTBOL | REG_NOTEOL, REG_NOMATCH);
+
+ /* With BRE syntax, `^' has a special meaning only at the beginning of the
+ RE or the beginning of a parenthesized subexpression. */
+ test_comp("a\\{0,1\\}^bc", 0, 0);
+ test_exec("bc", 0, REG_NOMATCH);
+ test_exec("^bc", 0, REG_OK, 0, 3, END);
+ test_exec("abc", 0, REG_NOMATCH);
+ test_exec("a^bc", 0, REG_OK, 0, 4, END);
+ test_comp("a\\{0,1\\}\\(^bc\\)", 0, 0);
+ test_exec("bc", 0, REG_OK, 0, 2, 0, 2, END);
+ test_exec("^bc", 0, REG_NOMATCH);
+ test_exec("abc", 0, REG_NOMATCH);
+ test_exec("a^bc", 0, REG_NOMATCH);
+ test_comp("(^a", 0, 0);
+ test_exec("(^a", 0, REG_OK, 0, 3, END);
+
+ /* With BRE syntax, `$' has a special meaning only at the end of the
+ RE or the end of a parenthesized subexpression. */
+ test_comp("ab$c\\{0,1\\}", 0, 0);
+ test_exec("ab", 0, REG_NOMATCH);
+ test_exec("ab$", 0, REG_OK, 0, 3, END);
+ test_exec("abc", 0, REG_NOMATCH);
+ test_exec("ab$c", 0, REG_OK, 0, 4, END);
+ test_comp("\\(ab$\\)c\\{0,1\\}", 0, 0);
+ test_exec("ab", 0, REG_OK, 0, 2, 0, 2, END);
+ test_exec("ab$", 0, REG_NOMATCH);
+ test_exec("abc", 0, REG_NOMATCH);
+ test_exec("ab$c", 0, REG_NOMATCH);
+ test_comp("a$)", 0, 0);
+ test_exec("a$)", 0, REG_OK, 0, 3, END);
+
+ /* Miscellaneous tests for `^' and `$'. */
+ test_comp("foo^$", REG_EXTENDED, 0);
+ test_exec("foo", 0, REG_NOMATCH);
+ test_comp("x$\n^y", REG_EXTENDED | REG_NEWLINE, 0);
+ test_exec("foo\nybarx\nyes\n", 0, REG_OK, 8, 11, END);
+ test_comp("^$", 0, 0);
+ test_exec("x", 0, REG_NOMATCH);
+ test_exec("", 0, REG_OK, 0, 0, END);
+ test_exec("\n", 0, REG_NOMATCH);
+ test_comp("^$", REG_NEWLINE, 0);
+ test_exec("x", 0, REG_NOMATCH);
+ test_exec("", 0, REG_OK, 0, 0, END);
+ test_exec("\n", 0, REG_OK, 0, 0, END);
+
+ /* REG_NEWLINE causes `.' not to match newlines. */
+ test_comp(".*", 0, 0);
+ test_exec("ab\ncd", 0, REG_OK, 0, 5, END);
+ test_comp(".*", REG_NEWLINE, 0);
+ test_exec("ab\ncd", 0, REG_OK, 0, 2, END);
+
+ /*
+ * Tests for nonstandard syntax extensions.
+ */
+
+ /* Zero width assertions. */
+ test_comp("\\<x", REG_EXTENDED, 0);
+ test_exec("aax xaa", 0, REG_OK, 4, 5, END);
+ test_exec("xaa", 0, REG_OK, 0, 1, END);
+ test_comp("x\\>", REG_EXTENDED, 0);
+ test_exec("axx xaa", 0, REG_OK, 2, 3, END);
+ test_exec("aax", 0, REG_OK, 2, 3, END);
+ test_comp("\\bx", REG_EXTENDED, 0);
+ test_exec("axx xaa", 0, REG_OK, 4, 5, END);
+ test_exec("aax", 0, REG_NOMATCH);
+ test_exec("xax", 0, REG_OK, 0, 1, END);
+ test_comp("x\\b", REG_EXTENDED, 0);
+ test_exec("axx xaa", 0, REG_OK, 2, 3, END);
+ test_exec("aax", 0, REG_OK, 2, 3, END);
+ test_exec("xaa", 0, REG_NOMATCH);
+ test_comp("\\Bx", REG_EXTENDED, 0);
+ test_exec("aax xxa", 0, REG_OK, 2, 3, END);
+ test_comp("\\Bx\\b", REG_EXTENDED, 0);
+ test_exec("aax xxx", 0, REG_OK, 2, 3, END);
+ test_comp("\\<.", REG_EXTENDED, 0);
+ test_exec(";xaa", 0, REG_OK, 1, 2, END);
+
+ /* Shorthands for character classes. */
+ test_comp("\\w+", REG_EXTENDED, 0);
+ test_exec(",.(a23_Nt-öo)", 0, REG_OK, 3, 9, END);
+ test_comp("\\d+", REG_EXTENDED, 0);
+ test_exec("uR120_4=v4", 0, REG_OK, 2, 5, END);
+ test_comp("\\D+", REG_EXTENDED, 0);
+ test_exec("120d_=vA4s", 0, REG_OK, 3, 8, END);
+
+ /* Quoted special characters. */
+ test_comp("\\t", REG_EXTENDED, 0);
+ test_comp("\\e", REG_EXTENDED, 0);
+
+ /* Test the \x1B and \x{263a} extensions for specifying 8 bit and wide
+ characters in hexadecimal. */
+ test_comp("\\x41", REG_EXTENDED, 0);
+ test_exec("ABC", 0, REG_OK, 0, 1, END);
+ test_comp("\\x5", REG_EXTENDED, 0);
+ test_exec("\005", 0, REG_OK, 0, 1, END);
+ test_comp("\\x5r", REG_EXTENDED, 0);
+ test_exec("\005r", 0, REG_OK, 0, 2, END);
+ test_comp("\\x", REG_EXTENDED, 0);
+ test_nexec("\000", 1, 0, REG_OK, 0, 1, END);
+ test_comp("\\xr", REG_EXTENDED, 0);
+ test_nexec("\000r", 2, 0, REG_OK, 0, 2, END);
+ test_comp("\\x{41}", REG_EXTENDED, 0);
+ test_exec("ABC", 0, REG_OK, 0, 1, END);
+ test_comp("\\x{5}", REG_EXTENDED, 0);
+ test_exec("\005", 0, REG_OK, 0, 1, END);
+ test_comp("\\x{5}r", REG_EXTENDED, 0);
+ test_exec("\005r", 0, REG_OK, 0, 2, END);
+ test_comp("\\x{}", REG_EXTENDED, 0);
+ test_nexec("\000", 1, 0, REG_OK, 0, 1, END);
+ test_comp("\\x{}r", REG_EXTENDED, 0);
+ test_nexec("\000r", 2, 0, REG_OK, 0, 2, END);
+
+ /* Tests for (?inrU-inrU) and (?inrU-inrU:) */
+ test_comp("foo(?i)bar", REG_EXTENDED, 0);
+ test_exec("fooBaR", 0, REG_OK, 0, 6, END);
+ test_comp("foo(?i)bar|zap", REG_EXTENDED, 0);
+ test_exec("fooBaR", 0, REG_OK, 0, 6, END);
+ test_exec("foozap", 0, REG_OK, 0, 6, END);
+ test_exec("foozAp", 0, REG_OK, 0, 6, END);
+ test_exec("zap", 0, REG_NOMATCH);
+ test_comp("foo(?-i:zap)zot", REG_EXTENDED | REG_ICASE, 0);
+ test_exec("FoOzapZOt", 0, REG_OK, 0, 9, END);
+ test_exec("FoOzApZOt", 0, REG_NOMATCH);
+ test_comp("foo(?i:bar|zap)", REG_EXTENDED, 0);
+ test_exec("foozap", 0, REG_OK, 0, 6, END);
+ test_exec("foobar", 0, REG_OK, 0, 6, END);
+ test_exec("foobAr", 0, REG_OK, 0, 6, END);
+ test_exec("fooZaP", 0, REG_OK, 0, 6, END);
+ test_comp("foo(?U:o*)(o*)", REG_EXTENDED, 0);
+ test_exec("foooo", 0, REG_OK, 0, 5, 3, 5, END);
+
+ /* Test comment syntax. */
+ test_comp("foo(?# This here is a comment. )bar", REG_EXTENDED, 0);
+ test_exec("foobar", 0, REG_OK, 0, 6, END);
+
+ /* Tests for \Q and \E. */
+ test_comp("\\((\\Q)?:\\<[^$\\E)", REG_EXTENDED, 0);
+ test_exec("()?:\\<[^$", 0, REG_OK, 0, 9, 1, 9, END);
+ test_comp("\\Qabc\\E.*", REG_EXTENDED, 0);
+ test_exec("abcdef", 0, REG_OK, 0, 6, END);
+ test_comp("\\Qabc\\E.*|foo", REG_EXTENDED, 0);
+ test_exec("parabc123wxyz", 0, REG_OK, 3, 13, END);
+ test_exec("fooabc123wxyz", 0, REG_OK, 0, 3, END);
+
+ /*
+ * Test bounded repetitions.
+ */
+
+ test_comp("a{0,0}", REG_EXTENDED, REG_OK);
+ test_exec("aaa", 0, REG_OK, 0, 0, END);
+ test_comp("a{0,1}", REG_EXTENDED, REG_OK);
+ test_exec("aaa", 0, REG_OK, 0, 1, END);
+ test_comp("a{1,1}", REG_EXTENDED, REG_OK);
+ test_exec("aaa", 0, REG_OK, 0, 1, END);
+ test_comp("a{1,3}", REG_EXTENDED, REG_OK);
+ test_exec("xaaaaa", 0, REG_OK, 1, 4, END);
+ test_comp("a{0,3}", REG_EXTENDED, REG_OK);
+ test_exec("aaaaa", 0, REG_OK, 0, 3, END);
+ test_comp("a{0,}", REG_EXTENDED, REG_OK);
+ test_exec("", 0, REG_OK, 0, 0, END);
+ test_exec("a", 0, REG_OK, 0, 1, END);
+ test_exec("aa", 0, REG_OK, 0, 2, END);
+ test_exec("aaa", 0, REG_OK, 0, 3, END);
+ test_comp("a{1,}", REG_EXTENDED, REG_OK);
+ test_exec("", 0, REG_NOMATCH);
+ test_exec("a", 0, REG_OK, 0, 1, END);
+ test_exec("aa", 0, REG_OK, 0, 2, END);
+ test_exec("aaa", 0, REG_OK, 0, 3, END);
+ test_comp("a{2,}", REG_EXTENDED, REG_OK);
+ test_exec("", 0, REG_NOMATCH);
+ test_exec("a", 0, REG_NOMATCH);
+ test_exec("aa", 0, REG_OK, 0, 2, END);
+ test_exec("aaa", 0, REG_OK, 0, 3, END);
+ test_comp("a{3,}", REG_EXTENDED, REG_OK);
+ test_exec("", 0, REG_NOMATCH);
+ test_exec("a", 0, REG_NOMATCH);
+ test_exec("aa", 0, REG_NOMATCH);
+ test_exec("aaa", 0, REG_OK, 0, 3, END);
+ test_exec("aaaa", 0, REG_OK, 0, 4, END);
+ test_exec("aaaaa", 0, REG_OK, 0, 5, END);
+ test_exec("aaaaaa", 0, REG_OK, 0, 6, END);
+ test_exec("aaaaaaa", 0, REG_OK, 0, 7, END);
+
+ test_comp("a{5,10}", REG_EXTENDED, REG_OK);
+ test_comp("a{6,6}", REG_EXTENDED, REG_OK);
+ test_exec("aaaaaaaaaaaa", 0, REG_OK, 0, 6, END);
+ test_exec("xxaaaaaaaaaaaa", 0, REG_OK, 2, 8, END);
+ test_exec("xxaaaaa", 0, REG_NOMATCH);
+ test_comp("a{5,6}", REG_EXTENDED, REG_OK);
+ test_exec("aaaaaaaaaaaa", 0, REG_OK, 0, 6, END);
+ test_exec("xxaaaaaaaaaaaa", 0, REG_OK, 2, 8, END);
+ test_exec("xxaaaaa", 0, REG_OK, 2, 7, END);
+ test_exec("xxaaaa", 0, REG_NOMATCH);
+
+ /* Trickier ones... */
+ test_comp("([ab]{5,10})*b", REG_EXTENDED, REG_OK);
+ test_exec("bbbbbabaaaaab", 0, REG_OK, 0, 13, 5, 12, END);
+ test_exec("bbbbbbaaaaab", 0, REG_OK, 0, 12, 5, 11, END);
+ test_exec("bbbbbbaaaab", 0, REG_OK, 0, 11, 0, 10, END);
+ test_exec("bbbbbbaaab", 0, REG_OK, 0, 10, 0, 9, END);
+ test_exec("bbbbbbaab", 0, REG_OK, 0, 9, 0, 8, END);
+ test_exec("bbbbbbab", 0, REG_OK, 0, 8, 0, 7, END);
+
+ test_comp("([ab]*)(ab[ab]{5,10})ba", REG_EXTENDED, REG_OK);
+ test_exec("abbabbbabaabbbbbbbbbbbbbabaaaabab", 0, REG_OK,
+ 0, 10, 0, 0, 0, 8, END);
+ test_exec("abbabbbabaabbbbbbbbbbbbabaaaaabab", 0, REG_OK,
+ 0, 32, 0, 23, 23, 30, END);
+ test_exec("abbabbbabaabbbbbbbbbbbbabaaaabab", 0, REG_OK,
+ 0, 24, 0, 10, 10, 22, END);
+ test_exec("abbabbbabaabbbbbbbbbbbba", 0, REG_OK,
+ 0, 24, 0, 10, 10, 22, END);
+
+ /* Test repeating something that has submatches inside. */
+ test_comp("(a){0,5}", REG_EXTENDED, 0);
+ test_exec("", 0, REG_OK, 0, 0, -1, -1, END);
+ test_exec("a", 0, REG_OK, 0, 1, 0, 1, END);
+ test_exec("aa", 0, REG_OK, 0, 2, 1, 2, END);
+ test_exec("aaa", 0, REG_OK, 0, 3, 2, 3, END);
+ test_exec("aaaa", 0, REG_OK, 0, 4, 3, 4, END);
+ test_exec("aaaaa", 0, REG_OK, 0, 5, 4, 5, END);
+ test_exec("aaaaaa", 0, REG_OK, 0, 5, 4, 5, END);
+
+ test_comp("(a){2,3}", REG_EXTENDED, 0);
+ test_exec("", 0, REG_NOMATCH);
+ test_exec("a", 0, REG_NOMATCH);
+ test_exec("aa", 0, REG_OK, 0, 2, 1, 2, END);
+ test_exec("aaa", 0, REG_OK, 0, 3, 2, 3, END);
+ test_exec("aaaa", 0, REG_OK, 0, 3, 2, 3, END);
+
+ test_comp("\\(a\\)\\{4\\}", 0, 0);
+ test_exec("aaaa", 0, REG_OK, 0, 4, 3, 4, END);
+
+ test_comp("\\(a*\\)\\{2\\}", 0, 0);
+ test_exec("a", 0, REG_OK, 0, 1, 1, 1, END);
+
+ test_comp("((..)|(.)){2}", REG_EXTENDED, 0);
+ test_exec("aa", 0, REG_OK, 0, 2, 1, 2, -1, -1, 1, 2, END);
+
+ /* Nested repeats. */
+ test_comp("(.){2}{3}", REG_EXTENDED, 0);
+ test_exec("xxxxx", 0, REG_NOMATCH);
+ test_exec("xxxxxx", 0, REG_OK, 0, 6, 5, 6, END);
+ test_comp("(..){2}{3}", REG_EXTENDED, 0);
+ test_exec("xxxxxxxxxxx", 0, REG_NOMATCH);
+ test_exec("xxxxxxxxxxxx", 0, REG_OK, 0, 12, 10, 12, END);
+ test_comp("((..){2}.){3}", REG_EXTENDED, 0);
+ test_exec("xxxxxxxxxxxxxx", 0, REG_NOMATCH);
+ test_exec("xxxxxxxxxxxxxxx", 0, REG_OK, 0, 15, 10, 15, 12, 14, END);
+ test_comp("((..){1,2}.){3}", REG_EXTENDED, 0);
+ test_exec("xxxxxxxx", 0, REG_NOMATCH);
+ test_exec("xxxxxxxxx", 0, REG_OK, 0, 9, 6, 9, 6, 8, END);
+ test_exec("xxxxxxxxxx", 0, REG_OK, 0, 9, 6, 9, 6, 8, END);
+ test_exec("xxxxxxxxxxx", 0, REG_OK, 0, 11, 8, 11, 8, 10, END);
+ test_comp("a{2}{2}x", REG_EXTENDED, 0);
+ test_exec("", 0, REG_NOMATCH);
+ test_exec("x", 0, REG_NOMATCH);
+ test_exec("ax", 0, REG_NOMATCH);
+ test_exec("aax", 0, REG_NOMATCH);
+ test_exec("aaax", 0, REG_NOMATCH);
+ test_exec("aaaax", 0, REG_OK, 0, 5, END);
+ test_exec("aaaaax", 0, REG_OK, 1, 6, END);
+ test_exec("aaaaaax", 0, REG_OK, 2, 7, END);
+ test_exec("aaaaaaax", 0, REG_OK, 3, 8, END);
+ test_exec("aaaaaaaax", 0, REG_OK, 4, 9, END);
+
+ /* Repeats with iterations inside. */
+ test_comp("([a-z]+){2,5}", REG_EXTENDED, 0);
+ test_exec("a\n", 0, REG_NOMATCH);
+ test_exec("aa\n", 0, REG_OK, 0, 2, 1, 2, END);
+
+ /* Multiple repeats in one regexp. */
+ test_comp("a{3}b{3}", REG_EXTENDED, 0);
+ test_exec("aaabbb", 0, REG_OK, 0, 6, END);
+ test_exec("aaabbbb", 0, REG_OK, 0, 6, END);
+ test_exec("aaaabbb", 0, REG_OK, 1, 7, END);
+ test_exec("aabbb", 0, REG_NOMATCH);
+ test_exec("aaabb", 0, REG_NOMATCH);
+
+ /* Test that different types of repetitions work correctly when used
+ in the same regexp. */
+ test_comp("a{2}{2}xb+xc*xd?x", REG_EXTENDED, 0);
+ test_exec("aaaaxbxcxdx", 0, REG_OK, 0, 11, END);
+ test_exec("aaaxbxcxdx", 0, REG_NOMATCH);
+ test_exec("aabxcxdx", 0, REG_NOMATCH);
+ test_exec("aaaacxdx", 0, REG_NOMATCH);
+ test_exec("aaaaxbdx", 0, REG_NOMATCH);
+ test_comp("^!packet [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3} [0-9]+",
+ REG_EXTENDED, 0);
+ test_exec("!packet 10.0.2.4 12765 ei voittoa", 0, REG_OK, 0, 22, END);
+
+ /*
+ * Back referencing tests.
+ */
+ test_comp("([a-z]*) \\1", REG_EXTENDED, 0);
+ test_exec("foobar foobar", 0, REG_OK, 0, 13, 0, 6, END);
+
+ /* Searching for a leftmost longest square (repeated string) */
+ test_comp("(.*)\\1", REG_EXTENDED, 0);
+ test_exec("foobarfoobar", 0, REG_OK, 0, 12, 0, 6, END);
+
+ test_comp("a(b)*c\\1", REG_EXTENDED, 0);
+ test_exec("acb", 0, REG_OK, 0, 2, -1, -1, END);
+ test_exec("abbcbbb", 0, REG_OK, 0, 5, 2, 3, END);
+ test_exec("abbdbd", 0, REG_NOMATCH);
+
+ test_comp("([a-c]*)\\1", REG_EXTENDED, 0);
+ test_exec("abcacdef", 0, REG_OK, 0, 0, 0, 0, END);
+ test_exec("abcabcabcd", 0, REG_OK, 0, 6, 0, 3, END);
+
+ test_comp("\\(a*\\)*\\(x\\)\\(\\1\\)", 0, 0);
+ test_exec("x", 0, REG_OK, 0, 1, 0, 0, 0, 1, 1, 1, END);
+#if KNOWN_BUG
+ test_exec("ax", 0, REG_OK, 0, 2, 1, 1, 1, 2, 2, 2, END);
+#endif
+
+ test_comp("(a)\\1{1,2}", REG_EXTENDED, 0);
+ test_exec("aabc", 0, REG_OK, 0, 2, 0, 1, END);
+
+ test_comp("((.*)\\1)+", REG_EXTENDED, 0);
+ test_exec("aa", 0, REG_OK, 0, 2, 0, 2, 0, 1, END);
+
+#if KNOWN_BUG
+ test_comp("()(\\1\\1)*", REG_EXTENDED, 0);
+ test_exec("", 0, REG_OK, 0, 0, 0, 0, 0, 0, END);
+#endif
+
+ /* Check that back references work with REG_NOSUB. */
+ test_comp("(o)\\1", REG_EXTENDED | REG_NOSUB, 0);
+ test_exec("foobar", 0, REG_OK, END);
+ test_comp("(o)\\1", REG_EXTENDED, 0);
+ test_exec("foobar", 0, REG_OK, 1, 3, 1, 2, END);
+ test_comp("(o)\\1", REG_EXTENDED, 0);
+ test_exec("fobar", 0, REG_NOMATCH);
+
+ test_comp("\\1foo", REG_EXTENDED, REG_ESUBREG);
+ test_comp("\\1foo(bar)", REG_EXTENDED, 0);
+
+ /* Back reference with zero-width assertion. */
+ test_comp("(.)\\1$", REG_EXTENDED, 0);
+ test_exec("foox", 0, REG_NOMATCH);
+ test_exec("foo", 0, REG_OK, 1, 3, 1, 2, END);
+
+ /* Back references together with {}. */
+ test_comp("([0-9]{5})\\1", REG_EXTENDED, 0);
+ test_exec("12345", 0, REG_NOMATCH);
+ test_exec("1234512345", 0, REG_OK, 0, 10, 0, 5, END);
+ test_comp("([0-9]{4})\\1", REG_EXTENDED, 0);
+ test_exec("1234", 0, REG_NOMATCH);
+ test_exec("12341234", 0, REG_OK, 0, 8, 0, 4, END);
+
+ /*
+ * Test minimal repetitions (non-greedy repetitions)
+ */
+ avoid_eflags = REG_BACKTRACKING_MATCHER | REG_APPROX_MATCHER;
+
+ /* Basic .*/
+ test_comp(".*?", REG_EXTENDED, 0);
+ test_exec("abcd", 0, REG_OK, 0, 0, END);
+ test_comp(".+?", REG_EXTENDED, 0);
+ test_exec("abcd", 0, REG_OK, 0, 1, END);
+ test_comp(".??", REG_EXTENDED, 0);
+ test_exec("abcd", 0, REG_OK, 0, 0, END);
+ test_comp(".{2,5}?", REG_EXTENDED, 0);
+ test_exec("abcd", 0, REG_OK, 0, 2, END);
+
+ /* More complicated. */
+ test_comp("<b>(.*?)</b>", REG_EXTENDED, 0);
+ test_exec("<b>text1</b><b>text2</b>", 0, REG_OK, 0, 12, 3, 8, END);
+ test_comp("a(.*?)(foo|bar|zap)", REG_EXTENDED, 0);
+ test_exec("hubba wooga-booga zabar gafoo wazap", 0, REG_OK,
+ 4, 23, 5, 20, 20, 23, END);
+
+ /* Test REG_UNGREEDY. */
+ test_comp(".*", REG_EXTENDED | REG_UNGREEDY, 0);
+ test_exec("abcd", 0, REG_OK, 0, 0, END);
+ test_comp(".*?", REG_EXTENDED | REG_UNGREEDY, 0);
+ test_exec("abcd", 0, REG_OK, 0, 4, END);
+
+ avoid_eflags = 0;
+
+
+ /*
+ * Error reporting tests.
+ */
+
+ test_comp("\\", REG_EXTENDED, REG_EESCAPE);
+ test_comp("\\\\", REG_EXTENDED, REG_OK);
+ test_exec("\\", 0, REG_OK, 0, 1, END);
+ test_comp("(", REG_EXTENDED, REG_EPAREN);
+ test_comp("(aaa", REG_EXTENDED, REG_EPAREN);
+ test_comp(")", REG_EXTENDED, REG_OK);
+ test_exec(")", 0, REG_OK, 0, 1, END);
+ test_comp("a{1", REG_EXTENDED, REG_EBRACE);
+ test_comp("a{1,x}", REG_EXTENDED, REG_BADBR);
+ test_comp("a{1x}", REG_EXTENDED, REG_BADBR);
+ test_comp("a{1,0}", REG_EXTENDED, REG_BADBR);
+ test_comp("a{x}", REG_EXTENDED, REG_BADBR);
+ test_comp("a{}", REG_EXTENDED, REG_BADBR);
+
+
+ test_comp("\\", 0, REG_EESCAPE);
+ test_comp("\\(", 0, REG_EPAREN);
+ test_comp("\\)", 0, REG_EPAREN);
+ test_comp("a\\{1", 0, REG_EBRACE);
+ test_comp("a\\{1,x\\}", 0, REG_BADBR);
+ test_comp("a\\{1x\\}", 0, REG_BADBR);
+ test_comp("a\\{1,0\\}", 0, REG_BADBR);
+ test_comp("a\\{x\\}", 0, REG_BADBR);
+ test_comp("a\\{\\}", 0, REG_BADBR);
+
+
+
+
+ /*
+ * Internationalization tests.
+ */
+
+ /* This same test with the correct locale is below. */
+ test_comp("µ¡+", REG_EXTENDED, 0);
+ test_exec("¤³¤Î¾Þ¤Ï¡¢µ¡¡¦ÍøÊØÀ­¡¦¥»¥­", 0, REG_OK, 10, 13, END);
+
+#if !defined(WIN32) && !defined(__OpenBSD__)
+ if (setlocale(LC_CTYPE, "en_US.ISO-8859-1") != NULL)
+ {
+ printf("\nTesting LC_CTYPE en_US.ISO-8859-1\n");
+ test_comp("aBCdeFghiJKlmnoPQRstuvWXyZåäö", REG_ICASE, 0);
+ test_exec("abCDefGhiJKlmNoPqRStuVwXyzÅÄÖ", 0, REG_OK, 0, 29, END);
+ }
+
+#ifdef TRE_MULTIBYTE
+ if (setlocale(LC_CTYPE, "ja_JP.eucjp") != NULL)
+ {
+ printf("\nTesting LC_CTYPE ja_JP.eucjp\n");
+ /* I tried to make a test where implementations not aware of multibyte
+ character sets will fail. I have no idea what the japanese text here
+ means, I took it from http://www.ipsec.co.jp/. */
+ test_comp("µ¡+", REG_EXTENDED, 0);
+ test_exec("¤³¤Î¾Þ¤Ï¡¢µ¡¡¦ÍøÊØÀ­¡¦¥»¥­", 0, REG_OK, 10, 12, END);
+
+ test_comp("a", REG_EXTENDED, 0);
+ test_nexec("foo\000bar", 7, 0, REG_OK, 5, 6, END);
+ test_comp("c$", REG_EXTENDED, 0);
+ test_exec("abc", 0, REG_OK, 2, 3, END);
+ }
+#endif /* TRE_MULTIBYTE */
+#endif
+
+ tre_regfree(&reobj);
+
+ printf("\n");
+ if (comp_errors || exec_errors)
+ printf("%d (%d + %d) out of %d tests FAILED!\n",
+ comp_errors + exec_errors, comp_errors, exec_errors,
+ comp_tests + exec_tests);
+ else
+ printf("All %d tests passed.\n", comp_tests + exec_tests);
+
+
+#ifdef MALLOC_DEBUGGING
+ if (xmalloc_dump_leaks())
+ return 1;
+#endif /* MALLOC_DEBUGGING */
+
+ return comp_errors || exec_errors;
+}
+
+/* EOF */
diff --git a/tests/test-str-source.c b/tests/test-str-source.c
new file mode 100644
index 0000000000000..69cfae5de7157
--- /dev/null
+++ b/tests/test-str-source.c
@@ -0,0 +1,134 @@
+/*
+ test-str-source.c - Sample program for using tre_reguexec()
+
+ This software is released under a BSD-style license.
+ See the file LICENSE for details and copyright.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* HAVE_CONFIG_H */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "regex.h"
+#include "tre-internal.h"
+
+/* Context structure for the tre_str_source wrappers. */
+typedef struct {
+ /* Our string. */
+ const char *str;
+ /* Current position in the string. */
+ size_t pos;
+} str_handler_ctx;
+
+/* The get_next_char() handler. Sets `c' to the value of the next character,
+ and increases `pos_add' by the number of bytes read. Returns 1 if the
+ string has ended, 0 if there are more characters. */
+static int
+str_handler_get_next(tre_char_t *c, unsigned int *pos_add, void *context)
+{
+ str_handler_ctx *ctx = context;
+ unsigned char ch = ctx->str[ctx->pos];
+
+ printf("str[%lu] = %d\n", (unsigned long)ctx->pos, ch);
+ *c = ch;
+ if (ch)
+ ctx->pos++;
+ *pos_add = 1;
+
+ return ch == '\0';
+}
+
+/* The rewind() handler. Resets the current position in the input string. */
+static void
+str_handler_rewind(size_t pos, void *context)
+{
+ str_handler_ctx *ctx = context;
+
+ printf("rewind to %lu\n", (unsigned long)pos);
+ ctx->pos = pos;
+}
+
+/* The compare() handler. Compares two substrings in the input and returns
+ 0 if the substrings are equal, and a nonzero value if not. */
+static int
+str_handler_compare(size_t pos1, size_t pos2, size_t len, void *context)
+{
+ str_handler_ctx *ctx = context;
+ printf("comparing %lu-%lu and %lu-%lu\n",
+ (unsigned long)pos1, (unsigned long)pos1 + len,
+ (unsigned long)pos2, (unsigned long)pos2 + len);
+ return strncmp(ctx->str + pos1, ctx->str + pos2, len);
+}
+
+/* Creates a tre_str_source wrapper around the string `str'. Returns the
+ tre_str_source object or NULL if out of memory. */
+static tre_str_source *
+make_str_source(const char *str)
+{
+ tre_str_source *s;
+ str_handler_ctx *ctx;
+
+ s = calloc(1, sizeof(*s));
+ if (!s)
+ return NULL;
+
+ ctx = malloc(sizeof(str_handler_ctx));
+ if (!ctx)
+ {
+ free(s);
+ return NULL;
+ }
+
+ ctx->str = str;
+ ctx->pos = 0;
+ s->context = ctx;
+ s->get_next_char = str_handler_get_next;
+ s->rewind = str_handler_rewind;
+ s->compare = str_handler_compare;
+
+ return s;
+}
+
+/* Frees the memory allocated for `s'. */
+static void
+free_str_source(tre_str_source *s)
+{
+ free(s->context);
+ free(s);
+}
+
+/* Run one test with tre_reguexec */
+static void
+test_reguexec(const char *str, const char *regex)
+{
+ regex_t preg;
+ tre_str_source *source;
+ regmatch_t pmatch[5];
+
+ source = make_str_source(str);
+ if (!source)
+ return;
+
+ tre_regcomp(&preg, regex, REG_EXTENDED);
+ if (tre_reguexec(&preg, source, elementsof(pmatch), pmatch, 0) == 0)
+ printf("Match: %d - %d\n", (int)pmatch[0].rm_so, (int)pmatch[0].rm_eo);
+
+ free_str_source(source);
+ tre_regfree(&preg);
+}
+
+int
+main(int argc, char **argv)
+{
+ test_reguexec("xfoofofoofoo","(foo)\\1");
+ test_reguexec("catcat","(cat|dog)\\1");
+ test_reguexec("catdog","(cat|dog)\\1");
+ test_reguexec("dogdog","(cat|dog)\\1");
+ test_reguexec("dogcat","(cat|dog)\\1");
+
+ return 0;
+}