File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / pcre / RunTest
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:50:25 2012 UTC (12 years, 4 months ago) by misho
Branches: pcre, MAIN
CVS tags: v8_30, HEAD
pcre

    1: #! /bin/sh
    2: 
    3: # Run the PCRE tests using the pcretest program. The appropriate tests are
    4: # selected, depending on which build-time options were used.
    5: 
    6: # All tests are now run both with and without -s, to ensure that everything is
    7: # tested with and without studying. However, there are some tests that produce
    8: # different output after studying, typically when we are tracing the actual
    9: # matching process (for example, using auto-callouts). In these few cases, the
   10: # tests are duplicated in the files, one with /S to force studying always, and
   11: # one with /SS to force *not* studying always. The use of -s doesn't then make
   12: # any difference to their output. There is also one test which compiles invalid
   13: # UTF-8 with the UTF-8 check turned off; for this, studying must also be
   14: # disabled with /SS.
   15: 
   16: # When JIT support is available, all the tests are also run with -s+ to test
   17: # (again, almost) everything with studying and the JIT option. There are also
   18: # two tests for JIT-specific features, one to be run when JIT support is
   19: # available, and one when it is not.
   20: 
   21: # Whichever of the 8-bit and 16-bit libraries exist are tested. It is also
   22: # possible to select which to test by the arguments -8 or -16.
   23: 
   24: # Other arguments for this script can be individual test numbers, or the word
   25: # "valgrind", or "sim" followed by an argument to run cross-compiled
   26: # executables under a simulator, for example:
   27: #
   28: # RunTest 3 sim "qemu-arm -s 8388608"
   29: 
   30: valgrind=
   31: sim=
   32: arg8=
   33: arg16=
   34: 
   35: # This is in case the caller has set aliases (as I do - PH)
   36: unset cp ls mv rm
   37: 
   38: # Select which tests to run; for those that are explicitly requested, check
   39: # that the necessary optional facilities are available.
   40: 
   41: do1=no
   42: do2=no
   43: do3=no
   44: do4=no
   45: do5=no
   46: do6=no
   47: do7=no
   48: do8=no
   49: do9=no
   50: do10=no
   51: do11=no
   52: do12=no
   53: do13=no
   54: do14=no
   55: do15=no
   56: do16=no
   57: do17=no
   58: do18=no
   59: do19=no
   60: do20=no
   61: do21=no
   62: do22=no
   63: 
   64: while [ $# -gt 0 ] ; do
   65:   case $1 in
   66:     1) do1=yes;;
   67:     2) do2=yes;;
   68:     3) do3=yes;;
   69:     4) do4=yes;;
   70:     5) do5=yes;;
   71:     6) do6=yes;;
   72:     7) do7=yes;;
   73:     8) do8=yes;;
   74:     9) do9=yes;;
   75:    10) do10=yes;;
   76:    11) do11=yes;;
   77:    12) do12=yes;;
   78:    13) do13=yes;;
   79:    14) do14=yes;;
   80:    15) do15=yes;;
   81:    16) do16=yes;;
   82:    17) do17=yes;;
   83:    18) do18=yes;;
   84:    19) do19=yes;;
   85:    20) do20=yes;;
   86:    21) do21=yes;;
   87:    22) do22=yes;;
   88:    -8) arg8=yes;;
   89:   -16) arg16=yes;;
   90:    valgrind) valgrind="valgrind -q --smc-check=all";;
   91:    sim) shift; sim=$1;;
   92:     *) echo "Unknown test number $1"; exit 1;;
   93:   esac
   94:   shift
   95: done
   96: 
   97: # Set up a suitable "diff" command for comparison. Some systems
   98: # have a diff that lacks a -u option. Try to deal with this.
   99: 
  100: if diff -u /dev/null /dev/null; then cf="diff -u"; else cf="diff"; fi
  101: 
  102: # Find the test data
  103: 
  104: if [ -n "$srcdir" -a -d "$srcdir" ] ; then
  105:   testdata="$srcdir/testdata"
  106: elif [ -d "./testdata" ] ; then
  107:   testdata=./testdata
  108: elif [ -d "../testdata" ] ; then
  109:   testdata=../testdata
  110: else
  111:   echo "Cannot find the testdata directory"
  112:   exit 1
  113: fi
  114: 
  115: # Find which optional facilities are available. In some Windows environments
  116: # the output of pcretest -C has CRLF at the end of each line, but the shell
  117: # strips only linefeeds from the output of a `backquoted` command. Hence the
  118: # alternative patterns.
  119: 
  120: $sim ./pcretest -C linksize >/dev/null
  121: link_size=$?
  122: if [ $link_size -lt 2 ] ; then
  123:   echo "Failed to find internal link size"
  124:   exit 1
  125: fi
  126: if [ $link_size -gt 4 ] ; then
  127:   echo "Failed to find internal link size"
  128:   exit 1
  129: fi
  130: 
  131: # Both 8-bit and 16-bit character strings may be supported, but only one
  132: # need be.
  133: 
  134: $sim ./pcretest -C pcre8 >/dev/null
  135: support8=$?
  136: $sim ./pcretest -C pcre16 >/dev/null
  137: support16=$?
  138: if [ $(( $support8 + $support16 )) -eq 2 ] ; then
  139:   test8=
  140:   test16=-16
  141:   if [ "$arg8" = yes -a "$arg16" != yes ] ; then
  142:     test16=skip
  143:   fi
  144:   if [ "$arg16" = yes -a "$arg8" != yes ] ; then
  145:     test8=skip
  146:   fi
  147: else
  148:   if [ $support8 -ne 0 ] ; then
  149:     if [ "$arg16" = yes ] ; then
  150:       echo "Cannot run 16-bit library tests: 16-bit library not compiled"
  151:       exit 1
  152:     fi
  153:     test8=
  154:     test16=skip
  155:   else
  156:     if [ "$arg8" = yes ] ; then
  157:       echo "Cannot run 8-bit library tests: 8-bit library not compiled"
  158:       exit 1
  159:     fi
  160:     test8=skip
  161:     test16=-16
  162:   fi
  163: fi
  164: 
  165: # UTF support always applies to both bit sizes if both are supported; we can't
  166: # have UTF-8 support without UTF-16 support (for example).
  167: 
  168: $sim ./pcretest -C utf >/dev/null
  169: utf=$?
  170: 
  171: $sim ./pcretest -C ucp >/dev/null
  172: ucp=$?
  173: 
  174: jitopt=
  175: $sim ./pcretest -C jit >/dev/null
  176: jit=$?
  177: if [ $jit -ne 0 ] ; then
  178:   jitopt=-s+
  179: fi
  180: 
  181: if [ $utf -eq 0 ] ; then
  182:   if [ $do4 = yes ] ; then
  183:     echo "Can't run test 4 because UTF support is not configured"
  184:     exit 1
  185:   fi
  186:   if [ $do5 = yes ] ; then
  187:     echo "Can't run test 5 because UTF support is not configured"
  188:     exit 1
  189:   fi
  190:   if [ $do9 = yes ] ; then
  191:     echo "Can't run test 8 because UTF support is not configured"
  192:     exit 1
  193:   fi
  194:   if [ $do15 = yes ] ; then
  195:     echo "Can't run test 15 because UTF support is not configured"
  196:     exit 1
  197:   fi
  198:   if [ $do18 = yes ] ; then
  199:     echo "Can't run test 18 because UTF support is not configured"
  200:   fi
  201:   if [ $do22 = yes ] ; then
  202:     echo "Can't run test 22 because UTF support is not configured"
  203:   fi
  204: fi
  205: 
  206: if [ $ucp -eq 0 ] ; then
  207:   if [ $do6 = yes ] ; then
  208:     echo "Can't run test 6 because Unicode property support is not configured"
  209:     exit 1
  210:   fi
  211:   if [ $do7 = yes ] ; then
  212:     echo "Can't run test 7 because Unicode property support is not configured"
  213:     exit 1
  214:   fi
  215:   if [ $do10 = yes ] ; then
  216:     echo "Can't run test 10 because Unicode property support is not configured"
  217:     exit 1
  218:   fi
  219:   if [ $do16 = yes ] ; then
  220:     echo "Can't run test 16 because Unicode property support is not configured"
  221:     exit 1
  222:   fi
  223:   if [ $do19 = yes ] ; then
  224:     echo "Can't run test 19 because Unicode property support is not configured"
  225:     exit 1
  226:   fi
  227: fi
  228: 
  229: if [ $link_size -ne 2 ] ; then
  230:   if [ $do11 = yes ] ; then
  231:     echo "Can't run test 11 because the link size ($link_size) is not 2"
  232:     exit 1
  233:   fi
  234: fi
  235: 
  236: if [ $jit -eq 0 ] ; then
  237:   if [ $do12 = "yes" ] ; then
  238:     echo "Can't run test 12 because JIT support is not configured"
  239:     exit 1
  240:   fi
  241: else
  242:   if [ $do13 = "yes" ] ; then
  243:     echo "Can't run test 13 because JIT support is configured"
  244:     exit 1
  245:   fi
  246: fi
  247: 
  248: # If no specific tests were requested, select all. Those that are not
  249: # relevant will be skipped.
  250: 
  251: if [ $do1  = no -a $do2  = no -a $do3  = no -a $do4  = no -a \
  252:      $do5  = no -a $do6  = no -a $do7  = no -a $do8  = no -a \
  253:      $do9  = no -a $do10 = no -a $do11 = no -a $do12 = no -a \
  254:      $do13 = no -a $do14 = no -a $do15 = no -a $do16 = no -a \
  255:      $do17 = no -a $do18 = no -a $do19 = no -a $do20 = no -a \
  256:      $do21 = no -a $do22 = no ] ; then
  257:   do1=yes
  258:   do2=yes
  259:   do3=yes
  260:   do4=yes
  261:   do5=yes
  262:   do6=yes
  263:   do7=yes
  264:   do8=yes
  265:   do9=yes
  266:   do10=yes
  267:   do11=yes
  268:   do12=yes
  269:   do13=yes
  270:   do14=yes
  271:   do15=yes
  272:   do16=yes
  273:   do17=yes
  274:   do18=yes
  275:   do19=yes
  276:   do20=yes
  277:   do21=yes
  278:   do22=yes
  279: fi
  280: 
  281: # Show which release and which test data
  282: 
  283: echo ""
  284: echo PCRE C library tests using test data from $testdata
  285: $sim ./pcretest /dev/null
  286: 
  287: for bmode in "$test8" "$test16"; do
  288:   case "$bmode" in
  289:     skip) continue;;
  290:     -16)  if [ "$test8" != "skip" ] ; then echo ""; fi
  291:           bits=16; echo "---- Testing 16-bit library ----"; echo "";;
  292:     *)    bits=8; echo "---- Testing 8-bit library ----"; echo "";;
  293:   esac
  294: 
  295: # Primary test, compatible with JIT and all versions of Perl >= 5.8
  296: 
  297: if [ $do1 = yes ] ; then
  298:   echo "Test 1: main functionality (Compatible with Perl >= 5.10)"
  299:   for opt in "" "-s" $jitopt; do
  300:     $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput1 testtry
  301:     if [ $? = 0 ] ; then
  302:       $cf $testdata/testoutput1 testtry
  303:       if [ $? != 0 ] ; then exit 1; fi
  304:     else exit 1
  305:     fi
  306:     if [ "$opt" = "-s" ] ; then echo "  OK with study"
  307:     elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
  308:     else echo "  OK"
  309:     fi
  310:   done
  311: fi
  312: 
  313: # PCRE tests that are not JIT or Perl-compatible: API, errors, internals
  314: 
  315: if [ $do2 = yes ] ; then
  316:   echo "Test 2: API, errors, internals, and non-Perl stuff (not UTF-$bits)"
  317:   for opt in "" "-s" $jitopt; do
  318:     $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput2 testtry
  319:     if [ $? = 0 ] ; then
  320:       $cf $testdata/testoutput2 testtry
  321:       if [ $? != 0 ] ; then exit 1; fi
  322:     else
  323:       echo " "
  324:       echo "** Test 2 requires a lot of stack. If it has crashed with a"
  325:       echo "** segmentation fault, it may be that you do not have enough"
  326:       echo "** stack available by default. Please see the 'pcrestack' man"
  327:       echo "** page for a discussion of PCRE's stack usage."
  328:       echo " "
  329:       exit 1
  330:     fi
  331:     if [ "$opt" = "-s" ] ; then echo "  OK with study"
  332:     elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
  333:     else echo "  OK"
  334:     fi
  335:   done
  336: fi
  337: 
  338: # Locale-specific tests, provided that either the "fr_FR" or the "french"
  339: # locale is available. The former is the Unix-like standard; the latter is
  340: # for Windows. Another possibility is "fr", which needs to be run against
  341: # the Windows-specific input and output files.
  342: 
  343: if [ $do3 = yes ] ; then
  344:   locale -a | grep '^fr_FR$' >/dev/null
  345:   if [ $? -eq 0 ] ; then
  346:     locale=fr_FR
  347:     infile=$testdata/testinput3
  348:     outfile=$testdata/testoutput3
  349:   else
  350:     infile=test3input
  351:     outfile=test3output
  352:     locale -a | grep '^french$' >/dev/null
  353:     if [ $? -eq 0 ] ; then
  354:       locale=french
  355:       sed 's/fr_FR/french/' $testdata/testinput3 >test3input
  356:       sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
  357:     else
  358:       locale -a | grep '^fr$' >/dev/null
  359:       if [ $? -eq 0 ] ; then
  360:         locale=fr
  361:         sed 's/fr_FR/fr/' $testdata/wintestinput3 >test3input
  362:         sed 's/fr_FR/fr/' $testdata/wintestoutput3 >test3output
  363:       else
  364:         locale=
  365:       fi
  366:     fi
  367:   fi
  368: 
  369:   if [ "$locale" != "" ] ; then
  370:     echo "Test 3: locale-specific features (using '$locale' locale)"
  371:     for opt in "" "-s" $jitopt; do
  372:       $sim $valgrind ./pcretest -q $bmode $opt $infile testtry
  373:       if [ $? = 0 ] ; then
  374:         $cf $outfile testtry
  375:         if [ $? != 0 ] ; then
  376:           echo " "
  377:           echo "Locale test did not run entirely successfully."
  378:           echo "This usually means that there is a problem with the locale"
  379:           echo "settings rather than a bug in PCRE."
  380:           break;
  381:         else
  382:           if [ "$opt" = "-s" ] ; then echo "  OK with study"
  383:           elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
  384:           else echo "  OK"
  385:           fi
  386:         fi
  387:       else exit 1
  388:       fi
  389:     done
  390:   else
  391:     echo "Cannot test locale-specific features - none of the 'fr_FR', 'fr' or"
  392:     echo "'french' locales exist, or the \"locale\" command is not available"
  393:     echo "to check for them."
  394:     echo " "
  395:   fi
  396: fi
  397: 
  398: # Additional tests for UTF support
  399: 
  400: if [ $do4 = yes ] ; then
  401:   echo "Test 4: UTF-$bits support (Compatible with Perl >= 5.10)"
  402:   if [ $utf -eq 0 ] ; then
  403:     echo "  Skipped because UTF-$bits support is not available"
  404:   else
  405:     for opt in "" "-s" $jitopt; do
  406:       $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput4 testtry
  407:       if [ $? = 0 ] ; then
  408:         $cf $testdata/testoutput4 testtry
  409:         if [ $? != 0 ] ; then exit 1; fi
  410:       else exit 1
  411:       fi
  412:       if [ "$opt" = "-s" ] ; then echo "  OK with study"
  413:       elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
  414:       else echo "  OK"
  415:       fi
  416:     done
  417:   fi
  418: fi
  419: 
  420: if [ $do5 = yes ] ; then
  421:   echo "Test 5: API, internals, and non-Perl stuff for UTF-$bits support"
  422:   if [ $utf -eq 0 ] ; then
  423:     echo "  Skipped because UTF-$bits support is not available"
  424:   else
  425:     for opt in "" "-s" $jitopt; do
  426:       $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput5 testtry
  427:       if [ $? = 0 ] ; then
  428:         $cf $testdata/testoutput5 testtry
  429:         if [ $? != 0 ] ; then exit 1; fi
  430:       else exit 1
  431:       fi
  432:       if [ "$opt" = "-s" ] ; then echo "  OK with study"
  433:       elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
  434:       else echo "  OK"
  435:       fi
  436:     done
  437:   fi
  438: fi
  439: 
  440: if [ $do6 = yes ] ; then
  441:   echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)"
  442:   if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
  443:     echo "  Skipped because Unicode property support is not available"
  444:   else
  445:     for opt in "" "-s" $jitopt; do
  446:       $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput6 testtry
  447:       if [ $? = 0 ] ; then
  448:         $cf $testdata/testoutput6 testtry
  449:         if [ $? != 0 ] ; then exit 1; fi
  450:       else exit 1
  451:       fi
  452:       if [ "$opt" = "-s" ] ; then echo "  OK with study"
  453:       elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
  454:       else echo "  OK"
  455:       fi
  456:     done
  457:   fi
  458: fi
  459: 
  460: # Test non-Perl-compatible Unicode property support
  461: 
  462: if [ $do7 = yes ] ; then
  463:   echo "Test 7: API, internals, and non-Perl stuff for Unicode property support"
  464:   if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
  465:     echo "  Skipped because Unicode property support is not available"
  466:   else
  467:     for opt in "" "-s" $jitopt; do
  468:       $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput7 testtry
  469:       if [ $? = 0 ] ; then
  470:         $cf $testdata/testoutput7 testtry
  471:         if [ $? != 0 ] ; then exit 1; fi
  472:       else exit 1
  473:       fi
  474:       if [ "$opt" = "-s" ] ; then echo "  OK with study"
  475:       elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
  476:       else echo "  OK"
  477:       fi
  478:     done
  479:   fi
  480: fi
  481: 
  482: # Tests for DFA matching support
  483: 
  484: if [ $do8 = yes ] ; then
  485:   echo "Test 8: DFA matching main functionality"
  486:   for opt in "" "-s"; do
  487:     $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput8 testtry
  488:     if [ $? = 0 ] ; then
  489:       $cf $testdata/testoutput8 testtry
  490:       if [ $? != 0 ] ; then exit 1; fi
  491:     else exit 1
  492:     fi
  493:     if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
  494:   done
  495: fi
  496: 
  497: if [ $do9 = yes ] ; then
  498:   echo "Test 9: DFA matching with UTF-$bits"
  499:   if [ $utf -eq 0 ] ; then
  500:     echo "  Skipped because UTF-$bits support is not available"
  501:   else
  502:     for opt in "" "-s"; do
  503:       $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput9 testtry
  504:       if [ $? = 0 ] ; then
  505:         $cf $testdata/testoutput9 testtry
  506:         if [ $? != 0 ] ; then exit 1; fi
  507:       else exit 1
  508:       fi
  509:       if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
  510:     done
  511:   fi
  512: fi
  513: 
  514: if [ $do10 = yes ] ; then
  515:   echo "Test 10: DFA matching with Unicode properties"
  516:   if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
  517:     echo "  Skipped because Unicode property support is not available"
  518:   else
  519:     for opt in "" "-s"; do
  520:       $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput10 testtry
  521:       if [ $? = 0 ] ; then
  522:         $cf $testdata/testoutput10 testtry
  523:         if [ $? != 0 ] ; then exit 1; fi
  524:       else exit 1
  525:       fi
  526:       if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
  527:     done
  528:   fi
  529: fi
  530: 
  531: # Test of internal offsets and code sizes. This test is run only when there
  532: # is Unicode property support and the link size is 2. The actual tests are
  533: # mostly the same as in some of the above, but in this test we inspect some
  534: # offsets and sizes that require a known link size. This is a doublecheck for
  535: # the maintainer, just in case something changes unexpectely. The output from
  536: # this test is not the same in 8-bit and 16-bit modes.
  537: 
  538: if [ $do11 = yes ] ; then
  539:   echo "Test 11: Internal offsets and code size tests"
  540:   if [ $link_size -ne 2 ] ; then
  541:     echo "  Skipped because link size is not 2"
  542:   elif [ $ucp -eq 0 ] ; then
  543:     echo "  Skipped because Unicode property support is not available"
  544:   else
  545:     for opt in "" "-s"; do
  546:       $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput11 testtry
  547:       if [ $? = 0 ] ; then
  548:         $cf $testdata/testoutput11-$bits testtry
  549:         if [ $? != 0 ] ; then exit 1; fi
  550:       else exit 1
  551:       fi
  552:       if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
  553:     done
  554:   fi
  555: fi
  556: 
  557: # Test JIT-specific features when JIT is available
  558: 
  559: if [ $do12 = yes ] ; then
  560:   echo "Test 12: JIT-specific features (JIT available)"
  561:   if [ $jit -eq 0 ] ; then
  562:     echo "  Skipped because JIT is not available or not usable"
  563:   else
  564:     $sim $valgrind ./pcretest -q $bmode $testdata/testinput12 testtry
  565:     if [ $? = 0 ] ; then
  566:       $cf $testdata/testoutput12 testtry
  567:       if [ $? != 0 ] ; then exit 1; fi
  568:     else exit 1
  569:     fi
  570:     echo "  OK"
  571:   fi
  572: fi
  573: 
  574: # Test JIT-specific features when JIT is not available
  575: 
  576: if [ $do13 = yes ] ; then
  577:   echo "Test 13: JIT-specific features (JIT not available)"
  578:   if [ $jit -ne 0 ] ; then
  579:     echo "  Skipped because JIT is available"
  580:   else
  581:     $sim $valgrind ./pcretest -q $bmode $testdata/testinput13 testtry
  582:     if [ $? = 0 ] ; then
  583:       $cf $testdata/testoutput13 testtry
  584:       if [ $? != 0 ] ; then exit 1; fi
  585:     else exit 1
  586:     fi
  587:     echo "  OK"
  588:   fi
  589: fi
  590: 
  591: # Tests for 8-bit-specific features
  592: 
  593: if [ "$do14" = yes ] ; then
  594:   echo "Test 14: specials for the basic 8-bit library"
  595:   if [ "$bits" = "16" ] ; then
  596:     echo "  Skipped when running 16-bit tests"
  597:   else
  598:     cp -f $testdata/saved16 testsaved16
  599:     for opt in "" "-s" $jitopt; do
  600:       $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput14 testtry
  601:       if [ $? = 0 ] ; then
  602:         $cf $testdata/testoutput14 testtry
  603:         if [ $? != 0 ] ; then exit 1; fi
  604:       else exit 1
  605:       fi
  606:       if [ "$opt" = "-s" ] ; then echo "  OK with study"
  607:       elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
  608:       else echo "  OK"
  609:       fi
  610:     done
  611:   fi
  612: fi
  613: 
  614: # Tests for 8-bit-specific features (needs UTF-8 support)
  615: 
  616: if [ "$do15" = yes ] ; then
  617:   echo "Test 15: specials for the 8-bit library with UTF-8 support"
  618:   if [ "$bits" = "16" ] ; then
  619:     echo "  Skipped when running 16-bit tests"
  620:   elif [ $utf -eq 0 ] ; then
  621:     echo "  Skipped because UTF-$bits support is not available"
  622:   else
  623:     for opt in "" "-s" $jitopt; do
  624:       $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput15 testtry
  625:       if [ $? = 0 ] ; then
  626:         $cf $testdata/testoutput15 testtry
  627:         if [ $? != 0 ] ; then exit 1; fi
  628:       else exit 1
  629:       fi
  630:       if [ "$opt" = "-s" ] ; then echo "  OK with study"
  631:       elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
  632:       else echo "  OK"
  633:       fi
  634:     done
  635:   fi
  636: fi
  637: 
  638: # Tests for 8-bit-specific features (Unicode property support)
  639: 
  640: if [ $do16 = yes ] ; then
  641:   echo "Test 16: specials for the 8-bit library with Unicode propery support"
  642:   if [ "$bits" = "16" ] ; then
  643:     echo "  Skipped when running 16-bit tests"
  644:   elif [ $ucp -eq 0 ] ; then
  645:     echo "  Skipped because Unicode property support is not available"
  646:   else
  647:     for opt in "" "-s" $jitopt; do
  648:       $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput16 testtry
  649:       if [ $? = 0 ] ; then
  650:         $cf $testdata/testoutput16 testtry
  651:         if [ $? != 0 ] ; then exit 1; fi
  652:       else exit 1
  653:       fi
  654:       if [ "$opt" = "-s" ] ; then echo "  OK with study"
  655:       elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
  656:       else echo "  OK"
  657:       fi
  658:     done
  659:   fi
  660: fi
  661: 
  662: # Tests for 16-bit-specific features
  663: 
  664: if [ $do17 = yes ] ; then
  665:   echo "Test 17: specials for the basic 16-bit library"
  666:   if [ "$bits" = "8" ] ; then
  667:     echo "  Skipped when running 8-bit tests"
  668:   else
  669:     for opt in "" "-s" $jitopt; do
  670:       $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput17 testtry
  671:       if [ $? = 0 ] ; then
  672:         $cf $testdata/testoutput17 testtry
  673:         if [ $? != 0 ] ; then exit 1; fi
  674:       else exit 1
  675:       fi
  676:       if [ "$opt" = "-s" ] ; then echo "  OK with study"
  677:       elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
  678:       else echo "  OK"
  679:       fi
  680:     done
  681:   fi
  682: fi
  683: 
  684: # Tests for 16-bit-specific features (UTF-16 support)
  685: 
  686: if [ $do18 = yes ] ; then
  687:   echo "Test 18: specials for the 16-bit library with UTF-16 support"
  688:   if [ "$bits" = "8" ] ; then
  689:     echo "  Skipped when running 8-bit tests"
  690:   elif [ $utf -eq 0 ] ; then
  691:     echo "  Skipped because UTF-$bits support is not available"
  692:   else
  693:     for opt in "" "-s" $jitopt; do
  694:       $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput18 testtry
  695:       if [ $? = 0 ] ; then
  696:         $cf $testdata/testoutput18 testtry
  697:         if [ $? != 0 ] ; then exit 1; fi
  698:       else exit 1
  699:       fi
  700:       if [ "$opt" = "-s" ] ; then echo "  OK with study"
  701:       elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
  702:       else echo "  OK"
  703:       fi
  704:     done
  705:   fi
  706: fi
  707: 
  708: # Tests for 16-bit-specific features (Unicode property support)
  709: 
  710: if [ $do19 = yes ] ; then
  711:   echo "Test 19: specials for the 16-bit library with Unicode propery support"
  712:   if [ "$bits" = "8" ] ; then
  713:     echo "  Skipped when running 8-bit tests"
  714:   elif [ $ucp -eq 0 ] ; then
  715:     echo "  Skipped because Unicode property support is not available"
  716:   else
  717:     for opt in "" "-s" $jitopt; do
  718:       $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput19 testtry
  719:       if [ $? = 0 ] ; then
  720:         $cf $testdata/testoutput19 testtry
  721:         if [ $? != 0 ] ; then exit 1; fi
  722:       else exit 1
  723:       fi
  724:       if [ "$opt" = "-s" ] ; then echo "  OK with study"
  725:       elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
  726:       else echo "  OK"
  727:       fi
  728:     done
  729:   fi
  730: fi
  731: 
  732: # Tests for 16-bit-specific features in DFA non-UTF-16 mode
  733: 
  734: if [ $do20 = yes ] ; then
  735:   echo "Test 20: DFA specials for the basic 16-bit library"
  736:   if [ "$bits" = "8" ] ; then
  737:     echo "  Skipped when running 8-bit tests"
  738:   else
  739:     for opt in "" "-s"; do
  740:       $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput20 testtry
  741:       if [ $? = 0 ] ; then
  742:         $cf $testdata/testoutput20 testtry
  743:         if [ $? != 0 ] ; then exit 1; fi
  744:       else exit 1
  745:       fi
  746:       if [ "$opt" = "-s" ] ; then echo "  OK with study"
  747:       else echo "  OK"
  748:       fi
  749:     done
  750:   fi
  751: fi
  752: 
  753: # Tests for reloads with 16-bit library
  754: 
  755: if [ $do21 = yes ] ; then
  756:   echo "Test 21: reloads for the basic 16-bit library"
  757:   if [ "$bits" = "8" ] ; then
  758:     echo "  Skipped when running 8-bit tests"
  759:   elif [ $link_size -ne 2 ] ; then
  760:     echo "  Skipped because link size is not 2"
  761:   else
  762:     cp -f $testdata/saved8 testsaved8
  763:     cp -f $testdata/saved16LE-1 testsaved16LE-1
  764:     cp -f $testdata/saved16BE-1 testsaved16BE-1
  765:     $sim $valgrind ./pcretest -q $bmode $testdata/testinput21 testtry
  766:     if [ $? = 0 ] ; then
  767:       $cf $testdata/testoutput21 testtry
  768:       if [ $? != 0 ] ; then exit 1; fi
  769:     else exit 1
  770:     fi
  771:     echo "  OK"
  772:   fi
  773: fi
  774: 
  775: # Tests for reloads with 16-bit library (UTF-16 support)
  776: 
  777: if [ $do22 = yes ] ; then
  778:   echo "Test 22: reloads for the 16-bit library with UTF-16 support"
  779:   if [ "$bits" = "8" ] ; then
  780:     echo "  Skipped when running 8-bit tests"
  781:   elif [ $utf -eq 0 ] ; then
  782:     echo "  Skipped because UTF-$bits support is not available"
  783:   elif [ $link_size -ne 2 ] ; then
  784:     echo "  Skipped because link size is not 2"
  785:   else
  786:     cp -f $testdata/saved16LE-2 testsaved16LE-2
  787:     cp -f $testdata/saved16BE-2 testsaved16BE-2
  788:     $sim $valgrind ./pcretest -q $bmode $testdata/testinput22 testtry
  789:     if [ $? = 0 ] ; then
  790:       $cf $testdata/testoutput22 testtry
  791:       if [ $? != 0 ] ; then exit 1; fi
  792:     else exit 1
  793:     fi
  794:     echo "  OK"
  795:   fi
  796: fi
  797: 
  798: # End of loop for 8-bit/16-bit tests
  799: done
  800: 
  801: # Clean up local working files
  802: rm -f test3input test3output testNinput testsaved* teststderr teststdout testtry
  803: 
  804: # End

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>