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

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

  ViewVC Help
Powered by ViewVC 1.1.5