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

Diff of /code/trunk/RunTest

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

code/trunk/RunTest.in revision 96 by nigel, Fri Mar 2 13:10:43 2007 UTC code/trunk/RunTest revision 1119 by chpe, Tue Oct 16 15:57:34 2012 UTC
# Line 1  Line 1 
1  #! /bin/sh  #! /bin/sh
2    
3  # This file is generated by configure from RunTest.in. Make any changes  # Run the PCRE tests using the pcretest program. The appropriate tests are
4  # to that file.  # 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  # Run PCRE tests  # Set up a suitable "diff" command for comparison. Some systems
103    # have a diff that lacks a -u option. Try to deal with this.
104    
105  cf=diff  cf="diff"
106  valgrind=  diff -u /dev/null /dev/null 2>/dev/null && cf="diff -u"
107  if [ ! -d testdata ] ; then  
108    ln -s @top_srcdir@/testdata testdata  # Find the test data
109    
110    if [ -n "$srcdir" -a -d "$srcdir" ] ; then
111      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
120    
121    
122    # ------ Special EBCDIC Test -------
123    
124    if [ $# -eq 1 -a "$1" = "ebcdic" ]; then
125      ./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      for opt in "" "-s" "-dfa" "-s -dfa"; do
133        ./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  fi
 testdata=./testdata  
148    
149    
150  # Select which tests to run; if no selection, run all  # ------ 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
164    # that the necessary optional facilities are available.
165    
166  do1=no  do1=no
167  do2=no  do2=no
# Line 24  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 36  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 [ "@LINK_SIZE@" != "" -a "@LINK_SIZE@" != "-DLINK_SIZE=2" ] ; then  # Find which optional facilities are available.
232    if [ $do2 = yes ] ; then  
233      echo "Can't run test 2 with an internal link size other than 2"  $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
328        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 with an internal link size other than 2"      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 with an internal link size other than 2"      echo "Can't run test 8 because UTF support is not configured"
337        exit 1
338      fi
339      if [ $do15 = yes ] ; then
340        echo "Can't run test 15 because UTF support is not configured"
341      exit 1      exit 1
342    fi    fi
343      if [ $do18 = yes ] ; then
344        echo "Can't run test 18 because UTF support is not configured"
345      fi
346      if [ $do22 = yes ] ; then
347        echo "Can't run test 22 because UTF support is not configured"
348      fi
349  fi  fi
350    
351  if [ "@UTF8@" = "" ] ; then  if [ $ucp -eq 0 ] ; then
352    if [ $do4 = yes ] ; then    if [ $do6 = yes ] ; then
353      echo "Can't run test 4 because UTF-8 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 [ $do5 = yes ] ; then    if [ $do7 = yes ] ; then
357      echo "Can't run test 5 because UTF-8 support is not configured"      echo "Can't run test 7 because Unicode property support is not configured"
358      exit 1      exit 1
359    fi    fi
360    if [ $do6 = yes ] ; then    if [ $do10 = yes ] ; then
361      echo "Can't run test 6 because UTF-8 support is not configured"      echo "Can't run test 10 because Unicode property support is not configured"
362      exit 1      exit 1
363    fi    fi
364    if [ $do8 = yes ] ; then    if [ $do16 = yes ] ; then
365      echo "Can't run test 8 because UTF-8 support is not configured"      echo "Can't run test 16 because Unicode property support is not configured"
366      exit 1      exit 1
367    fi    fi
368    if [ $do9 = yes ] ; then    if [ $do19 = yes ] ; then
369      echo "Can't run test 9 because UTF-8 support is not configured"      echo "Can't run test 19 because Unicode property support is not configured"
370      exit 1      exit 1
371    fi    fi
372  fi  fi
373    
374  if [ "@UCP@" = "" ] ; then  if [ $link_size -ne 2 ] ; then
375    if [ $do6 = yes ] ; then    if [ $do11 = yes ] ; then
376      echo "Can't run test 6 because Unicode property support is not configured"      echo "Can't run test 11 because the link size ($link_size) is not 2"
377      exit 1      exit 1
378    fi    fi
379    if [ $do9 = yes ] ; then  fi
380      echo "Can't run test 9 because Unicode property support is not configured"  
381    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      exit 1
390    fi    fi
391  fi  fi
392    
393  if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \  # If no specific tests were requested, select all. Those that are not
394       $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \  # relevant will be skipped.
395       $do9 = no ] ; then  
396    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 \
398         $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@" != "" ] ; then do4=yes; fi    do4=yes
407    if [ "@UTF8@" != "" ] ; then do5=yes; fi    do5=yes
408    if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do6=yes; fi    do6=yes
409    do7=yes    do7=yes
410    if [ "@UTF8@" != "" ] ; then do8=yes; fi    do8=yes
411    if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; 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  fi
430    
431  # Show which release  # 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
437    
438  ./pcretest /dev/null  # Show which release and which test data
439    
440  # Primary test, Perl-compatible  echo ""
441    echo PCRE C library tests using test data from $testdata
442    $sim ./pcretest /dev/null
443    
444    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 testtry $testdata/testoutput1      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    echo " "  # 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    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    echo $title2 "(not UTF-$bits)"
486      echo "Test 2: API and error handling (not Perl compatible)"    for opt in "" "-s" $jitopt; do
487      $valgrind ./pcretest -q $testdata/testinput2 testtry      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput2 testtry
488      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
489        $cf testtry $testdata/testoutput2        $cf $testdata/testoutput2 testtry
490        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
491      else exit 1      else
492          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      fi
500      echo "OK"      if [ "$opt" = "-s" ] ; then echo "  OK with study"
501      echo " "      elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
502    else      else echo "  OK"
503      echo Test 2 skipped for link size other than 2 \(@LINK_SIZE@\)      fi
504      echo " "    done
   fi  
505  fi  fi
506    
507  # Locale-specific tests, provided the "fr_FR" locale is available  # 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
509    # 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
514    if [ $? -eq 0 ] ; then    if [ $? -eq 0 ] ; then
515      echo "Test 3: locale-specific features (using 'fr_FR' locale)"      locale=fr_FR
516      $valgrind ./pcretest -q $testdata/testinput3 testtry      infile=$testdata/testinput3
517      if [ $? = 0 ] ; then      outfile=$testdata/testoutput3
518        $cf testtry $testdata/testoutput3    else
519        if [ $? != 0 ] ; then      infile=test3input
520          echo " "      outfile=test3output
521          echo "Locale test did not run entirely successfully."      locale -a | grep '^french$' >/dev/null
522          echo "This usually means that there is a problem with the locale"      if [ $? -eq 0 ] ; then
523          echo "settings rather than a bug in PCRE."        locale=french
524          sed 's/fr_FR/french/' $testdata/testinput3 >test3input
525          sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
526        else
527          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        else
533        echo "OK"          locale=
534        fi        fi
       echo " "  
     else exit 1  
535      fi      fi
536      fi
537    
538      if [ "$locale" != "" ] ; then
539        echo $title3 "(using '$locale' locale)"
540        for opt in "" "-s" $jitopt; do
541          $sim $valgrind ./pcretest -q $bmode $opt $infile testtry
542          if [ $? = 0 ] ; then
543            $cf $outfile testtry
544            if [ $? != 0 ] ; then
545              echo " "
546              echo "Locale test did not run entirely successfully."
547              echo "This usually means that there is a problem with the locale"
548              echo "settings rather than a bug in PCRE."
549              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
558        done
559    else    else
560      echo "Cannot test locale-specific features - 'fr_FR' locale not found,"      echo "Cannot test locale-specific features - none of the 'fr_FR', 'fr' or"
561      echo "or the \"locale\" command is not available to check for it."      echo "'french' locales exist, or the \"locale\" command is not available"
562        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 testtry $testdata/testoutput4    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"  
   echo " "  
587  fi  fi
588    
589  if [ $do5 = yes ] ; then  if [ $do5 = yes ] ; then
590    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    echo ${title5}-${bits} support
591      echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"    if [ $utf -eq 0 ] ; then
592      $valgrind ./pcretest -q $testdata/testinput5 testtry      echo "  Skipped because UTF-$bits support is not available"
593      else
594        for opt in "" "-s" $jitopt; do
595          $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
607    fi
608    
609    if [ $do6 = yes ] ; then
610      echo $title6
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" $jitopt; do
615          $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
627    fi
628    
629    # Test non-Perl-compatible Unicode property support
630    
631    if [ $do7 = yes ] ; then
632      echo $title7
633      if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
634        echo "  Skipped because Unicode property support is not available"
635      else
636        for opt in "" "-s" $jitopt; do
637          $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
649    fi
650    
651    # Tests for DFA matching support
652    
653    if [ $do8 = yes ] ; then
654      echo $title8
655      for opt in "" "-s"; do
656        $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput8 testtry
657      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
658        $cf testtry $testdata/testoutput5        $cf $testdata/testoutput8 testtry
659        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
660      else exit 1      else exit 1
661      fi      fi
662      echo "OK"      if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
663      echo " "    done
664    fi
665    
666    if [ $do9 = yes ] ; then
667      echo ${title9}-${bits}
668      if [ $utf -eq 0 ] ; then
669        echo "  Skipped because UTF-$bits support is not available"
670    else    else
671      echo Test 5 skipped for link size other than 2 \(@LINK_SIZE@\)      for opt in "" "-s"; do
672      echo " "        $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    fi
681  fi  fi
682    
683  if [ $do6 = yes ] ; then  if [ $do10 = yes ] ; then
684    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    echo $title10
685      echo "Test 6: Unicode property support"    if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
686      $valgrind ./pcretest -q $testdata/testinput6 testtry      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      if [ $? = 0 ] ; then
735        $cf testtry $testdata/testoutput6        $cf $testdata/testoutput12 testtry
736        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
737      else exit 1      else exit 1
738      fi      fi
739      echo "OK"      echo "  OK"
740      echo " "    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    else
750      echo Test 6 skipped for link size other than 2 \(@LINK_SIZE@\)      $sim $valgrind ./pcretest -q $bmode $testdata/testinput13 testtry
751      echo " "      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    fi
758  fi  fi
759    
760  # Tests for DFA matching support  # Tests for 8-bit-specific features
761    
762  if [ $do7 = yes ] ; then  if [ "$do14" = yes ] ; then
763    echo "Test 7: DFA matching"    echo $title14
764    $valgrind ./pcretest -q -dfa $testdata/testinput7 testtry    if [ "$bits" = "16" -o "$bits" = "32" ] ; then
765    if [ $? = 0 ] ; then      echo "  Skipped when running 16/32-bit tests"
766      $cf testtry $testdata/testoutput7    else
767      if [ $? != 0 ] ; then exit 1; fi      cp -f $testdata/saved16 testsaved16
768    else exit 1      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    fi
   echo "OK"  
   echo " "  
782  fi  fi
783    
784  if [ $do8 = yes ] ; then  # Tests for 8-bit-specific features (needs UTF-8 support)
785    echo "Test 8: DFA matching with UTF-8"  
786    $valgrind ./pcretest -q -dfa $testdata/testinput8 testtry  if [ "$do15" = yes ] ; then
787    if [ $? = 0 ] ; then    echo $title15
788      $cf testtry $testdata/testoutput8    if [ "$bits" = "16" -o "$bits" = "32" ] ; then
789      if [ $? != 0 ] ; then exit 1; fi      echo "  Skipped when running 16/32-bit tests"
790    else exit 1    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    fi
   echo "OK"  
   echo " "  
806  fi  fi
807    
808  if [ $do9 = yes ] ; then  # Tests for 8-bit-specific features (Unicode property support)
809    echo "Test 9: DFA matching with Unicode properties"  
810    $valgrind ./pcretest -q -dfa $testdata/testinput9 testtry  if [ $do16 = yes ] ; then
811    if [ $? = 0 ] ; then    echo $title16
812      $cf testtry $testdata/testoutput9    if [ "$bits" = "16" -o "$bits" = "32" ] ; then
813      if [ $? != 0 ] ; then exit 1; fi      echo "  Skipped when running 16/32-bit tests"
814    else exit 1    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    fi
   echo "OK"  
   echo " "  
852  fi  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
900    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.96  
changed lines
  Added in v.1119

  ViewVC Help
Powered by ViewVC 1.1.5