2014-07-15 10:46:12 +02:00
|
|
|
#! /bin/sh
|
|
|
|
|
2014-10-17 17:52:57 +02:00
|
|
|
# Run pcre2grep tests. The assumption is that the PCRE2 tests check the library
|
2014-07-15 10:46:12 +02: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 13:57:09 +02:00
|
|
|
# CODING CONVENTIONS:
|
2018-06-20 19:05:31 +02:00
|
|
|
# * Put printf arguments in single, not double quotes to avoid unwanted
|
|
|
|
# escaping.
|
2018-08-13 13:57:09 +02:00
|
|
|
# * Use \0 for binary zero in printf, not \x0, for the benefit of older
|
2019-05-28 16:14:22 +02:00
|
|
|
# versions (and use octal for other special values).
|
2018-06-20 19:05:31 +02:00
|
|
|
|
2014-07-15 10:46:12 +02: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 18:46:40 +01:00
|
|
|
unset PCRE2GREP_COLOUR PCRE2GREP_COLOR PCREGREP_COLOUR PCREGREP_COLOR
|
|
|
|
unset GREP_COLOR GREP_COLORS
|
2014-07-15 10:46:12 +02: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 19:01:17 +02:00
|
|
|
pcre2test=$builddir/pcre2test
|
2014-07-15 10:46:12 +02:00
|
|
|
|
2014-08-29 17:24:33 +02:00
|
|
|
if [ ! -x $pcre2grep ] ; then
|
2016-12-29 16:57:38 +01:00
|
|
|
echo "** $pcre2grep does not exist or is not executable."
|
2014-08-29 17:24:33 +02:00
|
|
|
exit 1
|
2014-10-20 19:28:49 +02:00
|
|
|
fi
|
2014-08-29 17:24:33 +02:00
|
|
|
|
2015-09-08 19:01:17 +02:00
|
|
|
if [ ! -x $pcre2test ] ; then
|
2016-12-29 16:57:38 +01:00
|
|
|
echo "** $pcre2test does not exist or is not executable."
|
2015-09-08 19:01:17 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-07-15 10:46:12 +02:00
|
|
|
valgrind=
|
|
|
|
while [ $# -gt 0 ] ; do
|
|
|
|
case $1 in
|
2016-05-31 13:36:10 +02:00
|
|
|
valgrind) valgrind="valgrind -q --leak-check=no --smc-check=all-non-file";;
|
2014-07-15 10:46:12 +02:00
|
|
|
*) echo "RunGrepTest: Unknown argument $1"; exit 1;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2016-05-31 13:36:10 +02:00
|
|
|
vjs=
|
2014-07-15 10:46:12 +02:00
|
|
|
pcre2grep_version=`$pcre2grep -V`
|
|
|
|
if [ "$valgrind" = "" ] ; then
|
|
|
|
echo "Testing $pcre2grep_version"
|
|
|
|
else
|
|
|
|
echo "Testing $pcre2grep_version using valgrind"
|
2016-05-31 13:36:10 +02:00
|
|
|
$pcre2test -C jit >/dev/null
|
|
|
|
if [ $? -ne 0 ]; then
|
2016-06-29 18:52:05 +02:00
|
|
|
vjs="--suppressions=./testdata/valgrind-jit.supp"
|
|
|
|
fi
|
2014-07-15 10:46:12 +02: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 19:01:17 +02:00
|
|
|
$pcre2test -C unicode >/dev/null
|
2014-07-15 10:46:12 +02:00
|
|
|
utf8=$?
|
|
|
|
|
2015-09-08 19:01:17 +02: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 19:44:06 +01:00
|
|
|
echo "Default newline setting forced to LF"
|
2015-09-08 19:01:17 +02:00
|
|
|
fi
|
|
|
|
|
2014-10-31 13:34:34 +01:00
|
|
|
# ------ Function to run and check a special pcre2grep arguments test -------
|
|
|
|
|
|
|
|
checkspecial()
|
|
|
|
{
|
2015-09-08 19:01:17 +02:00
|
|
|
$valgrind $pcre2grep $1 >>testtrygrep 2>&1
|
2014-10-31 13:34:34 +01:00
|
|
|
if [ $? -ne $2 ] ; then
|
|
|
|
echo "** pcre2grep $1 failed - check testtrygrep"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
2014-11-03 18:13:00 +01:00
|
|
|
|
|
|
|
# ------ Normal tests ------
|
2014-10-31 13:34:34 +01:00
|
|
|
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "Testing pcre2grep main features"
|
|
|
|
|
|
|
|
echo "---------------------------- Test 1 ------------------------------" >testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep PATTERN ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 2 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep '^PATTERN' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 3 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -in PATTERN ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 4 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -ic PATTERN ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 5 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -in PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 6 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -inh PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 7 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -il PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 8 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -l PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 9 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -q PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 10 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -q NEVER-PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 11 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -vn pattern ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 12 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -ix pattern ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 13 -----------------------------" >>testtrygrep
|
|
|
|
echo seventeen >testtemp1grep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -f./testdata/greplist -f $builddir/testtemp1grep ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 14 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -w pat ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 15 -----------------------------" >>testtrygrep
|
2018-12-06 18:13:41 +01:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep 'abc^*' ./testdata/grepinput) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 16 -----------------------------" >>testtrygrep
|
2018-12-06 18:13:41 +01:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep abc ./testdata/grepinput ./testdata/nonexistfile) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 17 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -M 'the\noutput' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 18 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -Mn '(the\noutput|dog\.\n--)' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 19 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -Mix 'Pattern' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 20 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -Mixn 'complete pair\nof lines' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 21 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -nA3 'four' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 22 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -nB3 'four' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 23 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -C3 'four' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 24 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -A9 'four' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 25 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -nB9 'four' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 26 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -A9 -B9 'four' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 27 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -A10 'four' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 28 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -nB10 'four' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 29 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -C12 -B10 'four' ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 30 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -inB3 'pattern' ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 31 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -inA3 'pattern' ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 32 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -L 'fox' ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 33 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep 'fox' ./testdata/grepnonexist) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 34 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -s 'fox' ./testdata/grepnonexist) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 35 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include=grepinputx --include grepinput8 --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 36 -----------------------------" >>testtrygrep
|
2017-11-13 17:52:39 +01: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 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 37 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep '^(a+)*\d' ./testdata/grepinput) >>testtrygrep 2>teststderrgrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
echo "======== STDERR ========" >>testtrygrep
|
|
|
|
cat teststderrgrep >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 38 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep '>\x00<' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 39 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -A1 'before the binary zero' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 40 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -B1 'after the binary zero' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 41 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -B1 -o '\w+ the binary zero' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 42 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -B1 -onH '\w+ the binary zero' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 43 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -on 'before|zero|after' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 44 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -on -e before -ezero -e after ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 45 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -on -f ./testdata/greplist -e binary ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 46 ------------------------------" >>testtrygrep
|
2018-12-06 18:13:41 +01:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -eabc -e '(unclosed' ./testdata/grepinput) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 47 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -Fx "AB.VE
|
2014-07-15 10:46:12 +02:00
|
|
|
elephant" ./testdata/grepinput) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 48 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -F "AB.VE
|
2014-07-15 10:46:12 +02:00
|
|
|
elephant" ./testdata/grepinput) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 49 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -F -e DATA -e "AB.VE
|
2014-07-15 10:46:12 +02:00
|
|
|
elephant" ./testdata/grepinput) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 50 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 51 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -Mv "brown\sfox" ./testdata/grepinputv) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 52 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --colour=always jumps ./testdata/grepinputv) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 53 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --file-offsets 'before|zero|after' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 54 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --line-offsets 'before|zero|after' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 55 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -f./testdata/greplist --color=always ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 56 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -c lazy ./testdata/grepinput*) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 57 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -c -l lazy ./testdata/grepinput*) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 58 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --regex=PATTERN ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 59 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --regexp=PATTERN ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 60 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --regex PATTERN ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 61 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --regexp PATTERN ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02: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 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o1 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 65 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o2 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 66 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o3 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 67 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o12 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 68 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --only-matching=2 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 69 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -vn --colour=always pattern ./testdata/grepinputx) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 70 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --color=always -M "triple:\t.*\n\n" ./testdata/grepinput3) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
2017-11-13 17:52:39 +01: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 10:46:12 +02:00
|
|
|
|
|
|
|
echo "---------------------------- Test 71 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o "^01|^02|^03" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 72 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --color=always "^01|^02|^03" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 73 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o --colour=always "^01|^02|^03" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 74 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o "^01|02|^03" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 75 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --color=always "^01|02|^03" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 76 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o --colour=always "^01|02|^03" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 77 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o "^01|^02|03" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 78 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --color=always "^01|^02|03" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 79 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o --colour=always "^01|^02|03" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 80 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o "\b01|\b02" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 81 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --color=always "\\b01|\\b02" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 82 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -o --colour=always "\\b01|\\b02" ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 83 -----------------------------" >>testtrygrep
|
2016-10-11 18:40:09 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --buffer-size=10 --max-buffer-size=100 "^a" ./testdata/grepinput3) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 84 -----------------------------" >>testtrygrep
|
|
|
|
echo testdata/grepinput3 >testtemp1grep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --file-list ./testdata/grepfilelist --file-list $builddir/testtemp1grep "fox|complete|t7") >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 85 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --file-list=./testdata/grepfilelist "dolor" ./testdata/grepinput3) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 86 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 87 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep "cat" ./testdata/grepbinary) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 88 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -v "cat" ./testdata/grepbinary) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 89 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -I "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 90 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --binary-files=without-match "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 91 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -a "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 92 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --binary-files=text "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 93 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --text "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 94 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include=grepinputx --include grepinput8 'fox' ./testdata/grepinput* | sort) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 95 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --file-list ./testdata/grepfilelist --exclude grepinputv "fox|complete") >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 96 -----------------------------" >>testtrygrep
|
2017-11-13 17:52:39 +01:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include-dir=testdata --exclude '^(?!grepinput)' --exclude=grepinputM 'fox' ./test* | sort) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 97 -----------------------------" >>testtrygrep
|
|
|
|
echo "grepinput$" >testtemp1grep
|
|
|
|
echo "grepinput8" >>testtemp1grep
|
2017-11-13 17:52:39 +01: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 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 98 -----------------------------" >>testtrygrep
|
|
|
|
echo "grepinput$" >testtemp1grep
|
|
|
|
echo "grepinput8" >>testtemp1grep
|
2017-11-13 17:52:39 +01: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 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 99 -----------------------------" >>testtrygrep
|
|
|
|
echo "grepinput$" >testtemp1grep
|
|
|
|
echo "grepinput8" >testtemp2grep
|
2017-11-13 17:52:39 +01: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 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 100 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -Ho2 --only-matching=1 -o3 '(\w+) binary (\w+)(\.)?' ./testdata/grepinput) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 101 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02: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 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 102 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -n "^$" ./testdata/grepinput3) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 103 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --only-matching "^$" ./testdata/grepinput3) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 104 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -n --only-matching "^$" ./testdata/grepinput3) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 105 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --colour=always "ipsum|" ./testdata/grepinput3) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 106 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; echo "a" | $valgrind $vjs $pcre2grep -M "|a" ) >>testtrygrep 2>&1
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2015-04-03 13:14:19 +02:00
|
|
|
echo "---------------------------- Test 107 -----------------------------" >>testtrygrep
|
|
|
|
echo "a" >testtemp1grep
|
|
|
|
echo "aaaaa" >>testtemp1grep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --line-offsets '(?<=\Ka)' $builddir/testtemp1grep) >>testtrygrep 2>&1
|
2015-04-03 13:14:19 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
|
2015-08-05 19:35:36 +02:00
|
|
|
echo "---------------------------- Test 108 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -lq PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
2015-08-05 19:35:36 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 109 -----------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -cq lazy ./testdata/grepinput*) >>testtrygrep
|
2015-08-05 19:35:36 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2016-06-17 19:37:26 +02: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 18:48:14 +02: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 17:52:39 +01:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --exclude=grepinputM -th 'the' testdata/grepinput*) >>testtrygrep
|
2016-10-16 18:48:14 +02: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 18:39:29 +01:00
|
|
|
echo "---------------------------- Test 119 -----------------------------" >>testtrygrep
|
2018-06-20 19:05:31 +02:00
|
|
|
printf '123\n456\n789\n---abc\ndef\nxyz\n---\n' >testNinputgrep
|
2017-02-12 14:54:45 +01:00
|
|
|
$valgrind $vjs $pcre2grep -Mo '(\n|[^-])*---' testNinputgrep >>testtrygrep
|
2017-02-10 18:39:29 +01:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2017-04-06 20:02:40 +02: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 13:32:06 +02: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 17:52:39 +01:00
|
|
|
echo "---------------------------- Test 123 -----------------------------" >>testtrygrep
|
2017-06-17 13:32:06 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -w 'dog|cat' testdata/grepinputv) >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2017-11-13 17:52:39 +01: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 16:10:04 +01:00
|
|
|
echo "---------------------------- Test 125 -----------------------------" >>testtrygrep
|
2018-06-20 19:05:31 +02:00
|
|
|
printf 'abcd\n' >testNinputgrep
|
2017-12-26 16:10:04 +01: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 18:09:19 +01:00
|
|
|
echo "---------------------------- Test 126 -----------------------------" >>testtrygrep
|
2018-06-20 19:05:31 +02:00
|
|
|
printf 'Next line pattern has binary zero\nABC\0XYZ\n' >testtemp1grep
|
|
|
|
printf 'ABC\0XYZ\nABCDEF\nDEFABC\n' >testtemp2grep
|
2018-02-24 18:09:19 +01:00
|
|
|
$valgrind $vjs $pcre2grep -a -f testtemp1grep testtemp2grep >>testtrygrep
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2019-06-15 17:51:07 +02: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 13:32:06 +02:00
|
|
|
|
2020-10-04 18:34:31 +02: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
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -m1 -A3 '^match'; echo '---'; head -1) <testdata/grepinput >>testtrygrep 2>&1
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test 133 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -m1 -O '=$x{41}$x423$o{103}$o1045=' 'fox') <testdata/grepinputv >>testtrygrep 2>&1
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2014-07-15 10:46:12 +02: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 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -n -u --newline=any "^X" ./testdata/grepinput8) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test U2 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -n -u -C 3 --newline=any "Match" ./testdata/grepinput8) >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2015-04-03 13:14:19 +02:00
|
|
|
echo "---------------------------- Test U3 ------------------------------" >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep --line-offsets -u --newline=any '(?<=\K\x{17f})' ./testdata/grepinput8) >>testtrygrep
|
2015-04-03 13:14:19 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
2019-10-17 18:39:38 +02:00
|
|
|
|
2019-05-28 16:14:22 +02:00
|
|
|
echo "---------------------------- Test U4 ------------------------------" >>testtrygrep
|
|
|
|
printf 'A\341\200\200\200CD\342\200\200Z\n' >testtemp1grep
|
2019-10-15 17:23:31 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -u -o '....' $builddir/testtemp1grep) >>testtrygrep 2>&1
|
2019-05-28 16:14:22 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
|
|
|
echo "---------------------------- Test U5 ------------------------------" >>testtrygrep
|
|
|
|
printf 'A\341\200\200\200CD\342\200\200Z\n' >testtemp1grep
|
2019-10-15 17:23:31 +02:00
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -U -o '....' $builddir/testtemp1grep) >>testtrygrep
|
2019-05-28 16:14:22 +02:00
|
|
|
echo "RC=$?" >>testtrygrep
|
2015-04-03 13:14:19 +02:00
|
|
|
|
2020-10-04 18:34:31 +02:00
|
|
|
echo "---------------------------- Test U6 -----------------------------" >>testtrygrep
|
|
|
|
(cd $srcdir; $valgrind $vjs $pcre2grep -u -m1 -O '=$x{1d3}$o{744}=' 'fox') <testdata/grepinputv >>testtrygrep 2>&1
|
|
|
|
echo "RC=$?" >>testtrygrep
|
|
|
|
|
2014-07-15 10:46:12 +02:00
|
|
|
$cf $srcdir/testdata/grepoutput8 testtrygrep
|
|
|
|
if [ $? != 0 ] ; then exit 1; fi
|
|
|
|
|
|
|
|
else
|
2014-10-17 17:52:57 +02:00
|
|
|
echo "Skipping pcre2grep UTF-8 tests: no UTF-8 support in PCRE2 library"
|
2014-07-15 10:46:12 +02: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 19:05:31 +02:00
|
|
|
printf 'abc\rdef\r\nghi\njkl' >testNinputgrep
|
2014-07-15 10:46:12 +02:00
|
|
|
|
2018-06-20 19:05:31 +02:00
|
|
|
printf '%c--------------------------- Test N1 ------------------------------\r\n' - >testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
$valgrind $vjs $pcre2grep -n -N CR "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
|
2018-06-20 19:05:31 +02:00
|
|
|
printf '%c--------------------------- Test N2 ------------------------------\r\n' - >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
$valgrind $vjs $pcre2grep -n --newline=crlf "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
|
2018-06-20 19:05:31 +02:00
|
|
|
printf '%c--------------------------- Test N3 ------------------------------\r\n' - >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
pattern=`printf 'def\rjkl'`
|
2016-05-31 13:36:10 +02:00
|
|
|
$valgrind $vjs $pcre2grep -n --newline=cr -F "$pattern" testNinputgrep >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
|
2018-06-20 19:05:31 +02:00
|
|
|
printf '%c--------------------------- Test N4 ------------------------------\r\n' - >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
$valgrind $vjs $pcre2grep -n --newline=crlf -F -f $srcdir/testdata/greppatN4 testNinputgrep >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
|
2018-06-20 19:05:31 +02:00
|
|
|
printf '%c--------------------------- Test N5 ------------------------------\r\n' - >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
$valgrind $vjs $pcre2grep -n --newline=any "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
|
2018-06-20 19:05:31 +02:00
|
|
|
printf '%c--------------------------- Test N6 ------------------------------\r\n' - >>testtrygrep
|
2016-05-31 13:36:10 +02:00
|
|
|
$valgrind $vjs $pcre2grep -n --newline=anycrlf "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
|
2014-07-15 10:46:12 +02:00
|
|
|
|
2018-12-06 18:05:06 +01:00
|
|
|
# It seems impossible to handle NUL characters easily in many operating
|
|
|
|
# systems, including Solaris (aka SunOS), where the version of sed explicitly
|
|
|
|
# doesn't like them, and also MacOS (Darwin), OpenBSD, FreeBSD, and NetBSD. So
|
|
|
|
# now we run this test only on OS that are known to work. For the rest, we
|
|
|
|
# fudge the output so that the comparison works.
|
2017-05-26 19:14:36 +02:00
|
|
|
|
2018-06-20 19:05:31 +02:00
|
|
|
printf '%c--------------------------- Test N7 ------------------------------\r\n' - >>testtrygrep
|
2017-08-18 17:21:08 +02:00
|
|
|
uname=`uname`
|
2018-12-06 18:05:06 +01:00
|
|
|
case $uname in
|
|
|
|
Linux)
|
|
|
|
printf 'abc\0def' >testNinputgrep
|
2020-01-25 16:50:44 +01:00
|
|
|
$valgrind $vjs $pcre2grep -na --newline=nul "^(abc|def)" testNinputgrep | sed 's/\x00/ZERO/g' >>testtrygrep
|
2018-12-06 18:05:06 +01:00
|
|
|
echo "" >>testtrygrep
|
|
|
|
;;
|
|
|
|
*)
|
2020-01-25 16:50:44 +01:00
|
|
|
echo '1:abcZERO2:defZERO' >>testtrygrep
|
2018-12-06 18:05:06 +01:00
|
|
|
;;
|
|
|
|
esac
|
2017-05-26 19:14:36 +02:00
|
|
|
|
2014-07-15 10:46:12 +02:00
|
|
|
$cf $srcdir/testdata/grepoutputN testtrygrep
|
|
|
|
if [ $? != 0 ] ; then exit 1; fi
|
|
|
|
|
2018-11-17 17:45:57 +01: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 17:52:08 +02:00
|
|
|
|
2018-11-17 17:45:57 +01:00
|
|
|
if $valgrind $vjs $pcre2grep --help | $valgrind $vjs $pcre2grep -q 'callout scripts in patterns are supported'; then
|
2016-04-01 17:52:08 +02:00
|
|
|
echo "Testing pcre2grep script callouts"
|
2016-05-31 13:36:10 +02: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 20:02:40 +02: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 18:34:31 +02:00
|
|
|
$valgrind $vjs $pcre2grep -m1 '(T)(?C"|$0:$1:$x{41}$o{101}$n")' $srcdir/testdata/grepinputv >>testtrygrep
|
2018-11-17 17:45:57 +01: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 19:07:04 +01:00
|
|
|
|
2016-04-01 17:52:08 +02:00
|
|
|
if [ $? != 0 ] ; then exit 1; fi
|
|
|
|
else
|
2016-06-29 18:52:05 +02:00
|
|
|
echo "Script callouts are not supported"
|
|
|
|
fi
|
2014-10-31 13:34:34 +01:00
|
|
|
|
2014-11-03 18:13:00 +01:00
|
|
|
# Finally, some tests to exercise code that is not tested above, just to be
|
2014-10-31 13:34:34 +01: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 17:24:33 +02:00
|
|
|
# Clean up local working files
|
|
|
|
rm -f testNinputgrep teststderrgrep testtrygrep testtemp1grep testtemp2grep
|
|
|
|
|
2014-07-15 10:46:12 +02:00
|
|
|
exit 0
|
|
|
|
|
|
|
|
# End
|