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

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

  ViewVC Help
Powered by ViewVC 1.1.5