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