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

Diff of /code/trunk/RunTest

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

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

Legend:
Removed from v.345  
changed lines
  Added in v.1123

  ViewVC Help
Powered by ViewVC 1.1.5