/[pcre]/code/trunk/RunTest
ViewVC logotype

Diff of /code/trunk/RunTest

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.173  
changed lines
  Added in v.1033

  ViewVC Help
Powered by ViewVC 1.1.5