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