Home | History | Annotate | Download | only in dist2
      1 #! /bin/sh
      2 
      3 # Run pcre2grep tests. The assumption is that the PCRE2 tests check the library
      4 # itself. What we are checking here is the file handling and options that are
      5 # supported by pcre2grep. This script must be run in the build directory.
      6 
      7 # CODING CONVENTIONS:
      8 # * Put printf arguments in single, not double quotes to avoid unwanted
      9 #     escaping.
     10 # * Use \0 for binary zero in printf, not \x0, for the benefit of older
     11 #     versions.
     12 
     13 # Set the C locale, so that sort(1) behaves predictably.
     14 
     15 LC_ALL=C
     16 export LC_ALL
     17 
     18 # Remove any non-default colouring and aliases that the caller may have set.
     19 
     20 unset PCRE2GREP_COLOUR PCRE2GREP_COLOR PCREGREP_COLOUR PCREGREP_COLOR
     21 unset GREP_COLOR GREP_COLORS
     22 unset cp ls mv rm
     23 
     24 # Remember the current (build) directory, set the program to be tested, and
     25 # valgrind settings when requested.
     26 
     27 builddir=`pwd`
     28 pcre2grep=$builddir/pcre2grep
     29 pcre2test=$builddir/pcre2test
     30 
     31 if [ ! -x $pcre2grep ] ; then
     32   echo "** $pcre2grep does not exist or is not executable."
     33   exit 1
     34 fi
     35 
     36 if [ ! -x $pcre2test ] ; then
     37   echo "** $pcre2test does not exist or is not executable."
     38   exit 1
     39 fi
     40 
     41 valgrind=
     42 while [ $# -gt 0 ] ; do
     43   case $1 in
     44     valgrind) valgrind="valgrind -q --leak-check=no --smc-check=all-non-file";;
     45     *) echo "RunGrepTest: Unknown argument $1"; exit 1;;
     46   esac
     47   shift
     48 done
     49 
     50 vjs=
     51 pcre2grep_version=`$pcre2grep -V`
     52 if [ "$valgrind" = "" ] ; then
     53   echo "Testing $pcre2grep_version"
     54 else
     55   echo "Testing $pcre2grep_version using valgrind"
     56   $pcre2test -C jit >/dev/null
     57   if [ $? -ne 0 ]; then
     58     vjs="--suppressions=./testdata/valgrind-jit.supp"
     59   fi
     60 fi
     61 
     62 # Set up a suitable "diff" command for comparison. Some systems have a diff
     63 # that lacks a -u option. Try to deal with this; better do the test for the -b
     64 # option as well.
     65 
     66 cf="diff"
     67 diff -b  /dev/null /dev/null 2>/dev/null && cf="diff -b"
     68 diff -u  /dev/null /dev/null 2>/dev/null && cf="diff -u"
     69 diff -ub /dev/null /dev/null 2>/dev/null && cf="diff -ub"
     70 
     71 # If this test is being run from "make check", $srcdir will be set. If not, set
     72 # it to the current or parent directory, whichever one contains the test data.
     73 # Subsequently, we run most of the pcre2grep tests in the source directory so
     74 # that the file names in the output are always the same.
     75 
     76 if [ -z "$srcdir" -o ! -d "$srcdir/testdata" ] ; then
     77   if [ -d "./testdata" ] ; then
     78     srcdir=.
     79   elif [ -d "../testdata" ] ; then
     80     srcdir=..
     81   else
     82     echo "Cannot find the testdata directory"
     83     exit 1
     84   fi
     85 fi
     86 
     87 # Check for the availability of UTF-8 support
     88 
     89 $pcre2test -C unicode >/dev/null
     90 utf8=$?
     91 
     92 # Check default newline convention. If it does not include LF, force LF.
     93 
     94 nl=`$pcre2test -C newline`
     95 if [ "$nl" != "LF" -a "$nl" != "ANY" -a "$nl" != "ANYCRLF" ]; then
     96   pcre2grep="$pcre2grep -N LF"
     97   echo "Default newline setting forced to LF"
     98 fi
     99 
    100 # ------ Function to run and check a special pcre2grep arguments test -------
    101 
    102 checkspecial()
    103   {
    104   $valgrind $pcre2grep $1 >>testtrygrep 2>&1
    105   if [ $? -ne $2 ] ; then
    106     echo "** pcre2grep $1 failed - check testtrygrep"
    107     exit 1
    108   fi
    109   }
    110 
    111 # ------ Normal tests ------
    112 
    113 echo "Testing pcre2grep main features"
    114 
    115 echo "---------------------------- Test 1 ------------------------------" >testtrygrep
    116 (cd $srcdir; $valgrind $vjs $pcre2grep PATTERN ./testdata/grepinput) >>testtrygrep
    117 echo "RC=$?" >>testtrygrep
    118 
    119 echo "---------------------------- Test 2 ------------------------------" >>testtrygrep
    120 (cd $srcdir; $valgrind $vjs $pcre2grep '^PATTERN' ./testdata/grepinput) >>testtrygrep
    121 echo "RC=$?" >>testtrygrep
    122 
    123 echo "---------------------------- Test 3 ------------------------------" >>testtrygrep
    124 (cd $srcdir; $valgrind $vjs $pcre2grep -in PATTERN ./testdata/grepinput) >>testtrygrep
    125 echo "RC=$?" >>testtrygrep
    126 
    127 echo "---------------------------- Test 4 ------------------------------" >>testtrygrep
    128 (cd $srcdir; $valgrind $vjs $pcre2grep -ic PATTERN ./testdata/grepinput) >>testtrygrep
    129 echo "RC=$?" >>testtrygrep
    130 
    131 echo "---------------------------- Test 5 ------------------------------" >>testtrygrep
    132 (cd $srcdir; $valgrind $vjs $pcre2grep -in PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
    133 echo "RC=$?" >>testtrygrep
    134 
    135 echo "---------------------------- Test 6 ------------------------------" >>testtrygrep
    136 (cd $srcdir; $valgrind $vjs $pcre2grep -inh PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
    137 echo "RC=$?" >>testtrygrep
    138 
    139 echo "---------------------------- Test 7 ------------------------------" >>testtrygrep
    140 (cd $srcdir; $valgrind $vjs $pcre2grep -il PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
    141 echo "RC=$?" >>testtrygrep
    142 
    143 echo "---------------------------- Test 8 ------------------------------" >>testtrygrep
    144 (cd $srcdir; $valgrind $vjs $pcre2grep -l PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
    145 echo "RC=$?" >>testtrygrep
    146 
    147 echo "---------------------------- Test 9 ------------------------------" >>testtrygrep
    148 (cd $srcdir; $valgrind $vjs $pcre2grep -q PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
    149 echo "RC=$?" >>testtrygrep
    150 
    151 echo "---------------------------- Test 10 -----------------------------" >>testtrygrep
    152 (cd $srcdir; $valgrind $vjs $pcre2grep -q NEVER-PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
    153 echo "RC=$?" >>testtrygrep
    154 
    155 echo "---------------------------- Test 11 -----------------------------" >>testtrygrep
    156 (cd $srcdir; $valgrind $vjs $pcre2grep -vn pattern ./testdata/grepinputx) >>testtrygrep
    157 echo "RC=$?" >>testtrygrep
    158 
    159 echo "---------------------------- Test 12 -----------------------------" >>testtrygrep
    160 (cd $srcdir; $valgrind $vjs $pcre2grep -ix pattern ./testdata/grepinputx) >>testtrygrep
    161 echo "RC=$?" >>testtrygrep
    162 
    163 echo "---------------------------- Test 13 -----------------------------" >>testtrygrep
    164 echo seventeen >testtemp1grep
    165 (cd $srcdir; $valgrind $vjs $pcre2grep -f./testdata/greplist -f $builddir/testtemp1grep ./testdata/grepinputx) >>testtrygrep
    166 echo "RC=$?" >>testtrygrep
    167 
    168 echo "---------------------------- Test 14 -----------------------------" >>testtrygrep
    169 (cd $srcdir; $valgrind $vjs $pcre2grep -w pat ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
    170 echo "RC=$?" >>testtrygrep
    171 
    172 echo "---------------------------- Test 15 -----------------------------" >>testtrygrep
    173 (cd $srcdir; $valgrind $vjs $pcre2grep 'abc^*' ./testdata/grepinput) 2>>testtrygrep >>testtrygrep
    174 echo "RC=$?" >>testtrygrep
    175 
    176 echo "---------------------------- Test 16 -----------------------------" >>testtrygrep
    177 (cd $srcdir; $valgrind $vjs $pcre2grep abc ./testdata/grepinput ./testdata/nonexistfile) 2>>testtrygrep >>testtrygrep
    178 echo "RC=$?" >>testtrygrep
    179 
    180 echo "---------------------------- Test 17 -----------------------------" >>testtrygrep
    181 (cd $srcdir; $valgrind $vjs $pcre2grep -M 'the\noutput' ./testdata/grepinput) >>testtrygrep
    182 echo "RC=$?" >>testtrygrep
    183 
    184 echo "---------------------------- Test 18 -----------------------------" >>testtrygrep
    185 (cd $srcdir; $valgrind $vjs $pcre2grep -Mn '(the\noutput|dog\.\n--)' ./testdata/grepinput) >>testtrygrep
    186 echo "RC=$?" >>testtrygrep
    187 
    188 echo "---------------------------- Test 19 -----------------------------" >>testtrygrep
    189 (cd $srcdir; $valgrind $vjs $pcre2grep -Mix 'Pattern' ./testdata/grepinputx) >>testtrygrep
    190 echo "RC=$?" >>testtrygrep
    191 
    192 echo "---------------------------- Test 20 -----------------------------" >>testtrygrep
    193 (cd $srcdir; $valgrind $vjs $pcre2grep -Mixn 'complete pair\nof lines' ./testdata/grepinputx) >>testtrygrep
    194 echo "RC=$?" >>testtrygrep
    195 
    196 echo "---------------------------- Test 21 -----------------------------" >>testtrygrep
    197 (cd $srcdir; $valgrind $vjs $pcre2grep -nA3 'four' ./testdata/grepinputx) >>testtrygrep
    198 echo "RC=$?" >>testtrygrep
    199 
    200 echo "---------------------------- Test 22 -----------------------------" >>testtrygrep
    201 (cd $srcdir; $valgrind $vjs $pcre2grep -nB3 'four' ./testdata/grepinputx) >>testtrygrep
    202 echo "RC=$?" >>testtrygrep
    203 
    204 echo "---------------------------- Test 23 -----------------------------" >>testtrygrep
    205 (cd $srcdir; $valgrind $vjs $pcre2grep -C3 'four' ./testdata/grepinputx) >>testtrygrep
    206 echo "RC=$?" >>testtrygrep
    207 
    208 echo "---------------------------- Test 24 -----------------------------" >>testtrygrep
    209 (cd $srcdir; $valgrind $vjs $pcre2grep -A9 'four' ./testdata/grepinputx) >>testtrygrep
    210 echo "RC=$?" >>testtrygrep
    211 
    212 echo "---------------------------- Test 25 -----------------------------" >>testtrygrep
    213 (cd $srcdir; $valgrind $vjs $pcre2grep -nB9 'four' ./testdata/grepinputx) >>testtrygrep
    214 echo "RC=$?" >>testtrygrep
    215 
    216 echo "---------------------------- Test 26 -----------------------------" >>testtrygrep
    217 (cd $srcdir; $valgrind $vjs $pcre2grep -A9 -B9 'four' ./testdata/grepinputx) >>testtrygrep
    218 echo "RC=$?" >>testtrygrep
    219 
    220 echo "---------------------------- Test 27 -----------------------------" >>testtrygrep
    221 (cd $srcdir; $valgrind $vjs $pcre2grep -A10 'four' ./testdata/grepinputx) >>testtrygrep
    222 echo "RC=$?" >>testtrygrep
    223 
    224 echo "---------------------------- Test 28 -----------------------------" >>testtrygrep
    225 (cd $srcdir; $valgrind $vjs $pcre2grep -nB10 'four' ./testdata/grepinputx) >>testtrygrep
    226 echo "RC=$?" >>testtrygrep
    227 
    228 echo "---------------------------- Test 29 -----------------------------" >>testtrygrep
    229 (cd $srcdir; $valgrind $vjs $pcre2grep -C12 -B10 'four' ./testdata/grepinputx) >>testtrygrep
    230 echo "RC=$?" >>testtrygrep
    231 
    232 echo "---------------------------- Test 30 -----------------------------" >>testtrygrep
    233 (cd $srcdir; $valgrind $vjs $pcre2grep -inB3 'pattern' ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
    234 echo "RC=$?" >>testtrygrep
    235 
    236 echo "---------------------------- Test 31 -----------------------------" >>testtrygrep
    237 (cd $srcdir; $valgrind $vjs $pcre2grep -inA3 'pattern' ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
    238 echo "RC=$?" >>testtrygrep
    239 
    240 echo "---------------------------- Test 32 -----------------------------" >>testtrygrep
    241 (cd $srcdir; $valgrind $vjs $pcre2grep -L 'fox' ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
    242 echo "RC=$?" >>testtrygrep
    243 
    244 echo "---------------------------- Test 33 -----------------------------" >>testtrygrep
    245 (cd $srcdir; $valgrind $vjs $pcre2grep 'fox' ./testdata/grepnonexist) >>testtrygrep 2>&1
    246 echo "RC=$?" >>testtrygrep
    247 
    248 echo "---------------------------- Test 34 -----------------------------" >>testtrygrep
    249 (cd $srcdir; $valgrind $vjs $pcre2grep -s 'fox' ./testdata/grepnonexist) >>testtrygrep 2>&1
    250 echo "RC=$?" >>testtrygrep
    251 
    252 echo "---------------------------- Test 35 -----------------------------" >>testtrygrep
    253 (cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include=grepinputx --include grepinput8 --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
    254 echo "RC=$?" >>testtrygrep
    255 
    256 echo "---------------------------- Test 36 -----------------------------" >>testtrygrep
    257 (cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include=grepinput --exclude 'grepinput$' --exclude=grepinput8 --exclude=grepinputM --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
    258 echo "RC=$?" >>testtrygrep
    259 
    260 echo "---------------------------- Test 37 -----------------------------" >>testtrygrep
    261 (cd $srcdir; $valgrind $vjs $pcre2grep  '^(a+)*\d' ./testdata/grepinput) >>testtrygrep 2>teststderrgrep
    262 echo "RC=$?" >>testtrygrep
    263 echo "======== STDERR ========" >>testtrygrep
    264 cat teststderrgrep >>testtrygrep
    265 
    266 echo "---------------------------- Test 38 ------------------------------" >>testtrygrep
    267 (cd $srcdir; $valgrind $vjs $pcre2grep '>\x00<' ./testdata/grepinput) >>testtrygrep
    268 echo "RC=$?" >>testtrygrep
    269 
    270 echo "---------------------------- Test 39 ------------------------------" >>testtrygrep
    271 (cd $srcdir; $valgrind $vjs $pcre2grep -A1 'before the binary zero' ./testdata/grepinput) >>testtrygrep
    272 echo "RC=$?" >>testtrygrep
    273 
    274 echo "---------------------------- Test 40 ------------------------------" >>testtrygrep
    275 (cd $srcdir; $valgrind $vjs $pcre2grep -B1 'after the binary zero' ./testdata/grepinput) >>testtrygrep
    276 echo "RC=$?" >>testtrygrep
    277 
    278 echo "---------------------------- Test 41 ------------------------------" >>testtrygrep
    279 (cd $srcdir; $valgrind $vjs $pcre2grep -B1 -o '\w+ the binary zero' ./testdata/grepinput) >>testtrygrep
    280 echo "RC=$?" >>testtrygrep
    281 
    282 echo "---------------------------- Test 42 ------------------------------" >>testtrygrep
    283 (cd $srcdir; $valgrind $vjs $pcre2grep -B1 -onH '\w+ the binary zero' ./testdata/grepinput) >>testtrygrep
    284 echo "RC=$?" >>testtrygrep
    285 
    286 echo "---------------------------- Test 43 ------------------------------" >>testtrygrep
    287 (cd $srcdir; $valgrind $vjs $pcre2grep -on 'before|zero|after' ./testdata/grepinput) >>testtrygrep
    288 echo "RC=$?" >>testtrygrep
    289 
    290 echo "---------------------------- Test 44 ------------------------------" >>testtrygrep
    291 (cd $srcdir; $valgrind $vjs $pcre2grep -on -e before -ezero -e after ./testdata/grepinput) >>testtrygrep
    292 echo "RC=$?" >>testtrygrep
    293 
    294 echo "---------------------------- Test 45 ------------------------------" >>testtrygrep
    295 (cd $srcdir; $valgrind $vjs $pcre2grep -on -f ./testdata/greplist -e binary ./testdata/grepinput) >>testtrygrep
    296 echo "RC=$?" >>testtrygrep
    297 
    298 echo "---------------------------- Test 46 ------------------------------" >>testtrygrep
    299 (cd $srcdir; $valgrind $vjs $pcre2grep -eabc -e '(unclosed' ./testdata/grepinput) 2>>testtrygrep >>testtrygrep
    300 echo "RC=$?" >>testtrygrep
    301 
    302 echo "---------------------------- Test 47 ------------------------------" >>testtrygrep
    303 (cd $srcdir; $valgrind $vjs $pcre2grep -Fx "AB.VE
    304 elephant" ./testdata/grepinput) >>testtrygrep
    305 echo "RC=$?" >>testtrygrep
    306 
    307 echo "---------------------------- Test 48 ------------------------------" >>testtrygrep
    308 (cd $srcdir; $valgrind $vjs $pcre2grep -F "AB.VE
    309 elephant" ./testdata/grepinput) >>testtrygrep
    310 echo "RC=$?" >>testtrygrep
    311 
    312 echo "---------------------------- Test 49 ------------------------------" >>testtrygrep
    313 (cd $srcdir; $valgrind $vjs $pcre2grep -F -e DATA -e "AB.VE
    314 elephant" ./testdata/grepinput) >>testtrygrep
    315 echo "RC=$?" >>testtrygrep
    316 
    317 echo "---------------------------- Test 50 ------------------------------" >>testtrygrep
    318 (cd $srcdir; $valgrind $vjs $pcre2grep "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtrygrep
    319 echo "RC=$?" >>testtrygrep
    320 
    321 echo "---------------------------- Test 51 ------------------------------" >>testtrygrep
    322 (cd $srcdir; $valgrind $vjs $pcre2grep -Mv "brown\sfox" ./testdata/grepinputv) >>testtrygrep
    323 echo "RC=$?" >>testtrygrep
    324 
    325 echo "---------------------------- Test 52 ------------------------------" >>testtrygrep
    326 (cd $srcdir; $valgrind $vjs $pcre2grep --colour=always jumps ./testdata/grepinputv) >>testtrygrep
    327 echo "RC=$?" >>testtrygrep
    328 
    329 echo "---------------------------- Test 53 ------------------------------" >>testtrygrep
    330 (cd $srcdir; $valgrind $vjs $pcre2grep --file-offsets 'before|zero|after' ./testdata/grepinput) >>testtrygrep
    331 echo "RC=$?" >>testtrygrep
    332 
    333 echo "---------------------------- Test 54 ------------------------------" >>testtrygrep
    334 (cd $srcdir; $valgrind $vjs $pcre2grep --line-offsets 'before|zero|after' ./testdata/grepinput) >>testtrygrep
    335 echo "RC=$?" >>testtrygrep
    336 
    337 echo "---------------------------- Test 55 -----------------------------" >>testtrygrep
    338 (cd $srcdir; $valgrind $vjs $pcre2grep -f./testdata/greplist --color=always ./testdata/grepinputx) >>testtrygrep
    339 echo "RC=$?" >>testtrygrep
    340 
    341 echo "---------------------------- Test 56 -----------------------------" >>testtrygrep
    342 (cd $srcdir; $valgrind $vjs $pcre2grep -c lazy ./testdata/grepinput*) >>testtrygrep
    343 echo "RC=$?" >>testtrygrep
    344 
    345 echo "---------------------------- Test 57 -----------------------------" >>testtrygrep
    346 (cd $srcdir; $valgrind $vjs $pcre2grep -c -l lazy ./testdata/grepinput*) >>testtrygrep
    347 echo "RC=$?" >>testtrygrep
    348 
    349 echo "---------------------------- Test 58 -----------------------------" >>testtrygrep
    350 (cd $srcdir; $valgrind $vjs $pcre2grep --regex=PATTERN ./testdata/grepinput) >>testtrygrep
    351 echo "RC=$?" >>testtrygrep
    352 
    353 echo "---------------------------- Test 59 -----------------------------" >>testtrygrep
    354 (cd $srcdir; $valgrind $vjs $pcre2grep --regexp=PATTERN ./testdata/grepinput) >>testtrygrep
    355 echo "RC=$?" >>testtrygrep
    356 
    357 echo "---------------------------- Test 60 -----------------------------" >>testtrygrep
    358 (cd $srcdir; $valgrind $vjs $pcre2grep --regex PATTERN ./testdata/grepinput) >>testtrygrep
    359 echo "RC=$?" >>testtrygrep
    360 
    361 echo "---------------------------- Test 61 -----------------------------" >>testtrygrep
    362 (cd $srcdir; $valgrind $vjs $pcre2grep --regexp PATTERN ./testdata/grepinput) >>testtrygrep
    363 echo "RC=$?" >>testtrygrep
    364 
    365 echo "---------------------------- Test 62 -----------------------------" >>testtrygrep
    366 (cd $srcdir; $valgrind $pcre2grep --match-limit=1000 --no-jit -M 'This is a file(.|\R)*file.' ./testdata/grepinput) >>testtrygrep 2>&1
    367 echo "RC=$?" >>testtrygrep
    368 
    369 echo "---------------------------- Test 63 -----------------------------" >>testtrygrep
    370 (cd $srcdir; $valgrind $pcre2grep --recursion-limit=1000 --no-jit -M 'This is a file(.|\R)*file.' ./testdata/grepinput) >>testtrygrep 2>&1
    371 echo "RC=$?" >>testtrygrep
    372 
    373 echo "---------------------------- Test 64 ------------------------------" >>testtrygrep
    374 (cd $srcdir; $valgrind $vjs $pcre2grep -o1 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
    375 echo "RC=$?" >>testtrygrep
    376 
    377 echo "---------------------------- Test 65 ------------------------------" >>testtrygrep
    378 (cd $srcdir; $valgrind $vjs $pcre2grep -o2 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
    379 echo "RC=$?" >>testtrygrep
    380 
    381 echo "---------------------------- Test 66 ------------------------------" >>testtrygrep
    382 (cd $srcdir; $valgrind $vjs $pcre2grep -o3 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
    383 echo "RC=$?" >>testtrygrep
    384 
    385 echo "---------------------------- Test 67 ------------------------------" >>testtrygrep
    386 (cd $srcdir; $valgrind $vjs $pcre2grep -o12 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
    387 echo "RC=$?" >>testtrygrep
    388 
    389 echo "---------------------------- Test 68 ------------------------------" >>testtrygrep
    390 (cd $srcdir; $valgrind $vjs $pcre2grep --only-matching=2 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
    391 echo "RC=$?" >>testtrygrep
    392 
    393 echo "---------------------------- Test 69 -----------------------------" >>testtrygrep
    394 (cd $srcdir; $valgrind $vjs $pcre2grep -vn --colour=always pattern ./testdata/grepinputx) >>testtrygrep
    395 echo "RC=$?" >>testtrygrep
    396 
    397 echo "---------------------------- Test 70 -----------------------------" >>testtrygrep
    398 (cd $srcdir; $valgrind $vjs $pcre2grep --color=always -M "triple:\t.*\n\n" ./testdata/grepinput3) >>testtrygrep
    399 echo "RC=$?" >>testtrygrep
    400 (cd $srcdir; $valgrind $vjs $pcre2grep --color=always -M -n "triple:\t.*\n\n" ./testdata/grepinput3) >>testtrygrep
    401 echo "RC=$?" >>testtrygrep
    402 (cd $srcdir; $valgrind $vjs $pcre2grep -M "triple:\t.*\n\n" ./testdata/grepinput3) >>testtrygrep
    403 echo "RC=$?" >>testtrygrep
    404 (cd $srcdir; $valgrind $vjs $pcre2grep -M -n "triple:\t.*\n\n" ./testdata/grepinput3) >>testtrygrep
    405 echo "RC=$?" >>testtrygrep
    406 
    407 echo "---------------------------- Test 71 -----------------------------" >>testtrygrep
    408 (cd $srcdir; $valgrind $vjs $pcre2grep -o "^01|^02|^03" ./testdata/grepinput) >>testtrygrep
    409 echo "RC=$?" >>testtrygrep
    410 
    411 echo "---------------------------- Test 72 -----------------------------" >>testtrygrep
    412 (cd $srcdir; $valgrind $vjs $pcre2grep --color=always "^01|^02|^03" ./testdata/grepinput) >>testtrygrep
    413 echo "RC=$?" >>testtrygrep
    414 
    415 echo "---------------------------- Test 73 -----------------------------" >>testtrygrep
    416 (cd $srcdir; $valgrind $vjs $pcre2grep -o --colour=always "^01|^02|^03" ./testdata/grepinput) >>testtrygrep
    417 echo "RC=$?" >>testtrygrep
    418 
    419 echo "---------------------------- Test 74 -----------------------------" >>testtrygrep
    420 (cd $srcdir; $valgrind $vjs $pcre2grep -o "^01|02|^03" ./testdata/grepinput) >>testtrygrep
    421 echo "RC=$?" >>testtrygrep
    422 
    423 echo "---------------------------- Test 75 -----------------------------" >>testtrygrep
    424 (cd $srcdir; $valgrind $vjs $pcre2grep --color=always "^01|02|^03" ./testdata/grepinput) >>testtrygrep
    425 echo "RC=$?" >>testtrygrep
    426 
    427 echo "---------------------------- Test 76 -----------------------------" >>testtrygrep
    428 (cd $srcdir; $valgrind $vjs $pcre2grep -o --colour=always "^01|02|^03" ./testdata/grepinput) >>testtrygrep
    429 echo "RC=$?" >>testtrygrep
    430 
    431 echo "---------------------------- Test 77 -----------------------------" >>testtrygrep
    432 (cd $srcdir; $valgrind $vjs $pcre2grep -o "^01|^02|03" ./testdata/grepinput) >>testtrygrep
    433 echo "RC=$?" >>testtrygrep
    434 
    435 echo "---------------------------- Test 78 -----------------------------" >>testtrygrep
    436 (cd $srcdir; $valgrind $vjs $pcre2grep --color=always "^01|^02|03" ./testdata/grepinput) >>testtrygrep
    437 echo "RC=$?" >>testtrygrep
    438 
    439 echo "---------------------------- Test 79 -----------------------------" >>testtrygrep
    440 (cd $srcdir; $valgrind $vjs $pcre2grep -o --colour=always "^01|^02|03" ./testdata/grepinput) >>testtrygrep
    441 echo "RC=$?" >>testtrygrep
    442 
    443 echo "---------------------------- Test 80 -----------------------------" >>testtrygrep
    444 (cd $srcdir; $valgrind $vjs $pcre2grep -o "\b01|\b02" ./testdata/grepinput) >>testtrygrep
    445 echo "RC=$?" >>testtrygrep
    446 
    447 echo "---------------------------- Test 81 -----------------------------" >>testtrygrep
    448 (cd $srcdir; $valgrind $vjs $pcre2grep --color=always "\\b01|\\b02" ./testdata/grepinput) >>testtrygrep
    449 echo "RC=$?" >>testtrygrep
    450 
    451 echo "---------------------------- Test 82 -----------------------------" >>testtrygrep
    452 (cd $srcdir; $valgrind $vjs $pcre2grep -o --colour=always "\\b01|\\b02" ./testdata/grepinput) >>testtrygrep
    453 echo "RC=$?" >>testtrygrep
    454 
    455 echo "---------------------------- Test 83 -----------------------------" >>testtrygrep
    456 (cd $srcdir; $valgrind $vjs $pcre2grep --buffer-size=10 --max-buffer-size=100 "^a" ./testdata/grepinput3) >>testtrygrep 2>&1
    457 echo "RC=$?" >>testtrygrep
    458 
    459 echo "---------------------------- Test 84 -----------------------------" >>testtrygrep
    460 echo testdata/grepinput3 >testtemp1grep
    461 (cd $srcdir; $valgrind $vjs $pcre2grep --file-list ./testdata/grepfilelist --file-list $builddir/testtemp1grep "fox|complete|t7") >>testtrygrep 2>&1
    462 echo "RC=$?" >>testtrygrep
    463 
    464 echo "---------------------------- Test 85 -----------------------------" >>testtrygrep
    465 (cd $srcdir; $valgrind $vjs $pcre2grep --file-list=./testdata/grepfilelist "dolor" ./testdata/grepinput3) >>testtrygrep 2>&1
    466 echo "RC=$?" >>testtrygrep
    467 
    468 echo "---------------------------- Test 86 -----------------------------" >>testtrygrep
    469 (cd $srcdir; $valgrind $vjs $pcre2grep "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
    470 echo "RC=$?" >>testtrygrep
    471 
    472 echo "---------------------------- Test 87 -----------------------------" >>testtrygrep
    473 (cd $srcdir; $valgrind $vjs $pcre2grep "cat" ./testdata/grepbinary) >>testtrygrep 2>&1
    474 echo "RC=$?" >>testtrygrep
    475 
    476 echo "---------------------------- Test 88 -----------------------------" >>testtrygrep
    477 (cd $srcdir; $valgrind $vjs $pcre2grep -v "cat" ./testdata/grepbinary) >>testtrygrep 2>&1
    478 echo "RC=$?" >>testtrygrep
    479 
    480 echo "---------------------------- Test 89 -----------------------------" >>testtrygrep
    481 (cd $srcdir; $valgrind $vjs $pcre2grep -I "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
    482 echo "RC=$?" >>testtrygrep
    483 
    484 echo "---------------------------- Test 90 -----------------------------" >>testtrygrep
    485 (cd $srcdir; $valgrind $vjs $pcre2grep --binary-files=without-match "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
    486 echo "RC=$?" >>testtrygrep
    487 
    488 echo "---------------------------- Test 91 -----------------------------" >>testtrygrep
    489 (cd $srcdir; $valgrind $vjs $pcre2grep -a "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
    490 echo "RC=$?" >>testtrygrep
    491 
    492 echo "---------------------------- Test 92 -----------------------------" >>testtrygrep
    493 (cd $srcdir; $valgrind $vjs $pcre2grep --binary-files=text "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
    494 echo "RC=$?" >>testtrygrep
    495 
    496 echo "---------------------------- Test 93 -----------------------------" >>testtrygrep
    497 (cd $srcdir; $valgrind $vjs $pcre2grep --text "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
    498 echo "RC=$?" >>testtrygrep
    499 
    500 echo "---------------------------- Test 94 -----------------------------" >>testtrygrep
    501 (cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include=grepinputx --include grepinput8 'fox' ./testdata/grepinput* | sort) >>testtrygrep
    502 echo "RC=$?" >>testtrygrep
    503 
    504 echo "---------------------------- Test 95 -----------------------------" >>testtrygrep
    505 (cd $srcdir; $valgrind $vjs $pcre2grep --file-list ./testdata/grepfilelist --exclude grepinputv "fox|complete") >>testtrygrep 2>&1
    506 echo "RC=$?" >>testtrygrep
    507 
    508 echo "---------------------------- Test 96 -----------------------------" >>testtrygrep
    509 (cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include-dir=testdata --exclude '^(?!grepinput)' --exclude=grepinputM 'fox' ./test* | sort) >>testtrygrep
    510 echo "RC=$?" >>testtrygrep
    511 
    512 echo "---------------------------- Test 97 -----------------------------" >>testtrygrep
    513 echo "grepinput$" >testtemp1grep
    514 echo "grepinput8" >>testtemp1grep
    515 (cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include=grepinput --exclude=grepinputM --exclude-from $builddir/testtemp1grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
    516 echo "RC=$?" >>testtrygrep
    517 
    518 echo "---------------------------- Test 98 -----------------------------" >>testtrygrep
    519 echo "grepinput$" >testtemp1grep
    520 echo "grepinput8" >>testtemp1grep
    521 (cd $srcdir; $valgrind $vjs $pcre2grep -L -r --exclude=grepinput3 --exclude=grepinputM --include=grepinput --exclude-from $builddir/testtemp1grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
    522 echo "RC=$?" >>testtrygrep
    523 
    524 echo "---------------------------- Test 99 -----------------------------" >>testtrygrep
    525 echo "grepinput$" >testtemp1grep
    526 echo "grepinput8" >testtemp2grep
    527 (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
    528 echo "RC=$?" >>testtrygrep
    529 
    530 echo "---------------------------- Test 100 ------------------------------" >>testtrygrep
    531 (cd $srcdir; $valgrind $vjs $pcre2grep -Ho2 --only-matching=1 -o3 '(\w+) binary (\w+)(\.)?' ./testdata/grepinput) >>testtrygrep
    532 echo "RC=$?" >>testtrygrep
    533 
    534 echo "---------------------------- Test 101 ------------------------------" >>testtrygrep
    535 (cd $srcdir; $valgrind $vjs $pcre2grep -o3 -Ho2 -o12 --only-matching=1 -o3 --colour=always --om-separator='|' '(\w+) binary (\w+)(\.)?' ./testdata/grepinput) >>testtrygrep
    536 echo "RC=$?" >>testtrygrep
    537 
    538 echo "---------------------------- Test 102 -----------------------------" >>testtrygrep
    539 (cd $srcdir; $valgrind $vjs $pcre2grep -n "^$" ./testdata/grepinput3) >>testtrygrep 2>&1
    540 echo "RC=$?" >>testtrygrep
    541 
    542 echo "---------------------------- Test 103 -----------------------------" >>testtrygrep
    543 (cd $srcdir; $valgrind $vjs $pcre2grep --only-matching "^$" ./testdata/grepinput3) >>testtrygrep 2>&1
    544 echo "RC=$?" >>testtrygrep
    545 
    546 echo "---------------------------- Test 104 -----------------------------" >>testtrygrep
    547 (cd $srcdir; $valgrind $vjs $pcre2grep -n --only-matching "^$" ./testdata/grepinput3) >>testtrygrep 2>&1
    548 echo "RC=$?" >>testtrygrep
    549 
    550 echo "---------------------------- Test 105 -----------------------------" >>testtrygrep
    551 (cd $srcdir; $valgrind $vjs $pcre2grep --colour=always "ipsum|" ./testdata/grepinput3) >>testtrygrep 2>&1
    552 echo "RC=$?" >>testtrygrep
    553 
    554 echo "---------------------------- Test 106 -----------------------------" >>testtrygrep
    555 (cd $srcdir; echo "a" | $valgrind $vjs $pcre2grep -M "|a" ) >>testtrygrep 2>&1
    556 echo "RC=$?" >>testtrygrep
    557 
    558 echo "---------------------------- Test 107 -----------------------------" >>testtrygrep
    559 echo "a" >testtemp1grep
    560 echo "aaaaa" >>testtemp1grep
    561 (cd $srcdir; $valgrind $vjs $pcre2grep  --line-offsets '(?<=\Ka)' $builddir/testtemp1grep) >>testtrygrep 2>&1
    562 echo "RC=$?" >>testtrygrep
    563 
    564 echo "---------------------------- Test 108 ------------------------------" >>testtrygrep
    565 (cd $srcdir; $valgrind $vjs $pcre2grep -lq PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
    566 echo "RC=$?" >>testtrygrep
    567 
    568 echo "---------------------------- Test 109 -----------------------------" >>testtrygrep
    569 (cd $srcdir; $valgrind $vjs $pcre2grep -cq lazy ./testdata/grepinput*) >>testtrygrep
    570 echo "RC=$?" >>testtrygrep
    571 
    572 echo "---------------------------- Test 110 -----------------------------" >>testtrygrep
    573 (cd $srcdir; $valgrind $vjs $pcre2grep --om-separator / -Mo0 -o1 -o2 'match (\d+):\n (.)\n' testdata/grepinput) >>testtrygrep
    574 echo "RC=$?" >>testtrygrep
    575 
    576 echo "---------------------------- Test 111 -----------------------------" >>testtrygrep
    577 (cd $srcdir; $valgrind $vjs $pcre2grep --line-offsets -M 'match (\d+):\n (.)\n' testdata/grepinput) >>testtrygrep
    578 echo "RC=$?" >>testtrygrep
    579 
    580 echo "---------------------------- Test 112 -----------------------------" >>testtrygrep
    581 (cd $srcdir; $valgrind $vjs $pcre2grep --file-offsets -M 'match (\d+):\n (.)\n' testdata/grepinput) >>testtrygrep
    582 echo "RC=$?" >>testtrygrep
    583 
    584 echo "---------------------------- Test 113 -----------------------------" >>testtrygrep
    585 (cd $srcdir; $valgrind $vjs $pcre2grep --total-count 'the' testdata/grepinput*) >>testtrygrep
    586 echo "RC=$?" >>testtrygrep
    587 
    588 echo "---------------------------- Test 114 -----------------------------" >>testtrygrep
    589 (cd $srcdir; $valgrind $vjs $pcre2grep -tc 'the' testdata/grepinput*) >>testtrygrep
    590 echo "RC=$?" >>testtrygrep
    591 
    592 echo "---------------------------- Test 115 -----------------------------" >>testtrygrep
    593 (cd $srcdir; $valgrind $vjs $pcre2grep -tlc 'the' testdata/grepinput*) >>testtrygrep
    594 echo "RC=$?" >>testtrygrep
    595 
    596 echo "---------------------------- Test 116 -----------------------------" >>testtrygrep
    597 (cd $srcdir; $valgrind $vjs $pcre2grep --exclude=grepinputM -th 'the' testdata/grepinput*) >>testtrygrep
    598 echo "RC=$?" >>testtrygrep
    599 
    600 echo "---------------------------- Test 117 -----------------------------" >>testtrygrep
    601 (cd $srcdir; $valgrind $vjs $pcre2grep -tch 'the' testdata/grepinput*) >>testtrygrep
    602 echo "RC=$?" >>testtrygrep
    603 
    604 echo "---------------------------- Test 118 -----------------------------" >>testtrygrep
    605 (cd $srcdir; $valgrind $vjs $pcre2grep -tL 'the' testdata/grepinput*) >>testtrygrep
    606 echo "RC=$?" >>testtrygrep
    607 
    608 echo "---------------------------- Test 119 -----------------------------" >>testtrygrep
    609 printf '123\n456\n789\n---abc\ndef\nxyz\n---\n' >testNinputgrep
    610 $valgrind $vjs $pcre2grep -Mo '(\n|[^-])*---' testNinputgrep >>testtrygrep
    611 echo "RC=$?" >>testtrygrep
    612 
    613 echo "---------------------------- Test 120 ------------------------------" >>testtrygrep
    614 (cd $srcdir; $valgrind $vjs $pcre2grep -HO '$0:$2$1$3' '(\w+) binary (\w+)(\.)?' ./testdata/grepinput) >>testtrygrep
    615 echo "RC=$?" >>testtrygrep
    616 
    617 echo "---------------------------- Test 121 -----------------------------" >>testtrygrep
    618 (cd $srcdir; $valgrind $vjs $pcre2grep -F '\E and (regex)' testdata/grepinputv) >>testtrygrep
    619 echo "RC=$?" >>testtrygrep
    620 
    621 echo "---------------------------- Test 122 -----------------------------" >>testtrygrep
    622 (cd $srcdir; $valgrind $vjs $pcre2grep -w 'cat|dog' testdata/grepinputv) >>testtrygrep
    623 echo "RC=$?" >>testtrygrep
    624 
    625 echo "---------------------------- Test 123 -----------------------------" >>testtrygrep
    626 (cd $srcdir; $valgrind $vjs $pcre2grep -w 'dog|cat' testdata/grepinputv) >>testtrygrep
    627 echo "RC=$?" >>testtrygrep
    628 
    629 echo "---------------------------- Test 124 -----------------------------" >>testtrygrep
    630 (cd $srcdir; $valgrind $vjs $pcre2grep -Mn --colour=always 'start[\s]+end' testdata/grepinputM) >>testtrygrep
    631 echo "RC=$?" >>testtrygrep
    632 (cd $srcdir; $valgrind $vjs $pcre2grep -Mn --colour=always -A2 'start[\s]+end' testdata/grepinputM) >>testtrygrep
    633 echo "RC=$?" >>testtrygrep
    634 (cd $srcdir; $valgrind $vjs $pcre2grep -Mn 'start[\s]+end' testdata/grepinputM) >>testtrygrep
    635 echo "RC=$?" >>testtrygrep
    636 (cd $srcdir; $valgrind $vjs $pcre2grep -Mn -A2 'start[\s]+end' testdata/grepinputM) >>testtrygrep
    637 echo "RC=$?" >>testtrygrep
    638 
    639 echo "---------------------------- Test 125 -----------------------------" >>testtrygrep
    640 printf 'abcd\n' >testNinputgrep
    641 $valgrind $vjs $pcre2grep --colour=always '(?<=\K.)' testNinputgrep >>testtrygrep
    642 echo "RC=$?" >>testtrygrep
    643 $valgrind $vjs $pcre2grep --colour=always '(?=.\K)' testNinputgrep >>testtrygrep
    644 echo "RC=$?" >>testtrygrep
    645 $valgrind $vjs $pcre2grep --colour=always '(?<=\K[ac])' testNinputgrep >>testtrygrep
    646 echo "RC=$?" >>testtrygrep
    647 $valgrind $vjs $pcre2grep --colour=always '(?=[ac]\K)' testNinputgrep >>testtrygrep
    648 echo "RC=$?" >>testtrygrep
    649 
    650 echo "---------------------------- Test 126 -----------------------------" >>testtrygrep
    651 printf 'Next line pattern has binary zero\nABC\0XYZ\n' >testtemp1grep
    652 printf 'ABC\0XYZ\nABCDEF\nDEFABC\n' >testtemp2grep
    653 $valgrind $vjs $pcre2grep -a -f testtemp1grep testtemp2grep >>testtrygrep
    654 echo "RC=$?" >>testtrygrep
    655 
    656 
    657 # Now compare the results.
    658 
    659 $cf $srcdir/testdata/grepoutput testtrygrep
    660 if [ $? != 0 ] ; then exit 1; fi
    661 
    662 
    663 # These tests require UTF-8 support
    664 
    665 if [ $utf8 -ne 0 ] ; then
    666   echo "Testing pcre2grep UTF-8 features"
    667 
    668   echo "---------------------------- Test U1 ------------------------------" >testtrygrep
    669   (cd $srcdir; $valgrind $vjs $pcre2grep -n -u --newline=any "^X" ./testdata/grepinput8) >>testtrygrep
    670   echo "RC=$?" >>testtrygrep
    671 
    672   echo "---------------------------- Test U2 ------------------------------" >>testtrygrep
    673   (cd $srcdir; $valgrind $vjs $pcre2grep -n -u -C 3 --newline=any "Match" ./testdata/grepinput8) >>testtrygrep
    674   echo "RC=$?" >>testtrygrep
    675 
    676   echo "---------------------------- Test U3 ------------------------------" >>testtrygrep
    677   (cd $srcdir; $valgrind $vjs $pcre2grep --line-offsets -u --newline=any '(?<=\K\x{17f})' ./testdata/grepinput8) >>testtrygrep
    678   echo "RC=$?" >>testtrygrep
    679 
    680   $cf $srcdir/testdata/grepoutput8 testtrygrep
    681   if [ $? != 0 ] ; then exit 1; fi
    682 
    683 else
    684   echo "Skipping pcre2grep UTF-8 tests: no UTF-8 support in PCRE2 library"
    685 fi
    686 
    687 
    688 # We go to some contortions to try to ensure that the tests for the various
    689 # newline settings will work in environments where the normal newline sequence
    690 # is not \n. Do not use exported files, whose line endings might be changed.
    691 # Instead, create an input file using printf so that its contents are exactly
    692 # what we want. Note the messy fudge to get printf to write a string that
    693 # starts with a hyphen. These tests are run in the build directory.
    694 
    695 echo "Testing pcre2grep newline settings"
    696 printf 'abc\rdef\r\nghi\njkl' >testNinputgrep
    697 
    698 printf '%c--------------------------- Test N1 ------------------------------\r\n' - >testtrygrep
    699 $valgrind $vjs $pcre2grep -n -N CR "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
    700 
    701 printf '%c--------------------------- Test N2 ------------------------------\r\n' - >>testtrygrep
    702 $valgrind $vjs $pcre2grep -n --newline=crlf "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
    703 
    704 printf '%c--------------------------- Test N3 ------------------------------\r\n' - >>testtrygrep
    705 pattern=`printf 'def\rjkl'`
    706 $valgrind $vjs $pcre2grep -n --newline=cr -F "$pattern" testNinputgrep >>testtrygrep
    707 
    708 printf '%c--------------------------- Test N4 ------------------------------\r\n' - >>testtrygrep
    709 $valgrind $vjs $pcre2grep -n --newline=crlf -F -f $srcdir/testdata/greppatN4 testNinputgrep >>testtrygrep
    710 
    711 printf '%c--------------------------- Test N5 ------------------------------\r\n' - >>testtrygrep
    712 $valgrind $vjs $pcre2grep -n --newline=any "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
    713 
    714 printf '%c--------------------------- Test N6 ------------------------------\r\n' - >>testtrygrep
    715 $valgrind $vjs $pcre2grep -n --newline=anycrlf "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
    716 
    717 # It seems impossible to handle NUL characters easily in Solaris (aka SunOS).
    718 # The version of sed explicitly doesn't like them. For the moment, we just
    719 # don't run this test under SunOS. Fudge the output so that the comparison
    720 # works. A similar problem has also been reported for MacOS (Darwin).
    721 
    722 printf '%c--------------------------- Test N7 ------------------------------\r\n' - >>testtrygrep
    723 uname=`uname`
    724 if [ "$uname" != "SunOS" -a "$uname" != "Darwin" ] ; then
    725   printf 'abc\0def' >testNinputgrep
    726   $valgrind $vjs $pcre2grep -na --newline=nul "^(abc|def)" testNinputgrep | sed 's/\x00/ZERO/' >>testtrygrep
    727   echo "" >>testtrygrep
    728 else
    729   echo '1:abcZERO2:def' >>testtrygrep
    730 fi
    731 
    732 $cf $srcdir/testdata/grepoutputN testtrygrep
    733 if [ $? != 0 ] ; then exit 1; fi
    734 
    735 # If pcre2grep supports script callouts, run some tests on them.
    736 
    737 if $valgrind $vjs $pcre2grep --help | $valgrind $vjs $pcre2grep -q 'Callout scripts in patterns are supported'; then
    738   echo "Testing pcre2grep script callouts"
    739   $valgrind $vjs $pcre2grep '(T)(..(.))(?C"/bin/echo|Arg1: [$1] [$2] [$3]|Arg2: $|${1}$| ($4) ($14) ($0)")()' $srcdir/testdata/grepinputv >testtrygrep
    740   $valgrind $vjs $pcre2grep '(T)(..(.))()()()()()()()(..)(?C"/bin/echo|Arg1: [$11] [${11}]")' $srcdir/testdata/grepinputv >>testtrygrep
    741   $valgrind $vjs $pcre2grep '(T)(?C"|$0:$1$n")' $srcdir/testdata/grepinputv >>testtrygrep
    742   $valgrind $vjs $pcre2grep '(T)(?C"|$1$n")(*F)' $srcdir/testdata/grepinputv >>testtrygrep
    743   # The above has no newline, which 'diff -ub' ignores, so add one.
    744   $cf $srcdir/testdata/grepoutputC testtrygrep
    745   if [ $? != 0 ] ; then exit 1; fi
    746 else
    747   echo "Script callouts are not supported"
    748 fi
    749 
    750 # Finally, some tests to exercise code that is not tested above, just to be
    751 # sure that it runs OK. Doing this improves the coverage statistics. The output
    752 # is not checked.
    753 
    754 echo "Testing miscellaneous pcre2grep arguments (unchecked)"
    755 echo '' >testtrygrep
    756 checkspecial '-xxxxx' 2
    757 checkspecial '--help' 0
    758 checkspecial '--line-buffered --colour=auto abc /dev/null' 1
    759 
    760 # Clean up local working files
    761 rm -f testNinputgrep teststderrgrep testtrygrep testtemp1grep testtemp2grep
    762 
    763 exit 0
    764 
    765 # End
    766