1 #! /bin/sh 2 3 ############################################################################### 4 # Run the PCRE2 tests using the pcre2test program. The appropriate tests are 5 # selected, depending on which build-time options were used. 6 # 7 # When JIT support is available, all appropriate tests are run with and without 8 # JIT, unless "-nojit" is given on the command line. There are also two tests 9 # for JIT-specific features, one to be run when JIT support is available 10 # (unless "-nojit" is specified), and one when it is not. 11 # 12 # Whichever of the 8-, 16- and 32-bit libraries exist are tested. It is also 13 # possible to select which to test by giving "-8", "-16" or "-32" on the 14 # command line. 15 # 16 # As well as "-nojit", "-8", "-16", and "-32", arguments for this script are 17 # individual test numbers, ranges of tests such as 3-6 or 3- (meaning 3 to the 18 # end), or a number preceded by ~ to exclude a test. For example, "3-15 ~10" 19 # runs tests 3 to 15, excluding test 10, and just "~10" runs all the tests 20 # except test 10. Whatever order the arguments are in, the tests are always run 21 # in numerical order. 22 # 23 # Inappropriate tests are automatically skipped (with a comment to say so). For 24 # example, if JIT support is not compiled, test 16 is skipped, whereas if JIT 25 # support is compiled, test 15 is skipped. 26 # 27 # Other arguments can be one of the words "-valgrind", "-valgrind-log", or 28 # "-sim" followed by an argument to run cross-compiled executables under a 29 # simulator, for example: 30 # 31 # RunTest 3 -sim "qemu-arm -s 8388608" 32 # 33 # For backwards compatibility, -nojit, -valgrind, -valgrind-log, and -sim may 34 # be given without the leading "-" character. 35 # 36 # When PCRE2 is compiled by clang with -fsanitize arguments, some tests need 37 # very much more stack than normal. In environments where the stack can be 38 # set at runtime, -bigstack sets a gigantic stack. 39 # 40 # There are two special cases where only one argument is allowed: 41 # 42 # If the first and only argument is "ebcdic", the script runs the special 43 # EBCDIC test that can be useful for checking certain EBCDIC features, even 44 # when run in an ASCII environment. PCRE2 must be built with EBCDIC support for 45 # this test to be run. 46 # 47 # If the script is obeyed as "RunTest list", a list of available tests is 48 # output, but none of them are run. 49 ############################################################################### 50 51 # Define test titles in variables so that they can be output as a list. Some 52 # of them are modified (e.g. with -8 or -16) when used in the actual tests. 53 54 title0="Test 0: Unchecked pcre2test argument tests (to improve coverage)" 55 title1="Test 1: Main non-UTF, non-UCP functionality (compatible with Perl >= 5.10)" 56 title2="Test 2: API, errors, internals and non-Perl stuff" 57 title3="Test 3: Locale-specific features" 58 title4A="Test 4: UTF" 59 title4B=" and Unicode property support (compatible with Perl >= 5.10)" 60 title5A="Test 5: API, internals, and non-Perl stuff for UTF" 61 title5B=" and UCP support" 62 title6="Test 6: DFA matching main non-UTF, non-UCP functionality" 63 title7A="Test 7: DFA matching with UTF" 64 title7B=" and Unicode property support" 65 title8="Test 8: Internal offsets and code size tests" 66 title9="Test 9: Specials for the basic 8-bit library" 67 title10="Test 10: Specials for the 8-bit library with UTF-8 and UCP support" 68 title11="Test 11: Specials for the basic 16-bit and 32-bit libraries" 69 title12="Test 12: Specials for the 16-bit and 32-bit libraries UTF and UCP support" 70 title13="Test 13: DFA specials for the basic 16-bit and 32-bit libraries" 71 title14="Test 14: DFA specials for UTF and UCP support" 72 title15="Test 15: Non-JIT limits and other non-JIT tests" 73 title16="Test 16: JIT-specific features when JIT is not available" 74 title17="Test 17: JIT-specific features when JIT is available" 75 title18="Test 18: Tests of the POSIX interface, excluding UTF/UCP" 76 title19="Test 19: Tests of the POSIX interface with UTF/UCP" 77 title20="Test 20: Serialization and code copy tests" 78 title21="Test 21: \C tests without UTF (supported for DFA matching)" 79 title22="Test 22: \C tests with UTF (not supported for DFA matching)" 80 title23="Test 23: \C disabled test" 81 maxtest=23 82 83 if [ $# -eq 1 -a "$1" = "list" ]; then 84 echo $title0 85 echo $title1 86 echo $title2 "(not UTF or UCP)" 87 echo $title3 88 echo $title4A $title4B 89 echo $title5A $title5B 90 echo $title6 91 echo $title7A $title7B 92 echo $title8 93 echo $title9 94 echo $title10 95 echo $title11 96 echo $title12 97 echo $title13 98 echo $title14 99 echo $title15 100 echo $title16 101 echo $title17 102 echo $title18 103 echo $title19 104 echo $title20 105 echo $title21 106 echo $title22 107 echo $title23 108 exit 0 109 fi 110 111 # Set up a suitable "diff" command for comparison. Some systems 112 # have a diff that lacks a -u option. Try to deal with this. 113 114 cf="diff" 115 diff -u /dev/null /dev/null 2>/dev/null && cf="diff -u" 116 117 # Find the test data 118 119 if [ -n "$srcdir" -a -d "$srcdir" ] ; then 120 testdata="$srcdir/testdata" 121 elif [ -d "./testdata" ] ; then 122 testdata=./testdata 123 elif [ -d "../testdata" ] ; then 124 testdata=../testdata 125 else 126 echo "Cannot find the testdata directory" 127 exit 1 128 fi 129 130 131 # ------ Function to check results of a test ------- 132 133 # This function is called with three parameters: 134 # 135 # $1 the value of $? after a call to pcre2test 136 # $2 the suffix of the output file to compare with 137 # $3 the $opt value (empty, -jit, or -dfa) 138 # 139 # Note: must define using name(), not "function name", for Solaris. 140 141 checkresult() 142 { 143 if [ $1 -ne 0 ] ; then 144 echo "** pcre2test failed - check testtry" 145 exit 1 146 fi 147 case "$3" in 148 -jit) with=" with JIT";; 149 -dfa) with=" with DFA";; 150 *) with="";; 151 esac 152 $cf $testdata/testoutput$2 testtry 153 if [ $? != 0 ] ; then 154 echo "" 155 echo "** Test $2 failed$with" 156 exit 1 157 fi 158 echo " OK$with" 159 } 160 161 162 # ------ Function to run and check a special pcre2test arguments test ------- 163 164 checkspecial() 165 { 166 $valgrind $vjs ./pcre2test $1 >>testtry 167 if [ $? -ne 0 ] ; then 168 echo "** pcre2test $1 failed - check testtry" 169 exit 1 170 fi 171 } 172 173 174 # ------ Special EBCDIC Test ------- 175 176 if [ $# -eq 1 -a "$1" = "ebcdic" ]; then 177 $valgrind ./pcre2test -C ebcdic >/dev/null 178 ebcdic=$? 179 if [ $ebcdic -ne 1 ] ; then 180 echo "Cannot run EBCDIC tests: EBCDIC support not compiled" 181 exit 1 182 fi 183 for opt in "" "-dfa"; do 184 ./pcre2test -q $opt $testdata/testinputEBC >testtry 185 checkresult $? EBC "$opt" 186 done 187 exit 0 188 fi 189 190 191 # ------ Normal Tests ------ 192 193 # Default values 194 195 arg8= 196 arg16= 197 arg32= 198 nojit= 199 bigstack= 200 sim= 201 skip= 202 valgrind= 203 vjs= 204 205 # This is in case the caller has set aliases (as I do - PH) 206 unset cp ls mv rm 207 208 # Process options and select which tests to run; for those that are explicitly 209 # requested, check that the necessary optional facilities are available. 210 211 do0=no 212 do1=no 213 do2=no 214 do3=no 215 do4=no 216 do5=no 217 do6=no 218 do7=no 219 do8=no 220 do9=no 221 do10=no 222 do11=no 223 do12=no 224 do13=no 225 do14=no 226 do15=no 227 do16=no 228 do17=no 229 do18=no 230 do19=no 231 do20=no 232 do21=no 233 do22=no 234 do23=no 235 236 while [ $# -gt 0 ] ; do 237 case $1 in 238 0) do0=yes;; 239 1) do1=yes;; 240 2) do2=yes;; 241 3) do3=yes;; 242 4) do4=yes;; 243 5) do5=yes;; 244 6) do6=yes;; 245 7) do7=yes;; 246 8) do8=yes;; 247 9) do9=yes;; 248 10) do10=yes;; 249 11) do11=yes;; 250 12) do12=yes;; 251 13) do13=yes;; 252 14) do14=yes;; 253 15) do15=yes;; 254 16) do16=yes;; 255 17) do17=yes;; 256 18) do18=yes;; 257 19) do19=yes;; 258 20) do20=yes;; 259 21) do21=yes;; 260 22) do22=yes;; 261 23) do23=yes;; 262 -8) arg8=yes;; 263 -16) arg16=yes;; 264 -32) arg32=yes;; 265 bigstack|-bigstack) bigstack=yes;; 266 nojit|-nojit) nojit=yes;; 267 sim|-sim) shift; sim=$1;; 268 valgrind|-valgrind) valgrind="valgrind --tool=memcheck -q --smc-check=all-non-file";; 269 valgrind-log|-valgrind-log) valgrind="valgrind --tool=memcheck --num-callers=30 --leak-check=no --error-limit=no --smc-check=all-non-file --log-file=report.%p ";; 270 ~*) 271 if expr "$1" : '~[0-9][0-9]*$' >/dev/null; then 272 skip="$skip `expr "$1" : '~\([0-9]*\)*$'`" 273 else 274 echo "Unknown option or test selector '$1'"; exit 1 275 fi 276 ;; 277 *-*) 278 if expr "$1" : '[0-9][0-9]*-[0-9]*$' >/dev/null; then 279 tf=`expr "$1" : '\([0-9]*\)'` 280 tt=`expr "$1" : '.*-\([0-9]*\)'` 281 if [ "$tt" = "" ] ; then tt=$maxtest; fi 282 if expr \( "$tt" ">" "$maxtest" \) >/dev/null; then 283 echo "Invalid test range '$1'"; exit 1 284 fi 285 while expr "$tf" "<=" "$tt" >/dev/null; do 286 eval do${tf}=yes 287 tf=`expr $tf + 1` 288 done 289 else 290 echo "Invalid test range '$1'"; exit 1 291 fi 292 ;; 293 *) echo "Unknown option or test selector '$1'"; exit 1;; 294 esac 295 shift 296 done 297 298 # Find which optional facilities are available. 299 300 $sim ./pcre2test -C linksize >/dev/null 301 link_size=$? 302 if [ $link_size -lt 2 ] ; then 303 echo "RunTest: Failed to find internal link size" 304 exit 1 305 fi 306 if [ $link_size -gt 4 ] ; then 307 echo "RunTest: Failed to find internal link size" 308 exit 1 309 fi 310 311 # If it is possible to set the system stack size, arrange to set a value for 312 # test 2, which needs more than the even the Linux default when PCRE2 has been 313 # compiled by gcc with -fsanitize=address. If "bigstack" is on the command 314 # line, set even bigger numbers. When the compiler is clang, sanitize options 315 # require an even bigger stack for test 2, and an increased stack for some of 316 # the other tests. Test 2 now has code to automatically try again with a 64M 317 # stack if it crashes when test2stack is "-S 16" when matching with the 318 # interpreter. 319 320 $sim ./pcre2test -S 1 /dev/null /dev/null 321 if [ $? -eq 0 ] ; then 322 if [ "$bigstack" = "" ] ; then 323 test2stack="-S 16" 324 defaultstack="" 325 else 326 test2stack="-S 1024" 327 defaultstack="-S 64" 328 fi 329 else 330 test2stack="" 331 defaultstack="" 332 fi 333 334 # All of 8-bit, 16-bit, and 32-bit character strings may be supported, but only 335 # one need be. 336 337 $sim ./pcre2test -C pcre2-8 >/dev/null 338 support8=$? 339 $sim ./pcre2test -C pcre2-16 >/dev/null 340 support16=$? 341 $sim ./pcre2test -C pcre2-32 >/dev/null 342 support32=$? 343 344 # \C may be disabled 345 346 $sim ./pcre2test -C backslash-C >/dev/null 347 supportBSC=$? 348 349 # Initialize all bitsizes skipped 350 351 test8=skip 352 test16=skip 353 test32=skip 354 355 # If no bitsize arguments, select all that are available 356 357 if [ "$arg8$arg16$arg32" = "" ] ; then 358 if [ $support8 -ne 0 ] ; then 359 test8=-8 360 fi 361 if [ $support16 -ne 0 ] ; then 362 test16=-16 363 fi 364 if [ $support32 -ne 0 ] ; then 365 test32=-32 366 fi 367 368 # Otherwise, select requested bit sizes 369 370 else 371 if [ "$arg8" = yes ] ; then 372 if [ $support8 -eq 0 ] ; then 373 echo "Cannot run 8-bit library tests: 8-bit library not compiled" 374 exit 1 375 fi 376 test8=-8 377 fi 378 if [ "$arg16" = yes ] ; then 379 if [ $support16 -eq 0 ] ; then 380 echo "Cannot run 16-bit library tests: 16-bit library not compiled" 381 exit 1 382 fi 383 test16=-16 384 fi 385 if [ "$arg32" = yes ] ; then 386 if [ $support32 -eq 0 ] ; then 387 echo "Cannot run 32-bit library tests: 32-bit library not compiled" 388 exit 1 389 fi 390 test32=-32 391 fi 392 fi 393 394 # UTF support is implied by Unicode support, and it always applies to all bit 395 # sizes if both are supported; we can't have UTF-8 support without UTF-16 or 396 # UTF-32 support. 397 398 $sim ./pcre2test -C unicode >/dev/null 399 utf=$? 400 401 # When JIT is used with valgrind, we need to set up valgrind suppressions as 402 # otherwise there are a lot of false positive valgrind reports when the 403 # the hardware supports SSE2. 404 405 jitopt= 406 $sim ./pcre2test -C jit >/dev/null 407 jit=$? 408 if [ $jit -ne 0 -a "$nojit" != "yes" ] ; then 409 jitopt=-jit 410 if [ "$valgrind" != "" ] ; then 411 vjs="--suppressions=$testdata/valgrind-jit.supp" 412 fi 413 fi 414 415 # If no specific tests were requested, select all. Those that are not 416 # relevant will be automatically skipped. 417 418 if [ $do0 = no -a $do1 = no -a $do2 = no -a $do3 = no -a \ 419 $do4 = no -a $do5 = no -a $do6 = no -a $do7 = no -a \ 420 $do8 = no -a $do9 = no -a $do10 = no -a $do11 = no -a \ 421 $do12 = no -a $do13 = no -a $do14 = no -a $do15 = no -a \ 422 $do16 = no -a $do17 = no -a $do18 = no -a $do19 = no -a \ 423 $do20 = no -a $do21 = no -a $do22 = no -a $do23 = no \ 424 ]; then 425 do0=yes 426 do1=yes 427 do2=yes 428 do3=yes 429 do4=yes 430 do5=yes 431 do6=yes 432 do7=yes 433 do8=yes 434 do9=yes 435 do10=yes 436 do11=yes 437 do12=yes 438 do13=yes 439 do14=yes 440 do15=yes 441 do16=yes 442 do17=yes 443 do18=yes 444 do19=yes 445 do20=yes 446 do21=yes 447 do22=yes 448 do23=yes 449 fi 450 451 # Handle any explicit skips at this stage, so that an argument list may consist 452 # only of explicit skips. 453 454 for i in $skip; do eval do$i=no; done 455 456 # Show which release and which test data 457 458 echo "" 459 echo PCRE2 C library tests using test data from $testdata 460 $sim ./pcre2test /dev/null 461 echo "" 462 463 for bmode in "$test8" "$test16" "$test32"; do 464 case "$bmode" in 465 skip) continue;; 466 -16) if [ "$test8$test32" != "skipskip" ] ; then echo ""; fi 467 bits=16; echo "---- Testing 16-bit library ----"; echo "";; 468 -32) if [ "$test8$test16" != "skipskip" ] ; then echo ""; fi 469 bits=32; echo "---- Testing 32-bit library ----"; echo "";; 470 -8) bits=8; echo "---- Testing 8-bit library ----"; echo "";; 471 esac 472 473 # Test 0 is a special test. Its output is not checked, because it will 474 # be different on different hardware and with different configurations. 475 # Running this test just exercises the code. 476 477 if [ $do0 = yes ] ; then 478 echo $title0 479 echo '/abc/jit,memory' >testSinput 480 echo ' abc' >>testSinput 481 echo '' >testtry 482 checkspecial '-C' 483 checkspecial '--help' 484 checkspecial '-S 1 -t 10 testSinput' 485 echo " OK" 486 fi 487 488 # Primary non-UTF test, compatible with JIT and all versions of Perl >= 5.8 489 490 if [ $do1 = yes ] ; then 491 echo $title1 492 for opt in "" $jitopt; do 493 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput1 testtry 494 checkresult $? 1 "$opt" 495 done 496 fi 497 498 # PCRE2 tests that are not Perl-compatible: API, errors, internals 499 500 if [ $do2 = yes ] ; then 501 echo $title2 "(excluding UTF-$bits)" 502 for opt in "" $jitopt; do 503 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $test2stack $bmode $opt $testdata/testinput2 testtry 504 if [ $? = 0 ] ; then 505 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $bmode $opt -error -63,-62,-2,-1,0,100,188,189 >>testtry 506 checkresult $? 2 "$opt" 507 else 508 echo " " 509 echo "** Test 2, when run under the interpreter, requires a lot of stack." 510 echo "** If it has crashed with a segmentation fault, it may be that you" 511 echo "** do not have enough stack available by default. Please see the" 512 echo "** 'pcre2stack' man page for a discussion of PCRE2's stack usage." 513 if [ "$test2stack" != "-S 16" -o "$opt" != "" ]; then 514 echo " " 515 exit 1 516 fi 517 echo " " 518 echo "** Trying again with an increased stack size." 519 echo " " 520 echo $title2 "(excluding UTF-$bits) (64M stack)" 521 $sim $valgrind ${opt:+$vjs} ./pcre2test -q -S 64 $bmode $opt $testdata/testinput2 testtry 522 if [ $? = 0 ] ; then 523 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $bmode $opt -error -63,-62,-2,-1,0,100,188,189 >>testtry 524 checkresult $? 2 "$opt" 525 else 526 echo " " 527 echo "** Failed with an increased stack size. Tests abandoned." 528 echo " " 529 exit 1 530 fi 531 fi 532 done 533 fi 534 535 # Locale-specific tests, provided that either the "fr_FR", "fr_CA", "french" 536 # or "fr" locale is available. The first two are Unix-like standards; the 537 # last two are for Windows. Unfortunately, different versions of the French 538 # locale give different outputs for some items. This test passes if the 539 # output matches any one of the alternative output files. 540 541 if [ $do3 = yes ] ; then 542 locale= 543 544 # In some environments locales that are listed by the "locale -a" 545 # command do not seem to work with setlocale(). Therefore, we do 546 # a preliminary test to see if pcre2test can set one before going 547 # on to use it. 548 549 for loc in 'fr_FR' 'french' 'fr' 'fr_CA'; do 550 locale -a | grep "^$loc\$" >/dev/null 551 if [ $? -eq 0 ] ; then 552 echo "/a/locale=$loc" | \ 553 $sim $valgrind ./pcre2test -q $bmode | \ 554 grep "Failed to set locale" >/dev/null 555 if [ $? -ne 0 ] ; then 556 locale=$loc 557 if [ "$locale" = "fr_FR" ] ; then 558 infile=$testdata/testinput3 559 outfile=$testdata/testoutput3 560 outfile2=$testdata/testoutput3A 561 outfile3=$testdata/testoutput3B 562 else 563 infile=test3input 564 outfile=test3output 565 outfile2=test3outputA 566 outfile3=test3outputB 567 sed "s/fr_FR/$loc/" $testdata/testinput3 >test3input 568 sed "s/fr_FR/$loc/" $testdata/testoutput3 >test3output 569 sed "s/fr_FR/$loc/" $testdata/testoutput3A >test3outputA 570 sed "s/fr_FR/$loc/" $testdata/testoutput3B >test3outputB 571 fi 572 break 573 fi 574 fi 575 done 576 577 if [ "$locale" != "" ] ; then 578 echo $title3 "(using '$locale' locale)" 579 for opt in "" $jitopt; do 580 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $infile testtry 581 if [ $? = 0 ] ; then 582 case "$opt" in 583 -jit) with=" with JIT";; 584 *) with="";; 585 esac 586 if $cf $outfile testtry >teststdout || \ 587 $cf $outfile2 testtry >teststdout || \ 588 $cf $outfile3 testtry >teststdout 589 then 590 echo " OK$with" 591 else 592 echo "** Locale test did not run successfully$with. The output did not match" 593 echo " $outfile, $outfile2 or $outfile3." 594 echo " This may mean that there is a problem with the locale settings rather" 595 echo " than a bug in PCRE2." 596 exit 1 597 fi 598 else exit 1 599 fi 600 done 601 else 602 echo "Cannot test locale-specific features - none of the 'fr_FR', 'fr_CA'," 603 echo "'fr' or 'french' locales can be set, or the \"locale\" command is" 604 echo "not available to check for them." 605 echo " " 606 fi 607 fi 608 609 # Tests for UTF and Unicode property support 610 611 if [ $do4 = yes ] ; then 612 echo ${title4A}-${bits}${title4B} 613 if [ $utf -eq 0 ] ; then 614 echo " Skipped because UTF-$bits support is not available" 615 else 616 for opt in "" $jitopt; do 617 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput4 testtry 618 checkresult $? 4 "$opt" 619 done 620 fi 621 fi 622 623 if [ $do5 = yes ] ; then 624 echo ${title5A}-${bits}$title5B 625 if [ $utf -eq 0 ] ; then 626 echo " Skipped because UTF-$bits support is not available" 627 else 628 for opt in "" $jitopt; do 629 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput5 testtry 630 checkresult $? 5 "$opt" 631 done 632 fi 633 fi 634 635 # Tests for DFA matching support 636 637 if [ $do6 = yes ] ; then 638 echo $title6 639 $sim $valgrind ./pcre2test -q $defaultstack $bmode $testdata/testinput6 testtry 640 checkresult $? 6 "" 641 fi 642 643 if [ $do7 = yes ] ; then 644 echo ${title7A}-${bits}$title7B 645 if [ $utf -eq 0 ] ; then 646 echo " Skipped because UTF-$bits support is not available" 647 else 648 $sim $valgrind ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput7 testtry 649 checkresult $? 7 "" 650 fi 651 fi 652 653 # Test of internal offsets and code sizes. This test is run only when there 654 # is UTF/UCP support. The actual tests are mostly the same as in some of the 655 # above, but in this test we inspect some offsets and sizes. This is a 656 # doublecheck for the maintainer, just in case something changes unexpectely. 657 # The output from this test is different in 8-bit, 16-bit, and 32-bit modes 658 # and for different link sizes, so there are different output files for each 659 # mode and link size. 660 661 if [ $do8 = yes ] ; then 662 echo $title8 663 if [ $utf -eq 0 ] ; then 664 echo " Skipped because UTF-$bits support is not available" 665 else 666 $sim $valgrind ./pcre2test -q $defaultstack $bmode $testdata/testinput8 testtry 667 checkresult $? 8-$bits-$link_size "" 668 fi 669 fi 670 671 # Tests for 8-bit-specific features 672 673 if [ "$do9" = yes ] ; then 674 echo $title9 675 if [ "$bits" = "16" -o "$bits" = "32" ] ; then 676 echo " Skipped when running 16/32-bit tests" 677 else 678 for opt in "" $jitopt; do 679 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput9 testtry 680 checkresult $? 9 "$opt" 681 done 682 fi 683 fi 684 685 # Tests for UTF-8 and UCP 8-bit-specific features 686 687 if [ "$do10" = yes ] ; then 688 echo $title10 689 if [ "$bits" = "16" -o "$bits" = "32" ] ; then 690 echo " Skipped when running 16/32-bit tests" 691 elif [ $utf -eq 0 ] ; then 692 echo " Skipped because UTF-$bits support is not available" 693 else 694 for opt in "" $jitopt; do 695 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput10 testtry 696 checkresult $? 10 "$opt" 697 done 698 fi 699 fi 700 701 # Tests for 16-bit and 32-bit features. Output is different for the two widths. 702 703 if [ $do11 = yes ] ; then 704 echo $title11 705 if [ "$bits" = "8" ] ; then 706 echo " Skipped when running 8-bit tests" 707 else 708 for opt in "" $jitopt; do 709 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput11 testtry 710 checkresult $? 11-$bits "$opt" 711 done 712 fi 713 fi 714 715 # Tests for 16-bit and 32-bit features with UTF-16/32 and UCP support. Output 716 # is different for the two widths. 717 718 if [ $do12 = yes ] ; then 719 echo $title12 720 if [ "$bits" = "8" ] ; then 721 echo " Skipped when running 8-bit tests" 722 elif [ $utf -eq 0 ] ; then 723 echo " Skipped because UTF-$bits support is not available" 724 else 725 for opt in "" $jitopt; do 726 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput12 testtry 727 checkresult $? 12-$bits "$opt" 728 done 729 fi 730 fi 731 732 # Tests for 16/32-bit-specific features in DFA non-UTF modes 733 734 if [ $do13 = yes ] ; then 735 echo $title13 736 if [ "$bits" = "8" ] ; then 737 echo " Skipped when running 8-bit tests" 738 else 739 $sim $valgrind ./pcre2test -q $defaultstack $bmode $testdata/testinput13 testtry 740 checkresult $? 13 "" 741 fi 742 fi 743 744 # Tests for DFA UTF and UCP features. Output is different for the different widths. 745 746 if [ $do14 = yes ] ; then 747 echo $title14 748 if [ $utf -eq 0 ] ; then 749 echo " Skipped because UTF-$bits support is not available" 750 else 751 $sim $valgrind ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput14 testtry 752 checkresult $? 14-$bits "" 753 fi 754 fi 755 756 # Test non-JIT match and recursion limits 757 758 if [ $do15 = yes ] ; then 759 echo $title15 760 $sim $valgrind ./pcre2test -q $defaultstack $bmode $testdata/testinput15 testtry 761 checkresult $? 15 "" 762 fi 763 764 # Test JIT-specific features when JIT is not available 765 766 if [ $do16 = yes ] ; then 767 echo $title16 768 if [ $jit -ne 0 ] ; then 769 echo " Skipped because JIT is available" 770 else 771 $sim $valgrind ./pcre2test -q $defaultstack $bmode $testdata/testinput16 testtry 772 checkresult $? 16 "" 773 fi 774 fi 775 776 # Test JIT-specific features when JIT is available 777 778 if [ $do17 = yes ] ; then 779 echo $title17 780 if [ $jit -eq 0 -o "$nojit" = "yes" ] ; then 781 echo " Skipped because JIT is not available or nojit was specified" 782 else 783 $sim $valgrind $vjs ./pcre2test -q $defaultstack $bmode $testdata/testinput17 testtry 784 checkresult $? 17 "" 785 fi 786 fi 787 788 # Tests for the POSIX interface without UTF/UCP (8-bit only) 789 790 if [ $do18 = yes ] ; then 791 echo $title18 792 if [ "$bits" = "16" -o "$bits" = "32" ] ; then 793 echo " Skipped when running 16/32-bit tests" 794 else 795 $sim $valgrind ./pcre2test -q $defaultstack $bmode $testdata/testinput18 testtry 796 checkresult $? 18 "" 797 fi 798 fi 799 800 # Tests for the POSIX interface with UTF/UCP (8-bit only) 801 802 if [ $do19 = yes ] ; then 803 echo $title19 804 if [ "$bits" = "16" -o "$bits" = "32" ] ; then 805 echo " Skipped when running 16/32-bit tests" 806 elif [ $utf -eq 0 ] ; then 807 echo " Skipped because UTF-$bits support is not available" 808 else 809 $sim $valgrind ./pcre2test -q $defaultstack $bmode $testdata/testinput19 testtry 810 checkresult $? 19 "" 811 fi 812 fi 813 814 # Serialization tests 815 816 if [ $do20 = yes ] ; then 817 echo $title20 818 $sim $valgrind ./pcre2test -q $defaultstack $bmode $testdata/testinput20 testtry 819 checkresult $? 20 "" 820 fi 821 822 # \C tests without UTF - DFA matching is supported 823 824 if [ "$do21" = yes ] ; then 825 echo $title21 826 if [ $supportBSC -eq 0 ] ; then 827 echo " Skipped because \C is disabled" 828 else 829 for opt in "" $jitopt -dfa; do 830 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput21 testtry 831 checkresult $? 21 "$opt" 832 done 833 fi 834 fi 835 836 # \C tests with UTF - DFA matching is not supported for \C in UTF mode 837 838 if [ "$do22" = yes ] ; then 839 echo $title22 840 if [ $supportBSC -eq 0 ] ; then 841 echo " Skipped because \C is disabled" 842 elif [ $utf -eq 0 ] ; then 843 echo " Skipped because UTF-$bits support is not available" 844 else 845 for opt in "" $jitopt; do 846 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput22 testtry 847 checkresult $? 22-$bits "$opt" 848 done 849 fi 850 fi 851 852 # Test when \C is disabled 853 854 if [ "$do23" = yes ] ; then 855 echo $title23 856 if [ $supportBSC -ne 0 ] ; then 857 echo " Skipped because \C is not disabled" 858 else 859 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput23 testtry 860 checkresult $? 23 "" 861 fi 862 fi 863 864 # End of loop for 8/16/32-bit tests 865 done 866 867 # Clean up local working files 868 rm -f testSinput test3input testsaved1 testsaved2 test3output test3outputA test3outputB teststdout teststderr testtry 869 870 # End 871