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

Diff of /code/trunk/RunTest

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

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

Legend:
Removed from v.162  
changed lines
  Added in v.1119

  ViewVC Help
Powered by ViewVC 1.1.5