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

Diff of /code/trunk/RunTest

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

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

Legend:
Removed from v.371  
changed lines
  Added in v.931

  ViewVC Help
Powered by ViewVC 1.1.5