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

Diff of /code/trunk/RunTest

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

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

Legend:
Removed from v.159  
changed lines
  Added in v.1443

  ViewVC Help
Powered by ViewVC 1.1.5