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