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