2014-07-15 04:46:12 -04:00
|
|
|
#! /bin/sh
|
|
|
|
|
2014-10-17 11:52:57 -04:00
|
|
|
# Run pcre2grep tests. The assumption is that the PCRE2 tests check the library
|
2014-07-15 04:46:12 -04:00
|
|
|
# itself. What we are checking here is the file handling and options that are
|
|
|
|
# supported by pcre2grep. This script must be run in the build directory.
|
|
|
|
|
2018-08-13 07:57:09 -04:00
|
|
|
# CODING CONVENTIONS:
|
2018-06-20 13:05:31 -04:00
|
|
|
# * Put printf arguments in single, not double quotes to avoid unwanted
|
|
|
|
# escaping.
|
2018-08-13 07:57:09 -04:00
|
|
|
# * Use \0 for binary zero in printf, not \x0, for the benefit of older
|
2019-05-28 10:14:22 -04:00
|
|
|
# versions (and use octal for other special values).
|
2018-06-20 13:05:31 -04:00
|
|
|
|
2014-07-15 04:46:12 -04:00
|
|
|
# Set the C locale, so that sort(1) behaves predictably.
|
|
|
|
|
|
|
|
LC_ALL=C
|
|
|
|
export LC_ALL
|
|
|
|
|
|
|
|
# Remove any non-default colouring and aliases that the caller may have set.
|
|
|
|
|
2016-12-31 12:46:40 -05:00
|
|
|
unset PCRE2GREP_COLOUR PCRE2GREP_COLOR PCREGREP_COLOUR PCREGREP_COLOR
|
|
|
|
unset GREP_COLOR GREP_COLORS
|
2014-07-15 04:46:12 -04:00
|
|
|
unset cp ls mv rm
|
|
|
|
|
|
|
|
# Remember the current (build) directory, set the program to be tested, and
|
|
|
|
# valgrind settings when requested.
|
|
|
|
|
|
|
|
builddir=`pwd`
|
|
|
|
pcre2grep=$builddir/pcre2grep
|
2015-09-08 13:01:17 -04:00
|
|
|
pcre2test=$builddir/pcre2test
|
2014-07-15 04:46:12 -04:00
|
|
|
|
2014-08-29 11:24:33 -04:00
|
|
|
if [ ! -x $pcre2grep ] ; then
|
2016-12-29 10:57:38 -05:00
|
|
|
echo "** $pcre2grep does not exist or is not executable."
|
2014-08-29 11:24:33 -04:00
|
|
|
exit 1
|
2014-10-20 13:28:49 -04:00
|
|
|
fi
|
2014-08-29 11:24:33 -04:00
|
|
|
|
2015-09-08 13:01:17 -04:00
|
|
|
if [ ! -x $pcre2test ] ; then
|
2016-12-29 10:57:38 -05:00
|
|
|
echo "** $pcre2test does not exist or is not executable."
|
2015-09-08 13:01:17 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-07-15 04:46:12 -04:00
|
|
|
valgrind=
|
|
|
|
while [ $# -gt 0 ] ; do
|
|
|
|
case $1 in
|
2016-05-31 07:36:10 -04:00
|
|
|
valgrind) valgrind="valgrind -q --leak-check=no --smc-check=all-non-file";;
|
2014-07-15 04:46:12 -04:00
|
|
|
*) echo "RunGrepTest: Unknown argument $1"; exit 1;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2016-05-31 07:36:10 -04:00
|
|
|
vjs=
|
2014-07-15 04:46:12 -04:00
|
|
|
pcre2grep_version=`$pcre2grep -V`
|
|
|
|
if [ "$valgrind" = "" ] ; then
|
|
|
|
echo "Testing $pcre2grep_version"
|
|
|
|
else
|
|
|
|
echo "Testing $pcre2grep_version using valgrind"
|
2016-05-31 07:36:10 -04:00
|
|
|
$pcre2test -C jit >/dev/null
|
|
|
|
if [ $? -ne 0 ]; then
|
2016-06-29 12:52:05 -04:00
|
|
|
vjs="--suppressions=./testdata/valgrind-jit.supp"
|
|
|
|
fi
|
2014-07-15 04:46:12 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Set up a suitable "diff" command for comparison. Some systems have a diff
|
|
|
|
# that lacks a -u option. Try to deal with this; better do the test for the -b
|
|
|
|
# option as well.
|
|
|
|
|
|
|
|
cf="diff"
|
|
|
|
diff -b /dev/null /dev/null 2>/dev/null && cf="diff -b"
|
|
|
|
diff -u /dev/null /dev/null 2>/dev/null && cf="diff -u"
|
|
|
|
diff -ub /dev/null /dev/null 2>/dev/null && cf="diff -ub"
|
|
|
|
|
|
|
|
# If this test is being run from "make check", $srcdir will be set. If not, set
|
|
|
|
# it to the current or parent directory, whichever one contains the test data.
|
|
|
|
# Subsequently, we run most of the pcre2grep tests in the source directory so
|
|
|
|
# that the file names in the output are always the same.
|
|
|
|
|
|
|
|
if [ -z "$srcdir" -o ! -d "$srcdir/testdata" ] ; then
|
|
|
|
if [ -d "./testdata" ] ; then
|
|
|
|
srcdir=.
|
|
|
|
elif [ -d "../testdata" ] ; then
|
|
|
|
srcdir=..
|
|
|
|
else
|
|
|
|
echo "Cannot find the testdata directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check for the availability of UTF-8 support
|
|
|
|
|
2015-09-08 13:01:17 -04:00
|
|
|
$pcre2test -C unicode >/dev/null
|
2014-07-15 04:46:12 -04:00
|
|
|
utf8=$?
|
|
|
|
|
2015-09-08 13:01:17 -04:00
|
|
|
# Check default newline convention. If it does not include LF, force LF.
|
|
|
|
|
|
|
|
nl=`$pcre2test -C newline`
|
|
|
|
if [ "$nl" != "LF" -a "$nl" != "ANY" -a "$nl" != "ANYCRLF" ]; then
|
|
|
|
pcre2grep="$pcre2grep -N LF"
|
2015-12-17 13:44:06 -05:00
|
|
|
echo "Default newline setting forced to LF"
|
2015-09-08 13:01:17 -04:00
|
|
|
fi
|
|
|
|
|
2014-10-31 08:34:34 -04:00
|
|
|
# ------ Function to run and check a special pcre2grep arguments test -------
|
|
|
|
|
|
|
|
checkspecial()
|
|
|
|
{
|
2015-09-08 13:01:17 -04:00
|
|
|
$valgrind $pcre2grep $1 >>testtrygrep 2>&1
|
2014-10-31 08:34:34 -04:00
|
|
|
if [ $? -ne $2 ] ; then
|
|
|
|
echo "** pcre2grep $1 failed - check testtrygrep"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
2014-11-03 12:13:00 -05:00
|
|
|
|
|
|
|
# ------ Normal tests ------
|
2014-10-31 08:34:34 -04:00
|
|
|
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "Testing pcre2grep main features"
|
|
|
|
|
|
|
|
echo "---------------------------- Test 1 ------------------------------" >testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep PATTERN ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 2 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep '^PATTERN' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 3 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -in PATTERN ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 4 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -ic PATTERN ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 5 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -in PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 6 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -inh PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 7 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -il PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 8 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -l PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 9 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -q PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 10 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -q NEVER-PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 11 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -vn pattern ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 12 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -ix pattern ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 13 -----------------------------" >>testtrygrep
|
|
|
|
echo seventeen >testtemp1grep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -f./testdata/greplist -f $builddir/testtemp1grep ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 14 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -w pat ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 15 -----------------------------" >>testtrygrep
|
2018-12-06 12:13:41 -05:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep 'abc^*' ./testdata/grepinput) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 16 -----------------------------" >>testtrygrep
|
2018-12-06 12:13:41 -05:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep abc ./testdata/grepinput ./testdata/nonexistfile) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 17 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -M 'the\noutput' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 18 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -Mn '(the\noutput|dog\.\n--)' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 19 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -Mix 'Pattern' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 20 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -Mixn 'complete pair\nof lines' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 21 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -nA3 'four' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 22 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -nB3 'four' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 23 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -C3 'four' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 24 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -A9 'four' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 25 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -nB9 'four' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 26 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -A9 -B9 'four' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 27 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -A10 'four' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 28 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -nB10 'four' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 29 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -C12 -B10 'four' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 30 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -inB3 'pattern' ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 31 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -inA3 'pattern' ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 32 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -L 'fox' ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 33 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep 'fox' ./testdata/grepnonexist) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 34 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -s 'fox' ./testdata/grepnonexist) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 35 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include=grepinputx --include grepinput8 --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 36 -----------------------------" >>testtrygrep
|
2017-11-13 11:52:39 -05:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include=grepinput --exclude 'grepinput$' --exclude=grepinput8 --exclude=grepinputM --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 37 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep '^(a+)*\d' ./testdata/grepinput) >>testtrygrep 2>teststderrgrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
echo "======== STDERR ========" >>testtrygrep
|
|
|
|
cat teststderrgrep >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 38 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep '>\x00<' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 39 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -A1 'before the binary zero' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 40 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -B1 'after the binary zero' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 41 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -B1 -o '\w+ the binary zero' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 42 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -B1 -onH '\w+ the binary zero' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 43 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -on 'before|zero|after' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 44 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -on -e before -ezero -e after ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 45 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -on -f ./testdata/greplist -e binary ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 46 ------------------------------" >>testtrygrep
|
2018-12-06 12:13:41 -05:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -eabc -e '(unclosed' ./testdata/grepinput) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 47 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -Fx "AB.VE
|
2014-07-15 04:46:12 -04:00
|
|
|
elephant" ./testdata/grepinput) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 48 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -F "AB.VE
|
2014-07-15 04:46:12 -04:00
|
|
|
elephant" ./testdata/grepinput) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 49 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -F -e DATA -e "AB.VE
|
2014-07-15 04:46:12 -04:00
|
|
|
elephant" ./testdata/grepinput) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 50 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 51 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -Mv "brown\sfox" ./testdata/grepinputv) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 52 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --colour=always jumps ./testdata/grepinputv) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 53 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --file-offsets 'before|zero|after' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 54 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --line-offsets 'before|zero|after' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 55 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -f./testdata/greplist --color=always ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 56 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -c lazy ./testdata/grepinput*) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 57 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -c -l lazy ./testdata/grepinput*) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 58 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --regex=PATTERN ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 59 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --regexp=PATTERN ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 60 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --regex PATTERN ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 61 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --regexp PATTERN ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 62 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $pcre2grep --match-limit=1000 --no-jit -M 'This is a file(.|\R)*file.' ./testdata/grepinput) >>testtrygrep 2>&1
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 63 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $pcre2grep --recursion-limit=1000 --no-jit -M 'This is a file(.|\R)*file.' ./testdata/grepinput) >>testtrygrep 2>&1
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 64 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o1 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 65 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o2 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 66 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o3 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 67 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o12 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 68 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --only-matching=2 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 69 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -vn --colour=always pattern ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 70 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --color=always -M "triple:\t.*\n\n" ./testdata/grepinput3) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
2017-11-13 11:52:39 -05:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --color=always -M -n "triple:\t.*\n\n" ./testdata/grepinput3) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -M "triple:\t.*\n\n" ./testdata/grepinput3) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -M -n "triple:\t.*\n\n" ./testdata/grepinput3) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
|
|
|
|
echo "---------------------------- Test 71 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o "^01|^02|^03" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 72 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --color=always "^01|^02|^03" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 73 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o --colour=always "^01|^02|^03" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 74 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o "^01|02|^03" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 75 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --color=always "^01|02|^03" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 76 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o --colour=always "^01|02|^03" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 77 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o "^01|^02|03" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 78 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --color=always "^01|^02|03" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 79 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o --colour=always "^01|^02|03" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 80 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o "\b01|\b02" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 81 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --color=always "\\b01|\\b02" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 82 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o --colour=always "\\b01|\\b02" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 83 -----------------------------" >>testtrygrep
|
2016-10-11 12:40:09 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --buffer-size=10 --max-buffer-size=100 "^a" ./testdata/grepinput3) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 84 -----------------------------" >>testtrygrep
|
|
|
|
echo testdata/grepinput3 >testtemp1grep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --file-list ./testdata/grepfilelist --file-list $builddir/testtemp1grep "fox|complete|t7") >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 85 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --file-list=./testdata/grepfilelist "dolor" ./testdata/grepinput3) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 86 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 87 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep "cat" ./testdata/grepbinary) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 88 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -v "cat" ./testdata/grepbinary) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 89 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -I "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 90 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --binary-files=without-match "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 91 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -a "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 92 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --binary-files=text "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 93 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --text "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 94 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include=grepinputx --include grepinput8 'fox' ./testdata/grepinput* | sort) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 95 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --file-list ./testdata/grepfilelist --exclude grepinputv "fox|complete") >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 96 -----------------------------" >>testtrygrep
|
2017-11-13 11:52:39 -05:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include-dir=testdata --exclude '^(?!grepinput)' --exclude=grepinputM 'fox' ./test* | sort) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 97 -----------------------------" >>testtrygrep
|
|
|
|
echo "grepinput$" >testtemp1grep
|
|
|
|
echo "grepinput8" >>testtemp1grep
|
2017-11-13 11:52:39 -05:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include=grepinput --exclude=grepinputM --exclude-from $builddir/testtemp1grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 98 -----------------------------" >>testtrygrep
|
|
|
|
echo "grepinput$" >testtemp1grep
|
|
|
|
echo "grepinput8" >>testtemp1grep
|
2017-11-13 11:52:39 -05:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --exclude=grepinput3 --exclude=grepinputM --include=grepinput --exclude-from $builddir/testtemp1grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 99 -----------------------------" >>testtrygrep
|
|
|
|
echo "grepinput$" >testtemp1grep
|
|
|
|
echo "grepinput8" >testtemp2grep
|
2017-11-13 11:52:39 -05:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include grepinput --exclude=grepinputM --exclude-from $builddir/testtemp1grep --exclude-from=$builddir/testtemp2grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 100 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -Ho2 --only-matching=1 -o3 '(\w+) binary (\w+)(\.)?' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 101 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o3 -Ho2 -o12 --only-matching=1 -o3 --colour=always --om-separator='|' '(\w+) binary (\w+)(\.)?' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 102 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -n "^$" ./testdata/grepinput3) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 103 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --only-matching "^$" ./testdata/grepinput3) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 104 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -n --only-matching "^$" ./testdata/grepinput3) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 105 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --colour=always "ipsum|" ./testdata/grepinput3) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 106 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; echo "a" | $valgrind $vjs $pcre2grep -M "|a" ) >>testtrygrep 2>&1
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2015-04-03 07:14:19 -04:00
|
|
|
echo "---------------------------- Test 107 -----------------------------" >>testtrygrep
|
|
|
|
echo "a" >testtemp1grep
|
|
|
|
echo "aaaaa" >>testtemp1grep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --line-offsets '(?<=\Ka)' $builddir/testtemp1grep) >>testtrygrep 2>&1
|
2015-04-03 07:14:19 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
|
2015-08-05 13:35:36 -04:00
|
|
|
echo "---------------------------- Test 108 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -lq PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2015-08-05 13:35:36 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 109 -----------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -cq lazy ./testdata/grepinput*) >>testtrygrep
|
2015-08-05 13:35:36 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2016-06-17 13:37:26 -04:00
|
|
|
echo "---------------------------- Test 110 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --om-separator / -Mo0 -o1 -o2 'match (\d+):\n (.)\n' testdata/grepinput) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 111 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --line-offsets -M 'match (\d+):\n (.)\n' testdata/grepinput) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 112 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --file-offsets -M 'match (\d+):\n (.)\n' testdata/grepinput) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2016-10-16 12:48:14 -04:00
|
|
|
echo "---------------------------- Test 113 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --total-count 'the' testdata/grepinput*) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 114 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -tc 'the' testdata/grepinput*) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 115 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -tlc 'the' testdata/grepinput*) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 116 -----------------------------" >>testtrygrep
|
2017-11-13 11:52:39 -05:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --exclude=grepinputM -th 'the' testdata/grepinput*) >>testtrygrep
|
2016-10-16 12:48:14 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 117 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -tch 'the' testdata/grepinput*) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 118 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -tL 'the' testdata/grepinput*) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2017-02-10 12:39:29 -05:00
|
|
|
echo "---------------------------- Test 119 -----------------------------" >>testtrygrep
|
2018-06-20 13:05:31 -04:00
|
|
|
printf '123\n456\n789\n---abc\ndef\nxyz\n---\n' >testNinputgrep
|
2017-02-12 08:54:45 -05:00
|
|
|
$valgrind $vjs $pcre2grep -Mo '(\n|[^-])*---' testNinputgrep >>testtrygrep
|
2017-02-10 12:39:29 -05:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2017-04-06 14:02:40 -04:00
|
|
|
echo "---------------------------- Test 120 ------------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -HO '$0:$2$1$3' '(\w+) binary (\w+)(\.)?' ./testdata/grepinput) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2017-06-17 07:32:06 -04:00
|
|
|
echo "---------------------------- Test 121 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -F '\E and (regex)' testdata/grepinputv) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 122 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -w 'cat|dog' testdata/grepinputv) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2017-11-13 11:52:39 -05:00
|
|
|
echo "---------------------------- Test 123 -----------------------------" >>testtrygrep
|
2017-06-17 07:32:06 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -w 'dog|cat' testdata/grepinputv) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2017-11-13 11:52:39 -05:00
|
|
|
echo "---------------------------- Test 124 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -Mn --colour=always 'start[\s]+end' testdata/grepinputM) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -Mn --colour=always -A2 'start[\s]+end' testdata/grepinputM) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -Mn 'start[\s]+end' testdata/grepinputM) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -Mn -A2 'start[\s]+end' testdata/grepinputM) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2017-12-26 10:10:04 -05:00
|
|
|
echo "---------------------------- Test 125 -----------------------------" >>testtrygrep
|
2018-06-20 13:05:31 -04:00
|
|
|
printf 'abcd\n' >testNinputgrep
|
2017-12-26 10:10:04 -05:00
|
|
|
$valgrind $vjs $pcre2grep --colour=always '(?<=\K.)' testNinputgrep >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
$valgrind $vjs $pcre2grep --colour=always '(?=.\K)' testNinputgrep >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
$valgrind $vjs $pcre2grep --colour=always '(?<=\K[ac])' testNinputgrep >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
$valgrind $vjs $pcre2grep --colour=always '(?=[ac]\K)' testNinputgrep >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2018-02-24 12:09:19 -05:00
|
|
|
echo "---------------------------- Test 126 -----------------------------" >>testtrygrep
|
2018-06-20 13:05:31 -04:00
|
|
|
printf 'Next line pattern has binary zero\nABC\0XYZ\n' >testtemp1grep
|
|
|
|
printf 'ABC\0XYZ\nABCDEF\nDEFABC\n' >testtemp2grep
|
2018-02-24 12:09:19 -05:00
|
|
|
$valgrind $vjs $pcre2grep -a -f testtemp1grep testtemp2grep >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2019-06-15 11:51:07 -04:00
|
|
|
echo "---------------------------- Test 127 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o --om-capture=0 'pattern()()()()' testdata/grepinput) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 128 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o1 --om-capture=0 'pattern()()()()' testdata/grepinput) >>testtrygrep 2>&1
|
|
|
|
echo "RC=$?" >>testtrygrep
|
2017-06-17 07:32:06 -04:00
|
|
|
|
2020-10-04 12:34:31 -04:00
|
|
|
echo "---------------------------- Test 129 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -m 2 'fox' testdata/grepinput) >>testtrygrep 2>&1
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 130 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o -m2 'fox' testdata/grepinput) >>testtrygrep 2>&1
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 131 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -oc -m2 'fox' testdata/grepinput) >>testtrygrep 2>&1
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 132 -----------------------------" >>testtrygrep
|
2020-11-06 12:27:35 -05:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -m1 -A3 '^match'; echo '---'; head -1) <$srcdir/testdata/grepinput >>testtrygrep 2>&1
|
2020-10-04 12:34:31 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 133 -----------------------------" >>testtrygrep
|
2020-11-06 12:27:35 -05:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -m1 -O '=$x{41}$x423$o{103}$o1045=' 'fox') <$srcdir/testdata/grepinputv >>testtrygrep 2>&1
|
2020-10-04 12:34:31 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2014-07-15 04:46:12 -04:00
|
|
|
# Now compare the results.
|
|
|
|
|
|
|
|
$cf $srcdir/testdata/grepoutput testtrygrep
|
|
|
|
if [ $? != 0 ] ; then exit 1; fi
|
|
|
|
|
|
|
|
|
|
|
|
# These tests require UTF-8 support
|
|
|
|
|
|
|
|
if [ $utf8 -ne 0 ] ; then
|
|
|
|
echo "Testing pcre2grep UTF-8 features"
|
|
|
|
|
|
|
|
echo "---------------------------- Test U1 ------------------------------" >testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -n -u --newline=any "^X" ./testdata/grepinput8) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test U2 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -n -u -C 3 --newline=any "Match" ./testdata/grepinput8) >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2015-04-03 07:14:19 -04:00
|
|
|
echo "---------------------------- Test U3 ------------------------------" >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --line-offsets -u --newline=any '(?<=\K\x{17f})' ./testdata/grepinput8) >>testtrygrep
|
2015-04-03 07:14:19 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
2019-10-17 12:39:38 -04:00
|
|
|
|
2019-05-28 10:14:22 -04:00
|
|
|
echo "---------------------------- Test U4 ------------------------------" >>testtrygrep
|
|
|
|
printf 'A\341\200\200\200CD\342\200\200Z\n' >testtemp1grep
|
2019-10-15 11:23:31 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -u -o '....' $builddir/testtemp1grep) >>testtrygrep 2>&1
|
2019-05-28 10:14:22 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test U5 ------------------------------" >>testtrygrep
|
|
|
|
printf 'A\341\200\200\200CD\342\200\200Z\n' >testtemp1grep
|
2019-10-15 11:23:31 -04:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -U -o '....' $builddir/testtemp1grep) >>testtrygrep
|
2019-05-28 10:14:22 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
2015-04-03 07:14:19 -04:00
|
|
|
|
2020-10-04 12:34:31 -04:00
|
|
|
echo "---------------------------- Test U6 -----------------------------" >>testtrygrep
|
2020-11-06 12:27:35 -05:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -u -m1 -O '=$x{1d3}$o{744}=' 'fox') <$srcdir/testdata/grepinputv >>testtrygrep 2>&1
|
2020-10-04 12:34:31 -04:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2014-07-15 04:46:12 -04:00
|
|
|
$cf $srcdir/testdata/grepoutput8 testtrygrep
|
|
|
|
if [ $? != 0 ] ; then exit 1; fi
|
|
|
|
|
|
|
|
else
|
2014-10-17 11:52:57 -04:00
|
|
|
echo "Skipping pcre2grep UTF-8 tests: no UTF-8 support in PCRE2 library"
|
2014-07-15 04:46:12 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# We go to some contortions to try to ensure that the tests for the various
|
|
|
|
# newline settings will work in environments where the normal newline sequence
|
|
|
|
# is not \n. Do not use exported files, whose line endings might be changed.
|
|
|
|
# Instead, create an input file using printf so that its contents are exactly
|
|
|
|
# what we want. Note the messy fudge to get printf to write a string that
|
|
|
|
# starts with a hyphen. These tests are run in the build directory.
|
|
|
|
|
|
|
|
echo "Testing pcre2grep newline settings"
|
2018-06-20 13:05:31 -04:00
|
|
|
printf 'abc\rdef\r\nghi\njkl' >testNinputgrep
|
2014-07-15 04:46:12 -04:00
|
|
|
|
2018-06-20 13:05:31 -04:00
|
|
|
printf '%c--------------------------- Test N1 ------------------------------\r\n' - >testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
$valgrind $vjs $pcre2grep -n -N CR "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
|
2018-06-20 13:05:31 -04:00
|
|
|
printf '%c--------------------------- Test N2 ------------------------------\r\n' - >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
$valgrind $vjs $pcre2grep -n --newline=crlf "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
|
2018-06-20 13:05:31 -04:00
|
|
|
printf '%c--------------------------- Test N3 ------------------------------\r\n' - >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
pattern=`printf 'def\rjkl'`
|
2016-05-31 07:36:10 -04:00
|
|
|
$valgrind $vjs $pcre2grep -n --newline=cr -F "$pattern" testNinputgrep >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
|
2018-06-20 13:05:31 -04:00
|
|
|
printf '%c--------------------------- Test N4 ------------------------------\r\n' - >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
$valgrind $vjs $pcre2grep -n --newline=crlf -F -f $srcdir/testdata/greppatN4 testNinputgrep >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
|
2018-06-20 13:05:31 -04:00
|
|
|
printf '%c--------------------------- Test N5 ------------------------------\r\n' - >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
$valgrind $vjs $pcre2grep -n --newline=any "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
|
2018-06-20 13:05:31 -04:00
|
|
|
printf '%c--------------------------- Test N6 ------------------------------\r\n' - >>testtrygrep
|
2016-05-31 07:36:10 -04:00
|
|
|
$valgrind $vjs $pcre2grep -n --newline=anycrlf "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
|
2014-07-15 04:46:12 -04:00
|
|
|
|
2021-02-07 11:43:00 -05:00
|
|
|
# This next test involves NUL characters. It seems impossible to handle them
|
|
|
|
# easily in many operating systems. An earlier version of this script used sed
|
|
|
|
# to translate NUL into the string ZERO, but this didn't work on Solaris (aka
|
|
|
|
# SunOS), where the version of sed explicitly doesn't like them, and also MacOS
|
|
|
|
# (Darwin), OpenBSD, FreeBSD, NetBSD, and some Linux distributions like Alpine,
|
|
|
|
# even when using GNU sed. A user suggested using tr instead, which
|
|
|
|
# necessitates translating to a single character (@). However, on (some
|
|
|
|
# versions of?) Solaris, the normal "tr" cannot handle binary zeros, but if
|
|
|
|
# /usr/xpg4/bin/tr is available, it can do so, so test for that.
|
|
|
|
|
|
|
|
if [ -x /usr/xpg4/bin/tr ] ; then
|
|
|
|
tr=/usr/xpg4/bin/tr
|
|
|
|
else
|
|
|
|
tr=tr
|
|
|
|
fi
|
2017-05-26 13:14:36 -04:00
|
|
|
|
2018-06-20 13:05:31 -04:00
|
|
|
printf '%c--------------------------- Test N7 ------------------------------\r\n' - >>testtrygrep
|
2021-01-04 12:17:48 -05:00
|
|
|
printf 'abc\0def' >testNinputgrep
|
2021-02-07 11:43:00 -05:00
|
|
|
$valgrind $vjs $pcre2grep -na --newline=nul "^(abc|def)" testNinputgrep | $tr '\000' '@' >>testtrygrep
|
2021-01-04 12:17:48 -05:00
|
|
|
echo "" >>testtrygrep
|
2017-05-26 13:14:36 -04:00
|
|
|
|
2014-07-15 04:46:12 -04:00
|
|
|
$cf $srcdir/testdata/grepoutputN testtrygrep
|
|
|
|
if [ $? != 0 ] ; then exit 1; fi
|
|
|
|
|
2018-11-17 11:45:57 -05:00
|
|
|
# If pcre2grep supports script callouts, run some tests on them. It is possible
|
|
|
|
# to restrict these callouts to the non-fork case, either for security, or for
|
|
|
|
# environments that do not support fork(). This is handled by comparing to a
|
|
|
|
# different output.
|
2016-04-01 11:52:08 -04:00
|
|
|
|
2018-11-17 11:45:57 -05:00
|
|
|
if $valgrind $vjs $pcre2grep --help | $valgrind $vjs $pcre2grep -q 'callout scripts in patterns are supported'; then
|
2016-04-01 11:52:08 -04:00
|
|
|
echo "Testing pcre2grep script callouts"
|
2016-05-31 07:36:10 -04:00
|
|
|
$valgrind $vjs $pcre2grep '(T)(..(.))(?C"/bin/echo|Arg1: [$1] [$2] [$3]|Arg2: $|${1}$| ($4) ($14) ($0)")()' $srcdir/testdata/grepinputv >testtrygrep
|
|
|
|
$valgrind $vjs $pcre2grep '(T)(..(.))()()()()()()()(..)(?C"/bin/echo|Arg1: [$11] [${11}]")' $srcdir/testdata/grepinputv >>testtrygrep
|
2017-04-06 14:02:40 -04:00
|
|
|
$valgrind $vjs $pcre2grep '(T)(?C"|$0:$1$n")' $srcdir/testdata/grepinputv >>testtrygrep
|
|
|
|
$valgrind $vjs $pcre2grep '(T)(?C"|$1$n")(*F)' $srcdir/testdata/grepinputv >>testtrygrep
|
2020-10-04 12:34:31 -04:00
|
|
|
$valgrind $vjs $pcre2grep -m1 '(T)(?C"|$0:$1:$x{41}$o{101}$n")' $srcdir/testdata/grepinputv >>testtrygrep
|
2018-11-17 11:45:57 -05:00
|
|
|
|
|
|
|
if $valgrind $vjs $pcre2grep --help | $valgrind $vjs $pcre2grep -q 'Non-fork callout scripts in patterns are supported'; then
|
|
|
|
$cf $srcdir/testdata/grepoutputCN testtrygrep
|
|
|
|
else
|
|
|
|
$cf $srcdir/testdata/grepoutputC testtrygrep
|
|
|
|
fi
|
2019-03-04 13:07:04 -05:00
|
|
|
|
2016-04-01 11:52:08 -04:00
|
|
|
if [ $? != 0 ] ; then exit 1; fi
|
|
|
|
else
|
2016-06-29 12:52:05 -04:00
|
|
|
echo "Script callouts are not supported"
|
|
|
|
fi
|
2014-10-31 08:34:34 -04:00
|
|
|
|
2014-11-03 12:13:00 -05:00
|
|
|
# Finally, some tests to exercise code that is not tested above, just to be
|
2014-10-31 08:34:34 -04:00
|
|
|
# sure that it runs OK. Doing this improves the coverage statistics. The output
|
|
|
|
# is not checked.
|
|
|
|
|
|
|
|
echo "Testing miscellaneous pcre2grep arguments (unchecked)"
|
|
|
|
echo '' >testtrygrep
|
|
|
|
checkspecial '-xxxxx' 2
|
|
|
|
checkspecial '--help' 0
|
|
|
|
checkspecial '--line-buffered --colour=auto abc /dev/null' 1
|
|
|
|
|
2014-08-29 11:24:33 -04:00
|
|
|
# Clean up local working files
|
|
|
|
rm -f testNinputgrep teststderrgrep testtrygrep testtemp1grep testtemp2grep
|
|
|
|
|
2014-07-15 04:46:12 -04:00
|
|
|
exit 0
|
|
|
|
|
|
|
|
# End
|