tools/pcre/RunTest
changeset 3831 babd0eee3c5e
parent 2762 d2d467bf1b5a
     1.1 --- a/tools/pcre/RunTest	Sun Mar 17 11:29:55 2013 -0400
     1.2 +++ b/tools/pcre/RunTest	Sun Mar 17 11:32:03 2013 -0400
     1.3 @@ -1,35 +1,164 @@
     1.4  #! /bin/sh
     1.5  
     1.6 -# Run PCRE tests.
     1.7 +# Run the PCRE tests using the pcretest program. The appropriate tests are
     1.8 +# selected, depending on which build-time options were used.
     1.9 +#
    1.10 +# All tests are now run both with and without -s, to ensure that everything is
    1.11 +# tested with and without studying. However, there are some tests that produce
    1.12 +# different output after studying, typically when we are tracing the actual
    1.13 +# matching process (for example, using auto-callouts). In these few cases, the
    1.14 +# tests are duplicated in the files, one with /S to force studying always, and
    1.15 +# one with /SS to force *not* studying always. The use of -s doesn't then make
    1.16 +# any difference to their output. There is also one test which compiles invalid
    1.17 +# UTF-8 with the UTF-8 check turned off; for this, studying must also be
    1.18 +# disabled with /SS.
    1.19 +#
    1.20 +# When JIT support is available, all the tests are also run with -s+ to test
    1.21 +# (again, almost) everything with studying and the JIT option. There are also
    1.22 +# two tests for JIT-specific features, one to be run when JIT support is
    1.23 +# available, and one when it is not.
    1.24 +#
    1.25 +# Whichever of the 8-, 16- and 32-bit libraries exist are tested. It is also
    1.26 +# possible to select which to test by the arguments -8, -16 or -32.
    1.27 +#
    1.28 +# Other arguments for this script can be individual test numbers, or the word
    1.29 +# "valgrind", "valgrind-log" or "sim" followed by an argument to run cross-
    1.30 +# compiled executables under a simulator, for example:
    1.31 +#
    1.32 +# RunTest 3 sim "qemu-arm -s 8388608"
    1.33 +#
    1.34 +#
    1.35 +# There are two special cases where only one argument is allowed:
    1.36 +#
    1.37 +# If the first and only argument is "ebcdic", the script runs the special
    1.38 +# EBCDIC test that can be useful for checking certain EBCDIC features, even
    1.39 +# when run in an ASCII environment.
    1.40 +#
    1.41 +# If the script is obeyed as "RunTest list", a list of available tests is
    1.42 +# output, but none of them are run.
    1.43 +
    1.44 +
    1.45 +# Define test titles in variables so that they can be output as a list. Some
    1.46 +# of them are modified (e.g. with -8 or -16) when used in the actual tests.
    1.47  
    1.48 -valgrind=
    1.49 +title1="Test 1: Main functionality (Compatible with Perl >= 5.10)"
    1.50 +title2="Test 2: API, errors, internals, and non-Perl stuff"
    1.51 +title3="Test 3: Locale-specific features"
    1.52 +title4A="Test 4: UTF"
    1.53 +title4B=" support (Compatible with Perl >= 5.10)"
    1.54 +title5="Test 5: API, internals, and non-Perl stuff for UTF"
    1.55 +title6="Test 6: Unicode property support (Compatible with Perl >= 5.10)"
    1.56 +title7="Test 7: API, internals, and non-Perl stuff for Unicode property support"
    1.57 +title8="Test 8: DFA matching main functionality"
    1.58 +title9="Test 9: DFA matching with UTF"
    1.59 +title10="Test 10: DFA matching with Unicode properties"
    1.60 +title11="Test 11: Internal offsets and code size tests"
    1.61 +title12="Test 12: JIT-specific features (JIT available)"
    1.62 +title13="Test 13: JIT-specific features (JIT not available)"
    1.63 +title14="Test 14: Specials for the basic 8-bit library"
    1.64 +title15="Test 15: Specials for the 8-bit library with UTF-8 support"
    1.65 +title16="Test 16: Specials for the 8-bit library with Unicode propery support"
    1.66 +title17="Test 17: Specials for the basic 16/32-bit library"
    1.67 +title18="Test 18: Specials for the 16/32-bit library with UTF-16/32 support"
    1.68 +title19="Test 19: Specials for the 16/32-bit library with Unicode property support"
    1.69 +title20="Test 20: DFA specials for the basic 16/32-bit library"
    1.70 +title21="Test 21: Reloads for the basic 16/32-bit library"
    1.71 +title22="Test 22: Reloads for the 16/32-bit library with UTF-16/32 support"
    1.72 +title23="Test 23: Specials for the 16-bit library"
    1.73 +title24="Test 24: Specials for the 16-bit library with UTF-16 support"
    1.74 +title25="Test 25: Specials for the 32-bit library"
    1.75 +title26="Test 26: Specials for the 32-bit library with UTF-32 support"
    1.76 +
    1.77 +if [ $# -eq 1 -a "$1" = "list" ]; then
    1.78 +  echo $title1
    1.79 +  echo $title2 "(not UTF)"
    1.80 +  echo $title3
    1.81 +  echo $title4A $title4B
    1.82 +  echo $title5 support
    1.83 +  echo $title6
    1.84 +  echo $title7
    1.85 +  echo $title8
    1.86 +  echo $title9
    1.87 +  echo $title10
    1.88 +  echo $title11
    1.89 +  echo $title12
    1.90 +  echo $title13
    1.91 +  echo $title14
    1.92 +  echo $title15
    1.93 +  echo $title16
    1.94 +  echo $title17
    1.95 +  echo $title18
    1.96 +  echo $title19
    1.97 +  echo $title20
    1.98 +  echo $title21
    1.99 +  echo $title22
   1.100 +  echo $title23
   1.101 +  echo $title24
   1.102 +  echo $title25
   1.103 +  echo $title26
   1.104 +  exit 0
   1.105 +fi
   1.106  
   1.107  # Set up a suitable "diff" command for comparison. Some systems
   1.108  # have a diff that lacks a -u option. Try to deal with this.
   1.109  
   1.110 -if diff -u /dev/null /dev/null; then cf="diff -u"; else cf="diff"; fi
   1.111 +cf="diff"
   1.112 +diff -u /dev/null /dev/null 2>/dev/null && cf="diff -u"
   1.113  
   1.114  # Find the test data
   1.115  
   1.116 -testdata=testdata
   1.117  if [ -n "$srcdir" -a -d "$srcdir" ] ; then
   1.118    testdata="$srcdir/testdata"
   1.119 +elif [ -d "./testdata" ] ; then
   1.120 +  testdata=./testdata
   1.121 +elif [ -d "../testdata" ] ; then
   1.122 +  testdata=../testdata
   1.123 +else
   1.124 +  echo "Cannot find the testdata directory"
   1.125 +  exit 1
   1.126  fi
   1.127  
   1.128 -# Find which optional facilities are available
   1.129 +
   1.130 +# ------ Special EBCDIC Test -------
   1.131 +
   1.132 +if [ $# -eq 1 -a "$1" = "ebcdic" ]; then
   1.133 +  ./pcretest -C ebcdic >/dev/null
   1.134 +  ebcdic=$?
   1.135 +  if [ $ebcdic -ne 1 ] ; then
   1.136 +    echo "Cannot run EBCDIC tests: EBCDIC support not compiled"
   1.137 +    exit 1
   1.138 +  fi
   1.139  
   1.140 -case `./pcretest -C | ./pcregrep 'Internal link size'` in
   1.141 -  *2) link_size=2;;
   1.142 -  *3) link_size=3;;
   1.143 -  *4) link_size=4;;
   1.144 -   *) echo "Failed to find internal link size"; exit 1;;
   1.145 -esac
   1.146 +  for opt in "" "-s" "-dfa" "-s -dfa"; do
   1.147 +    ./pcretest -q $opt $testdata/testinputEBC >testtry
   1.148 +    if [ $? = 0 ] ; then
   1.149 +      $cf $testdata/testoutputEBC testtry
   1.150 +      if [ $? != 0 ] ; then exit 1; fi
   1.151 +    else exit 1
   1.152 +    fi
   1.153 +    if [ "$opt" = "-s" ] ; then echo "  OK with study"
   1.154 +    elif [ "$opt" = "-dfa" ] ; then echo "  OK using DFA"
   1.155 +    elif [ "$opt" = "-s -dfa" ] ; then echo "  OK using DFA with study"
   1.156 +    else echo "  OK"
   1.157 +    fi
   1.158 +  done
   1.159  
   1.160 -./pcretest -C | ./pcregrep 'No UTF-8 support' >/dev/null
   1.161 -utf8=$?
   1.162 +exit 0
   1.163 +fi
   1.164 +
   1.165 +
   1.166 +# ------ Normal Tests ------
   1.167 +
   1.168 +# Default values
   1.169  
   1.170 -./pcretest -C | ./pcregrep 'No Unicode properties support' >/dev/null
   1.171 -ucp=$?
   1.172 +valgrind=
   1.173 +sim=
   1.174 +arg8=
   1.175 +arg16=
   1.176 +arg32=
   1.177 +
   1.178 +# This is in case the caller has set aliases (as I do - PH)
   1.179 +unset cp ls mv rm
   1.180  
   1.181  # Select which tests to run; for those that are explicitly requested, check
   1.182  # that the necessary optional facilities are available.
   1.183 @@ -44,6 +173,22 @@
   1.184  do8=no
   1.185  do9=no
   1.186  do10=no
   1.187 +do11=no
   1.188 +do12=no
   1.189 +do13=no
   1.190 +do14=no
   1.191 +do15=no
   1.192 +do16=no
   1.193 +do17=no
   1.194 +do18=no
   1.195 +do19=no
   1.196 +do20=no
   1.197 +do21=no
   1.198 +do22=no
   1.199 +do23=no
   1.200 +do24=no
   1.201 +do25=no
   1.202 +do26=no
   1.203  
   1.204  while [ $# -gt 0 ] ; do
   1.205    case $1 in
   1.206 @@ -57,25 +202,140 @@
   1.207      8) do8=yes;;
   1.208      9) do9=yes;;
   1.209     10) do10=yes;;
   1.210 -   valgrind) valgrind="valgrind -q";;
   1.211 -    *) echo "Unknown test number $1"; exit 1;;
   1.212 +   11) do11=yes;;
   1.213 +   12) do12=yes;;
   1.214 +   13) do13=yes;;
   1.215 +   14) do14=yes;;
   1.216 +   15) do15=yes;;
   1.217 +   16) do16=yes;;
   1.218 +   17) do17=yes;;
   1.219 +   18) do18=yes;;
   1.220 +   19) do19=yes;;
   1.221 +   20) do20=yes;;
   1.222 +   21) do21=yes;;
   1.223 +   22) do22=yes;;
   1.224 +   23) do23=yes;;
   1.225 +   24) do24=yes;;
   1.226 +   25) do25=yes;;
   1.227 +   26) do26=yes;;
   1.228 +   -8) arg8=yes;;
   1.229 +  -16) arg16=yes;;
   1.230 +  -32) arg32=yes;;
   1.231 +   valgrind) valgrind="valgrind --tool=memcheck -q --smc-check=all";;
   1.232 +   valgrind-log) valgrind="valgrind --tool=memcheck --num-callers=30 --leak-check=no --error-limit=no --smc-check=all --log-file=report.%p ";;
   1.233 +   sim) shift; sim=$1;;
   1.234 +    *) echo "Unknown test number '$1'"; exit 1;;
   1.235    esac
   1.236    shift
   1.237  done
   1.238  
   1.239 -if [ $utf8 -eq 0 ] ; then
   1.240 +# Find which optional facilities are available.
   1.241 +
   1.242 +$sim ./pcretest -C linksize >/dev/null
   1.243 +link_size=$?
   1.244 +if [ $link_size -lt 2 ] ; then
   1.245 +  echo "Failed to find internal link size"
   1.246 +  exit 1
   1.247 +fi
   1.248 +if [ $link_size -gt 4 ] ; then
   1.249 +  echo "Failed to find internal link size"
   1.250 +  exit 1
   1.251 +fi
   1.252 +
   1.253 +# All of 8-bit, 16-bit, and 32-bit character strings may be supported, but only
   1.254 +# one need be.
   1.255 +
   1.256 +$sim ./pcretest -C pcre8 >/dev/null
   1.257 +support8=$?
   1.258 +$sim ./pcretest -C pcre16 >/dev/null
   1.259 +support16=$?
   1.260 +$sim ./pcretest -C pcre32 >/dev/null
   1.261 +support32=$?
   1.262 +
   1.263 +# Initialize all bitsizes skipped
   1.264 +
   1.265 +test8=skip
   1.266 +test16=skip
   1.267 +test32=skip
   1.268 +
   1.269 +# If no bitsize arguments, select all that are available
   1.270 +
   1.271 +if [ "$arg8$arg16$arg32" = "" ] ; then
   1.272 +  if [ $support8 -ne 0 ] ; then
   1.273 +    test8=
   1.274 +  fi
   1.275 +  if [ $support16 -ne 0 ] ; then
   1.276 +    test16=-16
   1.277 +  fi
   1.278 +  if [ $support32 -ne 0 ] ; then
   1.279 +    test32=-32
   1.280 +  fi
   1.281 +
   1.282 +# Select requested bit sizes
   1.283 +
   1.284 +else
   1.285 +  if [ "$arg8" = yes ] ; then
   1.286 +    if [ $support8 -eq 0 ] ; then
   1.287 +      echo "Cannot run 8-bit library tests: 8-bit library not compiled"
   1.288 +      exit 1
   1.289 +    fi
   1.290 +    test8=
   1.291 +  fi
   1.292 +  if [ "$arg16" = yes ] ; then
   1.293 +    if [ $support16 -eq 0 ] ; then
   1.294 +      echo "Cannot run 16-bit library tests: 16-bit library not compiled"
   1.295 +      exit 1
   1.296 +    fi
   1.297 +    test16=-16
   1.298 +  fi
   1.299 +  if [ "$arg32" = yes ] ; then
   1.300 +    if [ $support32 -eq 0 ] ; then
   1.301 +      echo "Cannot run 32-bit library tests: 32-bit library not compiled"
   1.302 +      exit 1
   1.303 +    fi
   1.304 +    test32=-32
   1.305 +  fi
   1.306 +fi
   1.307 +
   1.308 +# UTF support always applies to all bit sizes if both are supported; we can't
   1.309 +# have UTF-8 support without UTF-16 support (for example).
   1.310 +
   1.311 +$sim ./pcretest -C utf >/dev/null
   1.312 +utf=$?
   1.313 +
   1.314 +$sim ./pcretest -C ucp >/dev/null
   1.315 +ucp=$?
   1.316 +
   1.317 +jitopt=
   1.318 +$sim ./pcretest -C jit >/dev/null
   1.319 +jit=$?
   1.320 +if [ $jit -ne 0 ] ; then
   1.321 +  jitopt=-s+
   1.322 +fi
   1.323 +
   1.324 +if [ $utf -eq 0 ] ; then
   1.325    if [ $do4 = yes ] ; then
   1.326 -    echo "Can't run test 4 because UTF-8 support is not configured"
   1.327 +    echo "Can't run test 4 because UTF support is not configured"
   1.328      exit 1
   1.329    fi
   1.330    if [ $do5 = yes ] ; then
   1.331 -    echo "Can't run test 5 because UTF-8 support is not configured"
   1.332 +    echo "Can't run test 5 because UTF support is not configured"
   1.333 +    exit 1
   1.334 +  fi
   1.335 +  if [ $do9 = yes ] ; then
   1.336 +    echo "Can't run test 8 because UTF support is not configured"
   1.337      exit 1
   1.338    fi
   1.339 -  if [ $do8 = yes ] ; then
   1.340 -    echo "Can't run test 8 because UTF-8 support is not configured"
   1.341 +  if [ $do15 = yes ] ; then
   1.342 +    echo "Can't run test 15 because UTF support is not configured"
   1.343      exit 1
   1.344    fi
   1.345 +  if [ $do18 = yes ] ; then
   1.346 +    echo "Can't run test 18 because UTF support is not configured"
   1.347 +  fi
   1.348 +  if [ $do22 = yes ] ; then
   1.349 +    echo "Can't run test 22 because UTF support is not configured"
   1.350 +  fi
   1.351  fi
   1.352  
   1.353  if [ $ucp -eq 0 ] ; then
   1.354 @@ -83,82 +343,144 @@
   1.355      echo "Can't run test 6 because Unicode property support is not configured"
   1.356      exit 1
   1.357    fi
   1.358 -  if [ $do9 = yes ] ; then
   1.359 -    echo "Can't run test 9 because Unicode property support is not configured"
   1.360 +  if [ $do7 = yes ] ; then
   1.361 +    echo "Can't run test 7 because Unicode property support is not configured"
   1.362      exit 1
   1.363    fi
   1.364    if [ $do10 = yes ] ; then
   1.365      echo "Can't run test 10 because Unicode property support is not configured"
   1.366      exit 1
   1.367    fi
   1.368 +  if [ $do16 = yes ] ; then
   1.369 +    echo "Can't run test 16 because Unicode property support is not configured"
   1.370 +    exit 1
   1.371 +  fi
   1.372 +  if [ $do19 = yes ] ; then
   1.373 +    echo "Can't run test 19 because Unicode property support is not configured"
   1.374 +    exit 1
   1.375 +  fi
   1.376  fi
   1.377  
   1.378  if [ $link_size -ne 2 ] ; then
   1.379 -  if [ $do10 = yes ] ; then
   1.380 -    echo "Can't run test 10 because the link size ($link_size) is not 2"
   1.381 +  if [ $do11 = yes ] ; then
   1.382 +    echo "Can't run test 11 because the link size ($link_size) is not 2"
   1.383 +    exit 1
   1.384 +  fi
   1.385 +fi
   1.386 +
   1.387 +if [ $jit -eq 0 ] ; then
   1.388 +  if [ $do12 = "yes" ] ; then
   1.389 +    echo "Can't run test 12 because JIT support is not configured"
   1.390 +    exit 1
   1.391 +  fi
   1.392 +else
   1.393 +  if [ $do13 = "yes" ] ; then
   1.394 +    echo "Can't run test 13 because JIT support is configured"
   1.395      exit 1
   1.396    fi
   1.397  fi
   1.398  
   1.399 -# If no specific tests were requested, select all that are relevant.
   1.400 +# If no specific tests were requested, select all. Those that are not
   1.401 +# relevant will be skipped.
   1.402  
   1.403 -if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \
   1.404 -     $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
   1.405 -     $do9 = no -a $do10 = no ] ; then
   1.406 +if [ $do1  = no -a $do2  = no -a $do3  = no -a $do4  = no -a \
   1.407 +     $do5  = no -a $do6  = no -a $do7  = no -a $do8  = no -a \
   1.408 +     $do9  = no -a $do10 = no -a $do11 = no -a $do12 = no -a \
   1.409 +     $do13 = no -a $do14 = no -a $do15 = no -a $do16 = no -a \
   1.410 +     $do17 = no -a $do18 = no -a $do19 = no -a $do20 = no -a \
   1.411 +     $do21 = no -a $do22 = no -a $do23 = no -a $do24 = no -a \
   1.412 +     $do25 = no -a $do26 = no ] ; then
   1.413    do1=yes
   1.414    do2=yes
   1.415    do3=yes
   1.416 -  if [ $utf8 -ne 0 ] ; then do4=yes; fi
   1.417 -  if [ $utf8 -ne 0 ] ; then do5=yes; fi
   1.418 -  if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do6=yes; fi
   1.419 +  do4=yes
   1.420 +  do5=yes
   1.421 +  do6=yes
   1.422    do7=yes
   1.423 -  if [ $utf8 -ne 0 ] ; then do8=yes; fi
   1.424 -  if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi
   1.425 -  if [ $link_size -eq 2 -a $ucp -ne 0 ] ; then do10=yes; fi
   1.426 +  do8=yes
   1.427 +  do9=yes
   1.428 +  do10=yes
   1.429 +  do11=yes
   1.430 +  do12=yes
   1.431 +  do13=yes
   1.432 +  do14=yes
   1.433 +  do15=yes
   1.434 +  do16=yes
   1.435 +  do17=yes
   1.436 +  do18=yes
   1.437 +  do19=yes
   1.438 +  do20=yes
   1.439 +  do21=yes
   1.440 +  do22=yes
   1.441 +  do23=yes
   1.442 +  do24=yes
   1.443 +  do25=yes
   1.444 +  do26=yes
   1.445  fi
   1.446  
   1.447 -# Show which release
   1.448 +# Show which release and which test data
   1.449  
   1.450  echo ""
   1.451 -echo PCRE C library tests
   1.452 -./pcretest /dev/null
   1.453 +echo PCRE C library tests using test data from $testdata
   1.454 +$sim ./pcretest /dev/null
   1.455  
   1.456 -# Primary test, Perl-compatible
   1.457 +for bmode in "$test8" "$test16" "$test32"; do
   1.458 +  case "$bmode" in
   1.459 +    skip) continue;;
   1.460 +    -16)  if [ "$test8$test32" != "skipskip" ] ; then echo ""; fi
   1.461 +          bits=16; echo "---- Testing 16-bit library ----"; echo "";;
   1.462 +    -32)  if [ "$test8$test16" != "skipskip" ] ; then echo ""; fi
   1.463 +          bits=32; echo "---- Testing 32-bit library ----"; echo "";;
   1.464 +    *)    bits=8; echo "---- Testing 8-bit library ----"; echo "";;
   1.465 +  esac
   1.466 +
   1.467 +# Primary test, compatible with JIT and all versions of Perl >= 5.8
   1.468  
   1.469  if [ $do1 = yes ] ; then
   1.470 -  echo "Test 1: main functionality (Perl compatible)"
   1.471 -  $valgrind ./pcretest -q $testdata/testinput1 testtry
   1.472 -  if [ $? = 0 ] ; then
   1.473 -    $cf $testdata/testoutput1 testtry
   1.474 -    if [ $? != 0 ] ; then exit 1; fi
   1.475 -  else exit 1
   1.476 -  fi
   1.477 -  echo "OK"
   1.478 +  echo $title1
   1.479 +  for opt in "" "-s" $jitopt; do
   1.480 +    $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput1 testtry
   1.481 +    if [ $? = 0 ] ; then
   1.482 +      $cf $testdata/testoutput1 testtry
   1.483 +      if [ $? != 0 ] ; then exit 1; fi
   1.484 +    else exit 1
   1.485 +    fi
   1.486 +    if [ "$opt" = "-s" ] ; then echo "  OK with study"
   1.487 +    elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
   1.488 +    else echo "  OK"
   1.489 +    fi
   1.490 +  done
   1.491  fi
   1.492  
   1.493 -# PCRE tests that are not Perl-compatible - API & error tests, mostly
   1.494 +# PCRE tests that are not JIT or Perl-compatible: API, errors, internals
   1.495  
   1.496  if [ $do2 = yes ] ; then
   1.497 -  echo "Test 2: API and error handling (not Perl compatible)"
   1.498 -  $valgrind ./pcretest -q $testdata/testinput2 testtry
   1.499 -  if [ $? = 0 ] ; then
   1.500 -    $cf $testdata/testoutput2 testtry
   1.501 -    if [ $? != 0 ] ; then exit 1; fi
   1.502 -  else
   1.503 -    echo " "
   1.504 -    echo "** Test 2 requires a lot of stack. If it has crashed with a"
   1.505 -    echo "** segmentation fault, it may be that you do not have enough"
   1.506 -    echo "** stack available by default. Please see the 'pcrestack' man"
   1.507 -    echo "** page for a discussion of PCRE's stack usage."
   1.508 -    echo " "
   1.509 -    exit 1
   1.510 -  fi
   1.511 -  echo "OK"
   1.512 +  echo $title2 "(not UTF-$bits)"
   1.513 +  for opt in "" "-s" $jitopt; do
   1.514 +    $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput2 testtry
   1.515 +    if [ $? = 0 ] ; then
   1.516 +      $cf $testdata/testoutput2 testtry
   1.517 +      if [ $? != 0 ] ; then exit 1; fi
   1.518 +    else
   1.519 +      echo " "
   1.520 +      echo "** Test 2 requires a lot of stack. If it has crashed with a"
   1.521 +      echo "** segmentation fault, it may be that you do not have enough"
   1.522 +      echo "** stack available by default. Please see the 'pcrestack' man"
   1.523 +      echo "** page for a discussion of PCRE's stack usage."
   1.524 +      echo " "
   1.525 +      exit 1
   1.526 +    fi
   1.527 +    if [ "$opt" = "-s" ] ; then echo "  OK with study"
   1.528 +    elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
   1.529 +    else echo "  OK"
   1.530 +    fi
   1.531 +  done
   1.532  fi
   1.533  
   1.534  # Locale-specific tests, provided that either the "fr_FR" or the "french"
   1.535  # locale is available. The former is the Unix-like standard; the latter is
   1.536 -# for Windows.
   1.537 +# for Windows. Another possibility is "fr", which needs to be run against
   1.538 +# the Windows-specific input and output files.
   1.539  
   1.540  if [ $do3 = yes ] ; then
   1.541    locale -a | grep '^fr_FR$' >/dev/null
   1.542 @@ -167,126 +489,527 @@
   1.543      infile=$testdata/testinput3
   1.544      outfile=$testdata/testoutput3
   1.545    else
   1.546 +    infile=test3input
   1.547 +    outfile=test3output
   1.548      locale -a | grep '^french$' >/dev/null
   1.549      if [ $? -eq 0 ] ; then
   1.550        locale=french
   1.551        sed 's/fr_FR/french/' $testdata/testinput3 >test3input
   1.552        sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
   1.553 -      infile=test3input
   1.554 -      outfile=test3output
   1.555      else
   1.556 -      locale=
   1.557 +      locale -a | grep '^fr$' >/dev/null
   1.558 +      if [ $? -eq 0 ] ; then
   1.559 +        locale=fr
   1.560 +        sed 's/fr_FR/fr/' $testdata/wintestinput3 >test3input
   1.561 +        sed 's/fr_FR/fr/' $testdata/wintestoutput3 >test3output
   1.562 +      else
   1.563 +        locale=
   1.564 +      fi
   1.565      fi
   1.566    fi
   1.567  
   1.568    if [ "$locale" != "" ] ; then
   1.569 -    echo "Test 3: locale-specific features (using '$locale' locale)"
   1.570 -    $valgrind ./pcretest -q $infile testtry
   1.571 -    if [ $? = 0 ] ; then
   1.572 -      $cf $outfile testtry
   1.573 -      if [ $? != 0 ] ; then
   1.574 -        echo " "
   1.575 -        echo "Locale test did not run entirely successfully."
   1.576 -        echo "This usually means that there is a problem with the locale"
   1.577 -        echo "settings rather than a bug in PCRE."
   1.578 -      else
   1.579 -      echo "OK"
   1.580 +    echo $title3 "(using '$locale' locale)"
   1.581 +    for opt in "" "-s" $jitopt; do
   1.582 +      $sim $valgrind ./pcretest -q $bmode $opt $infile testtry
   1.583 +      if [ $? = 0 ] ; then
   1.584 +        $cf $outfile testtry
   1.585 +        if [ $? != 0 ] ; then
   1.586 +          echo " "
   1.587 +          echo "Locale test did not run entirely successfully."
   1.588 +          echo "This usually means that there is a problem with the locale"
   1.589 +          echo "settings rather than a bug in PCRE."
   1.590 +          break;
   1.591 +        else
   1.592 +          if [ "$opt" = "-s" ] ; then echo "  OK with study"
   1.593 +          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
   1.594 +          else echo "  OK"
   1.595 +          fi
   1.596 +        fi
   1.597 +      else exit 1
   1.598        fi
   1.599 -    else exit 1
   1.600 -    fi
   1.601 +    done
   1.602    else
   1.603 -    echo "Cannot test locale-specific features - neither the 'fr_FR' nor the"
   1.604 -    echo "'french' locale exists, or the \"locale\" command is not available"
   1.605 +    echo "Cannot test locale-specific features - none of the 'fr_FR', 'fr' or"
   1.606 +    echo "'french' locales exist, or the \"locale\" command is not available"
   1.607      echo "to check for them."
   1.608      echo " "
   1.609    fi
   1.610  fi
   1.611  
   1.612 -# Additional tests for UTF8 support
   1.613 +# Additional tests for UTF support
   1.614  
   1.615  if [ $do4 = yes ] ; then
   1.616 -  echo "Test 4: UTF-8 support (Perl compatible)"
   1.617 -  $valgrind ./pcretest -q $testdata/testinput4 testtry
   1.618 -  if [ $? = 0 ] ; then
   1.619 -    $cf $testdata/testoutput4 testtry
   1.620 -    if [ $? != 0 ] ; then exit 1; fi
   1.621 -  else exit 1
   1.622 +  echo ${title4A}-${bits}${title4B}
   1.623 +  if [ $utf -eq 0 ] ; then
   1.624 +    echo "  Skipped because UTF-$bits support is not available"
   1.625 +  else
   1.626 +    for opt in "" "-s" $jitopt; do
   1.627 +      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput4 testtry
   1.628 +      if [ $? = 0 ] ; then
   1.629 +        $cf $testdata/testoutput4 testtry
   1.630 +        if [ $? != 0 ] ; then exit 1; fi
   1.631 +      else exit 1
   1.632 +      fi
   1.633 +      if [ "$opt" = "-s" ] ; then echo "  OK with study"
   1.634 +      elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
   1.635 +      else echo "  OK"
   1.636 +      fi
   1.637 +    done
   1.638    fi
   1.639 -  echo "OK"
   1.640  fi
   1.641  
   1.642  if [ $do5 = yes ] ; then
   1.643 -  echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"
   1.644 -  $valgrind ./pcretest -q $testdata/testinput5 testtry
   1.645 -  if [ $? = 0 ] ; then
   1.646 -    $cf $testdata/testoutput5 testtry
   1.647 -    if [ $? != 0 ] ; then exit 1; fi
   1.648 -  else exit 1
   1.649 +  echo ${title5}-${bits} support
   1.650 +  if [ $utf -eq 0 ] ; then
   1.651 +    echo "  Skipped because UTF-$bits support is not available"
   1.652 +  else
   1.653 +    for opt in "" "-s" $jitopt; do
   1.654 +      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput5 testtry
   1.655 +      if [ $? = 0 ] ; then
   1.656 +        $cf $testdata/testoutput5 testtry
   1.657 +        if [ $? != 0 ] ; then exit 1; fi
   1.658 +      else exit 1
   1.659 +      fi
   1.660 +      if [ "$opt" = "-s" ] ; then echo "  OK with study"
   1.661 +      elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
   1.662 +      else echo "  OK"
   1.663 +      fi
   1.664 +    done
   1.665    fi
   1.666 -  echo "OK"
   1.667  fi
   1.668  
   1.669  if [ $do6 = yes ] ; then
   1.670 -  echo "Test 6: Unicode property support"
   1.671 -  $valgrind ./pcretest -q $testdata/testinput6 testtry
   1.672 -  if [ $? = 0 ] ; then
   1.673 -    $cf $testdata/testoutput6 testtry
   1.674 -    if [ $? != 0 ] ; then exit 1; fi
   1.675 -  else exit 1
   1.676 +  echo $title6
   1.677 +  if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
   1.678 +    echo "  Skipped because Unicode property support is not available"
   1.679 +  else
   1.680 +    for opt in "" "-s" $jitopt; do
   1.681 +      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput6 testtry
   1.682 +      if [ $? = 0 ] ; then
   1.683 +        $cf $testdata/testoutput6 testtry
   1.684 +        if [ $? != 0 ] ; then exit 1; fi
   1.685 +      else exit 1
   1.686 +      fi
   1.687 +      if [ "$opt" = "-s" ] ; then echo "  OK with study"
   1.688 +      elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
   1.689 +      else echo "  OK"
   1.690 +      fi
   1.691 +    done
   1.692    fi
   1.693 -  echo "OK"
   1.694 +fi
   1.695 +
   1.696 +# Test non-Perl-compatible Unicode property support
   1.697 +
   1.698 +if [ $do7 = yes ] ; then
   1.699 +  echo $title7
   1.700 +  if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
   1.701 +    echo "  Skipped because Unicode property support is not available"
   1.702 +  else
   1.703 +    for opt in "" "-s" $jitopt; do
   1.704 +      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput7 testtry
   1.705 +      if [ $? = 0 ] ; then
   1.706 +        $cf $testdata/testoutput7 testtry
   1.707 +        if [ $? != 0 ] ; then exit 1; fi
   1.708 +      else exit 1
   1.709 +      fi
   1.710 +      if [ "$opt" = "-s" ] ; then echo "  OK with study"
   1.711 +      elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
   1.712 +      else echo "  OK"
   1.713 +      fi
   1.714 +    done
   1.715 +  fi
   1.716  fi
   1.717  
   1.718  # Tests for DFA matching support
   1.719  
   1.720 -if [ $do7 = yes ] ; then
   1.721 -  echo "Test 7: DFA matching"
   1.722 -  $valgrind ./pcretest -q -dfa $testdata/testinput7 testtry
   1.723 -  if [ $? = 0 ] ; then
   1.724 -    $cf $testdata/testoutput7 testtry
   1.725 -    if [ $? != 0 ] ; then exit 1; fi
   1.726 -  else exit 1
   1.727 -  fi
   1.728 -  echo "OK"
   1.729 -fi
   1.730 -
   1.731  if [ $do8 = yes ] ; then
   1.732 -  echo "Test 8: DFA matching with UTF-8"
   1.733 -  $valgrind ./pcretest -q -dfa $testdata/testinput8 testtry
   1.734 -  if [ $? = 0 ] ; then
   1.735 -    $cf $testdata/testoutput8 testtry
   1.736 -    if [ $? != 0 ] ; then exit 1; fi
   1.737 -  else exit 1
   1.738 -  fi
   1.739 -  echo "OK"
   1.740 +  echo $title8
   1.741 +  for opt in "" "-s"; do
   1.742 +    $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput8 testtry
   1.743 +    if [ $? = 0 ] ; then
   1.744 +      $cf $testdata/testoutput8 testtry
   1.745 +      if [ $? != 0 ] ; then exit 1; fi
   1.746 +    else exit 1
   1.747 +    fi
   1.748 +    if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
   1.749 +  done
   1.750  fi
   1.751  
   1.752  if [ $do9 = yes ] ; then
   1.753 -  echo "Test 9: DFA matching with Unicode properties"
   1.754 -  $valgrind ./pcretest -q -dfa $testdata/testinput9 testtry
   1.755 -  if [ $? = 0 ] ; then
   1.756 -    $cf $testdata/testoutput9 testtry
   1.757 -    if [ $? != 0 ] ; then exit 1; fi
   1.758 -  else exit 1
   1.759 +  echo ${title9}-${bits}
   1.760 +  if [ $utf -eq 0 ] ; then
   1.761 +    echo "  Skipped because UTF-$bits support is not available"
   1.762 +  else
   1.763 +    for opt in "" "-s"; do
   1.764 +      $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput9 testtry
   1.765 +      if [ $? = 0 ] ; then
   1.766 +        $cf $testdata/testoutput9 testtry
   1.767 +        if [ $? != 0 ] ; then exit 1; fi
   1.768 +      else exit 1
   1.769 +      fi
   1.770 +      if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
   1.771 +    done
   1.772    fi
   1.773 -  echo "OK"
   1.774 +fi
   1.775 +
   1.776 +if [ $do10 = yes ] ; then
   1.777 +  echo $title10
   1.778 +  if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
   1.779 +    echo "  Skipped because Unicode property support is not available"
   1.780 +  else
   1.781 +    for opt in "" "-s"; do
   1.782 +      $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput10 testtry
   1.783 +      if [ $? = 0 ] ; then
   1.784 +        $cf $testdata/testoutput10 testtry
   1.785 +        if [ $? != 0 ] ; then exit 1; fi
   1.786 +      else exit 1
   1.787 +      fi
   1.788 +      if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
   1.789 +    done
   1.790 +  fi
   1.791  fi
   1.792  
   1.793  # Test of internal offsets and code sizes. This test is run only when there
   1.794  # is Unicode property support and the link size is 2. The actual tests are
   1.795  # mostly the same as in some of the above, but in this test we inspect some
   1.796  # offsets and sizes that require a known link size. This is a doublecheck for
   1.797 -# the maintainer, just in case something changes unexpectely.
   1.798 +# the maintainer, just in case something changes unexpectely. The output from
   1.799 +# this test is not the same in 8-bit and 16-bit modes.
   1.800 +
   1.801 +if [ $do11 = yes ] ; then
   1.802 +  echo $title11
   1.803 +  if [ $link_size -ne 2 ] ; then
   1.804 +    echo "  Skipped because link size is not 2"
   1.805 +  elif [ $ucp -eq 0 ] ; then
   1.806 +    echo "  Skipped because Unicode property support is not available"
   1.807 +  else
   1.808 +    for opt in "" "-s"; do
   1.809 +      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput11 testtry
   1.810 +      if [ $? = 0 ] ; then
   1.811 +        $cf $testdata/testoutput11-$bits testtry
   1.812 +        if [ $? != 0 ] ; then exit 1; fi
   1.813 +      else exit 1
   1.814 +      fi
   1.815 +      if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
   1.816 +    done
   1.817 +  fi
   1.818 +fi
   1.819 +
   1.820 +# Test JIT-specific features when JIT is available
   1.821 +
   1.822 +if [ $do12 = yes ] ; then
   1.823 +  echo $title12
   1.824 +  if [ $jit -eq 0 ] ; then
   1.825 +    echo "  Skipped because JIT is not available or not usable"
   1.826 +  else
   1.827 +    $sim $valgrind ./pcretest -q $bmode $testdata/testinput12 testtry
   1.828 +    if [ $? = 0 ] ; then
   1.829 +      $cf $testdata/testoutput12 testtry
   1.830 +      if [ $? != 0 ] ; then exit 1; fi
   1.831 +    else exit 1
   1.832 +    fi
   1.833 +    echo "  OK"
   1.834 +  fi
   1.835 +fi
   1.836 +
   1.837 +# Test JIT-specific features when JIT is not available
   1.838 +
   1.839 +if [ $do13 = yes ] ; then
   1.840 +  echo $title13
   1.841 +  if [ $jit -ne 0 ] ; then
   1.842 +    echo "  Skipped because JIT is available"
   1.843 +  else
   1.844 +    $sim $valgrind ./pcretest -q $bmode $testdata/testinput13 testtry
   1.845 +    if [ $? = 0 ] ; then
   1.846 +      $cf $testdata/testoutput13 testtry
   1.847 +      if [ $? != 0 ] ; then exit 1; fi
   1.848 +    else exit 1
   1.849 +    fi
   1.850 +    echo "  OK"
   1.851 +  fi
   1.852 +fi
   1.853 +
   1.854 +# Tests for 8-bit-specific features
   1.855  
   1.856 -if [ $do10 = yes ] ; then
   1.857 -  echo "Test 10: Internal offsets and code size tests"
   1.858 -  $valgrind ./pcretest -q $testdata/testinput10 testtry
   1.859 -  if [ $? = 0 ] ; then
   1.860 -    $cf $testdata/testoutput10 testtry
   1.861 -    if [ $? != 0 ] ; then exit 1; fi
   1.862 -  else exit 1
   1.863 +if [ "$do14" = yes ] ; then
   1.864 +  echo $title14
   1.865 +  if [ "$bits" = "16" -o "$bits" = "32" ] ; then
   1.866 +    echo "  Skipped when running 16/32-bit tests"
   1.867 +  else
   1.868 +    cp -f $testdata/saved16 testsaved16
   1.869 +    cp -f $testdata/saved32 testsaved32
   1.870 +    for opt in "" "-s" $jitopt; do
   1.871 +      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput14 testtry
   1.872 +      if [ $? = 0 ] ; then
   1.873 +        $cf $testdata/testoutput14 testtry
   1.874 +        if [ $? != 0 ] ; then exit 1; fi
   1.875 +      else exit 1
   1.876 +      fi
   1.877 +      if [ "$opt" = "-s" ] ; then echo "  OK with study"
   1.878 +      elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
   1.879 +      else echo "  OK"
   1.880 +      fi
   1.881 +    done
   1.882 +  fi
   1.883 +fi
   1.884 +
   1.885 +# Tests for 8-bit-specific features (needs UTF-8 support)
   1.886 +
   1.887 +if [ "$do15" = yes ] ; then
   1.888 +  echo $title15
   1.889 +  if [ "$bits" = "16" -o "$bits" = "32" ] ; then
   1.890 +    echo "  Skipped when running 16/32-bit tests"
   1.891 +  elif [ $utf -eq 0 ] ; then
   1.892 +    echo "  Skipped because UTF-$bits support is not available"
   1.893 +  else
   1.894 +    for opt in "" "-s" $jitopt; do
   1.895 +      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput15 testtry
   1.896 +      if [ $? = 0 ] ; then
   1.897 +        $cf $testdata/testoutput15 testtry
   1.898 +        if [ $? != 0 ] ; then exit 1; fi
   1.899 +      else exit 1
   1.900 +      fi
   1.901 +      if [ "$opt" = "-s" ] ; then echo "  OK with study"
   1.902 +      elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
   1.903 +      else echo "  OK"
   1.904 +      fi
   1.905 +    done
   1.906    fi
   1.907 -  echo "OK"
   1.908 +fi
   1.909 +
   1.910 +# Tests for 8-bit-specific features (Unicode property support)
   1.911 +
   1.912 +if [ $do16 = yes ] ; then
   1.913 +  echo $title16
   1.914 +  if [ "$bits" = "16" -o "$bits" = "32" ] ; then
   1.915 +    echo "  Skipped when running 16/32-bit tests"
   1.916 +  elif [ $ucp -eq 0 ] ; then
   1.917 +    echo "  Skipped because Unicode property support is not available"
   1.918 +  else
   1.919 +    for opt in "" "-s" $jitopt; do
   1.920 +      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput16 testtry
   1.921 +      if [ $? = 0 ] ; then
   1.922 +        $cf $testdata/testoutput16 testtry
   1.923 +        if [ $? != 0 ] ; then exit 1; fi
   1.924 +      else exit 1
   1.925 +      fi
   1.926 +      if [ "$opt" = "-s" ] ; then echo "  OK with study"
   1.927 +      elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
   1.928 +      else echo "  OK"
   1.929 +      fi
   1.930 +    done
   1.931 +  fi
   1.932 +fi
   1.933 +
   1.934 +# Tests for 16/32-bit-specific features
   1.935 +
   1.936 +if [ $do17 = yes ] ; then
   1.937 +  echo $title17
   1.938 +  if [ "$bits" = "8" ] ; then
   1.939 +    echo "  Skipped when running 8-bit tests"
   1.940 +  else
   1.941 +    for opt in "" "-s" $jitopt; do
   1.942 +      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput17 testtry
   1.943 +      if [ $? = 0 ] ; then
   1.944 +        $cf $testdata/testoutput17 testtry
   1.945 +        if [ $? != 0 ] ; then exit 1; fi
   1.946 +      else exit 1
   1.947 +      fi
   1.948 +      if [ "$opt" = "-s" ] ; then echo "  OK with study"
   1.949 +      elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
   1.950 +      else echo "  OK"
   1.951 +      fi
   1.952 +    done
   1.953 +  fi
   1.954  fi
   1.955  
   1.956 +# Tests for 16/32-bit-specific features (UTF-16/32 support)
   1.957 +
   1.958 +if [ $do18 = yes ] ; then
   1.959 +  echo $title18
   1.960 +  if [ "$bits" = "8" ] ; then
   1.961 +    echo "  Skipped when running 8-bit tests"
   1.962 +  elif [ $utf -eq 0 ] ; then
   1.963 +    echo "  Skipped because UTF-$bits support is not available"
   1.964 +  else
   1.965 +    for opt in "" "-s" $jitopt; do
   1.966 +      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput18 testtry
   1.967 +      if [ $? = 0 ] ; then
   1.968 +        $cf $testdata/testoutput18-$bits testtry
   1.969 +        if [ $? != 0 ] ; then exit 1; fi
   1.970 +      else exit 1
   1.971 +      fi
   1.972 +      if [ "$opt" = "-s" ] ; then echo "  OK with study"
   1.973 +      elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
   1.974 +      else echo "  OK"
   1.975 +      fi
   1.976 +    done
   1.977 +  fi
   1.978 +fi
   1.979 +
   1.980 +# Tests for 16/32-bit-specific features (Unicode property support)
   1.981 +
   1.982 +if [ $do19 = yes ] ; then
   1.983 +  echo $title19
   1.984 +  if [ "$bits" = "8" ] ; then
   1.985 +    echo "  Skipped when running 8-bit tests"
   1.986 +  elif [ $ucp -eq 0 ] ; then
   1.987 +    echo "  Skipped because Unicode property support is not available"
   1.988 +  else
   1.989 +    for opt in "" "-s" $jitopt; do
   1.990 +      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput19 testtry
   1.991 +      if [ $? = 0 ] ; then
   1.992 +        $cf $testdata/testoutput19 testtry
   1.993 +        if [ $? != 0 ] ; then exit 1; fi
   1.994 +      else exit 1
   1.995 +      fi
   1.996 +      if [ "$opt" = "-s" ] ; then echo "  OK with study"
   1.997 +      elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
   1.998 +      else echo "  OK"
   1.999 +      fi
  1.1000 +    done
  1.1001 +  fi
  1.1002 +fi
  1.1003 +
  1.1004 +# Tests for 16/32-bit-specific features in DFA non-UTF-16/32 mode
  1.1005 +
  1.1006 +if [ $do20 = yes ] ; then
  1.1007 +  echo $title20
  1.1008 +  if [ "$bits" = "8" ] ; then
  1.1009 +    echo "  Skipped when running 8-bit tests"
  1.1010 +  else
  1.1011 +    for opt in "" "-s"; do
  1.1012 +      $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput20 testtry
  1.1013 +      if [ $? = 0 ] ; then
  1.1014 +        $cf $testdata/testoutput20 testtry
  1.1015 +        if [ $? != 0 ] ; then exit 1; fi
  1.1016 +      else exit 1
  1.1017 +      fi
  1.1018 +      if [ "$opt" = "-s" ] ; then echo "  OK with study"
  1.1019 +      else echo "  OK"
  1.1020 +      fi
  1.1021 +    done
  1.1022 +  fi
  1.1023 +fi
  1.1024 +
  1.1025 +# Tests for reloads with 16/32-bit library
  1.1026 +
  1.1027 +if [ $do21 = yes ] ; then
  1.1028 +  echo $title21
  1.1029 +  if [ "$bits" = "8" ] ; then
  1.1030 +    echo "  Skipped when running 8-bit tests"
  1.1031 +  elif [ $link_size -ne 2 ] ; then
  1.1032 +    echo "  Skipped because link size is not 2"
  1.1033 +  else
  1.1034 +    cp -f $testdata/saved8 testsaved8
  1.1035 +    cp -f $testdata/saved16LE-1 testsaved16LE-1
  1.1036 +    cp -f $testdata/saved16BE-1 testsaved16BE-1
  1.1037 +    cp -f $testdata/saved32LE-1 testsaved32LE-1
  1.1038 +    cp -f $testdata/saved32BE-1 testsaved32BE-1
  1.1039 +    $sim $valgrind ./pcretest -q $bmode $testdata/testinput21 testtry
  1.1040 +    if [ $? = 0 ] ; then
  1.1041 +      $cf $testdata/testoutput21-$bits testtry
  1.1042 +      if [ $? != 0 ] ; then exit 1; fi
  1.1043 +    else exit 1
  1.1044 +    fi
  1.1045 +    echo "  OK"
  1.1046 +  fi
  1.1047 +fi
  1.1048 +
  1.1049 +# Tests for reloads with 16/32-bit library (UTF-16 support)
  1.1050 +
  1.1051 +if [ $do22 = yes ] ; then
  1.1052 +  echo $title22
  1.1053 +  if [ "$bits" = "8" ] ; then
  1.1054 +    echo "  Skipped when running 8-bit tests"
  1.1055 +  elif [ $utf -eq 0 ] ; then
  1.1056 +    echo "  Skipped because UTF-$bits support is not available"
  1.1057 +  elif [ $link_size -ne 2 ] ; then
  1.1058 +    echo "  Skipped because link size is not 2"
  1.1059 +  else
  1.1060 +    cp -f $testdata/saved16LE-2 testsaved16LE-2
  1.1061 +    cp -f $testdata/saved16BE-2 testsaved16BE-2
  1.1062 +    cp -f $testdata/saved32LE-2 testsaved32LE-2
  1.1063 +    cp -f $testdata/saved32BE-2 testsaved32BE-2
  1.1064 +    $sim $valgrind ./pcretest -q $bmode $testdata/testinput22 testtry
  1.1065 +    if [ $? = 0 ] ; then
  1.1066 +      $cf $testdata/testoutput22-$bits testtry
  1.1067 +      if [ $? != 0 ] ; then exit 1; fi
  1.1068 +    else exit 1
  1.1069 +    fi
  1.1070 +    echo "  OK"
  1.1071 +  fi
  1.1072 +fi
  1.1073 +
  1.1074 +if [ $do23 = yes ] ; then
  1.1075 +  echo $title23
  1.1076 +  if [ "$bits" = "8" -o "$bits" = "32" ] ; then
  1.1077 +    echo "  Skipped when running 8/32-bit tests"
  1.1078 +  else
  1.1079 +    $sim $valgrind ./pcretest -q $bmode $testdata/testinput23 testtry
  1.1080 +    if [ $? = 0 ] ; then
  1.1081 +      $cf $testdata/testoutput23 testtry
  1.1082 +      if [ $? != 0 ] ; then exit 1; fi
  1.1083 +    else exit 1
  1.1084 +    fi
  1.1085 +    echo "  OK"
  1.1086 +  fi
  1.1087 +fi
  1.1088 +
  1.1089 +if [ $do24 = yes ] ; then
  1.1090 +  echo $title24
  1.1091 +  if [ "$bits" = "8" -o "$bits" = "32" ] ; then
  1.1092 +    echo "  Skipped when running 8/32-bit tests"
  1.1093 +  elif [ $utf -eq 0 ] ; then
  1.1094 +    echo "  Skipped because UTF-$bits support is not available"
  1.1095 +  else
  1.1096 +    $sim $valgrind ./pcretest -q $bmode $testdata/testinput24 testtry
  1.1097 +    if [ $? = 0 ] ; then
  1.1098 +      $cf $testdata/testoutput24 testtry
  1.1099 +      if [ $? != 0 ] ; then exit 1; fi
  1.1100 +    else exit 1
  1.1101 +    fi
  1.1102 +    echo "  OK"
  1.1103 +  fi
  1.1104 +fi
  1.1105 +
  1.1106 +if [ $do25 = yes ] ; then
  1.1107 +  echo $title25
  1.1108 +  if [ "$bits" = "8" -o "$bits" = "16" ] ; then
  1.1109 +    echo "  Skipped when running 8/16-bit tests"
  1.1110 +  else
  1.1111 +    $sim $valgrind ./pcretest -q $bmode $testdata/testinput25 testtry
  1.1112 +    if [ $? = 0 ] ; then
  1.1113 +      $cf $testdata/testoutput25 testtry
  1.1114 +      if [ $? != 0 ] ; then exit 1; fi
  1.1115 +    else exit 1
  1.1116 +    fi
  1.1117 +    echo "  OK"
  1.1118 +  fi
  1.1119 +fi
  1.1120 +
  1.1121 +if [ $do26 = yes ] ; then
  1.1122 +  echo $title26
  1.1123 +  if [ "$bits" = "8" -o "$bits" = "16" ] ; then
  1.1124 +    echo "  Skipped when running 8/16-bit tests"
  1.1125 +  elif [ $utf -eq 0 ] ; then
  1.1126 +    echo "  Skipped because UTF-$bits support is not available"
  1.1127 +  else
  1.1128 +    $sim $valgrind ./pcretest -q $bmode $testdata/testinput26 testtry
  1.1129 +    if [ $? = 0 ] ; then
  1.1130 +      $cf $testdata/testoutput26 testtry
  1.1131 +      if [ $? != 0 ] ; then exit 1; fi
  1.1132 +    else exit 1
  1.1133 +    fi
  1.1134 +    echo "  OK"
  1.1135 +  fi
  1.1136 +fi
  1.1137 +
  1.1138 +# End of loop for 8/16/32-bit tests
  1.1139 +done
  1.1140 +
  1.1141 +# Clean up local working files
  1.1142 +rm -f test3input test3output testNinput testsaved* teststderr teststdout testtry
  1.1143 +
  1.1144  # End