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

Diff of /code/trunk/RunTest

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

revision 651 by ph10, Mon Aug 1 16:32:40 2011 UTC revision 1200 by chpe, Sat Nov 3 19:21:41 2012 UTC
# Line 1  Line 1 
1  #! /bin/sh  #! /bin/sh
2    
3  # Run the PCRE tests using the pcretest program. All tests are now run both  # Run the PCRE tests using the pcretest program. The appropriate tests are
4  # with and without -s, to ensure that everything is tested with and without  # selected, depending on which build-time options were used.
5  # studying. However, there are some tests that produce different output after  #
6  # studying, typically when we are tracing the actual matching process (for  # All tests are now run both with and without -s, to ensure that everything is
7  # example, using auto-callouts). In these few cases, the tests are duplicated  # tested with and without studying. However, there are some tests that produce
8  # in the files, one with /S to force studying always, and one with /SS to force  # different output after studying, typically when we are tracing the actual
9  # *not* studying always. The use of -s doesn't then make any difference to  # matching process (for example, using auto-callouts). In these few cases, the
10  # their output. There is also one test which compiles invalid UTF-8 with the  # tests are duplicated in the files, one with /S to force studying always, and
11  # UTF-8 check turned off for which studying is disabled with /SS.  # 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  valgrind=  # 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", "valgrind-log" or "sim" followed by an argument to run cross-
26    # compiled 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 -------
123    *2) link_size=2;;  
124    *3) link_size=3;;  if [ $# -eq 1 -a "$1" = "ebcdic" ]; then
125    *4) link_size=4;;    ./pcretest -C ebcdic >/dev/null
126     *) echo "Failed to find internal link size"; exit 1;;    ebcdic=$?
127  esac    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 UTF-8 support' >/dev/null    for opt in "" "-s" "-dfa" "-s -dfa"; do
133  utf8=$?      ./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  ./pcretest -C | ./pcregrep 'No Unicode properties support' >/dev/null  
150  ucp=$?  # ------ 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 55  do10=no Line 176  do10=no
176  do11=no  do11=no
177  do12=no  do12=no
178  do13=no  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 70  while [ $# -gt 0 ] ; do Line 204  while [ $# -gt 0 ] ; do
204     10) do10=yes;;     10) do10=yes;;
205     11) do11=yes;;     11) do11=yes;;
206     12) do12=yes;;     12) do12=yes;;
207     13) do12=yes;;     13) do13=yes;;
208     valgrind) valgrind="valgrind -q";;     14) do14=yes;;
209      *) echo "Unknown test number $1"; exit 1;;     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 -q --smc-check=all";;
225       valgrind-log) valgrind="valgrind --tool=memcheck --num-callers=30 --leak-check=no --error-limit=no --smc-check=all --log-file=report.%p ";;
226       sim) shift; sim=$1;;
227        *) echo "Unknown test number '$1'"; exit 1;;
228    esac    esac
229    shift    shift
230  done  done
231    
232  if [ $utf8 -eq 0 ] ; then  # Find which optional facilities are available.
233    
234    $sim ./pcretest -C linksize >/dev/null
235    link_size=$?
236    if [ $link_size -lt 2 ] ; then
237      echo "Failed to find internal link size"
238      exit 1
239    fi
240    if [ $link_size -gt 4 ] ; then
241      echo "Failed to find internal link size"
242      exit 1
243    fi
244    
245    # All of 8-bit, 16-bit, and 32-bit character strings may be supported, but only
246    # one need be.
247    
248    $sim ./pcretest -C pcre8 >/dev/null
249    support8=$?
250    $sim ./pcretest -C pcre16 >/dev/null
251    support16=$?
252    $sim ./pcretest -C pcre32 >/dev/null
253    support32=$?
254    
255    # Initialize all bitsizes skipped
256    
257    test8=skip
258    test16=skip
259    test32=skip
260    
261    # If no bitsize arguments, select all that are available
262    
263    if [ "$arg8$arg16$arg32" = "" ] ; then
264      if [ $support8 -ne 0 ] ; then
265        test8=
266      fi
267      if [ $support16 -ne 0 ] ; then
268        test16=-16
269      fi
270      if [ $support32 -ne 0 ] ; then
271        test32=-32
272      fi
273    
274    # Select requested bit sizes
275    
276    else
277      if [ "$arg8" = yes ] ; then
278        if [ $support8 -eq 0 ] ; then
279          echo "Cannot run 8-bit library tests: 8-bit library not compiled"
280          exit 1
281        fi
282        test8=
283      fi
284      if [ "$arg16" = yes ] ; then
285        if [ $support16 -eq 0 ] ; then
286          echo "Cannot run 16-bit library tests: 16-bit library not compiled"
287          exit 1
288        fi
289        test16=-16
290      fi
291      if [ "$arg32" = yes ] ; then
292        if [ $support32 -eq 0 ] ; then
293          echo "Cannot run 32-bit library tests: 32-bit library not compiled"
294          exit 1
295        fi
296        test32=-32
297      fi
298    fi
299    
300    # UTF support always applies to all bit sizes if both are supported; we can't
301    # have UTF-8 support without UTF-16 support (for example).
302    
303    $sim ./pcretest -C utf >/dev/null
304    utf=$?
305    
306    $sim ./pcretest -C ucp >/dev/null
307    ucp=$?
308    
309    jitopt=
310    $sim ./pcretest -C jit >/dev/null
311    jit=$?
312    if [ $jit -ne 0 ] ; then
313      jitopt=-s+
314    fi
315    
316    if [ $utf -eq 0 ] ; then
317    if [ $do4 = yes ] ; then    if [ $do4 = yes ] ; then
318      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"
319      exit 1      exit 1
320    fi    fi
321    if [ $do5 = yes ] ; then    if [ $do5 = yes ] ; then
322      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"
323      exit 1      exit 1
324    fi    fi
325    if [ $do8 = yes ] ; then    if [ $do9 = yes ] ; then
326      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"
327      exit 1      exit 1
328    fi    fi
329    if [ $do12 = yes ] ; then    if [ $do15 = yes ] ; then
330      echo "Can't run test 12 because UTF-8 support is not configured"      echo "Can't run test 15 because UTF support is not configured"
331      exit 1      exit 1
332    fi    fi
333      if [ $do18 = yes ] ; then
334        echo "Can't run test 18 because UTF support is not configured"
335      fi
336      if [ $do22 = yes ] ; then
337        echo "Can't run test 22 because UTF support is not configured"
338      fi
339  fi  fi
340    
341  if [ $ucp -eq 0 ] ; then  if [ $ucp -eq 0 ] ; then
# Line 101  if [ $ucp -eq 0 ] ; then Line 343  if [ $ucp -eq 0 ] ; then
343      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"
344      exit 1      exit 1
345    fi    fi
346    if [ $do9 = yes ] ; then    if [ $do7 = yes ] ; then
347      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"
348      exit 1      exit 1
349    fi    fi
350    if [ $do10 = yes ] ; then    if [ $do10 = yes ] ; then
351      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"
352      exit 1      exit 1
353    fi    fi
354    if [ $do13 = yes ] ; then    if [ $do16 = yes ] ; then
355      echo "Can't run test 12 because Unicode property support is not configured"      echo "Can't run test 16 because Unicode property support is not configured"
356        exit 1
357      fi
358      if [ $do19 = yes ] ; then
359        echo "Can't run test 19 because Unicode property support is not configured"
360      exit 1      exit 1
361    fi    fi
362  fi  fi
363    
364  if [ $link_size -ne 2 ] ; then  if [ $link_size -ne 2 ] ; then
365    if [ $do10 = yes ] ; then    if [ $do11 = yes ] ; then
366      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"
367      exit 1      exit 1
368    fi    fi
369  fi  fi
370    
371  # If no specific tests were requested, select all that are relevant.  if [ $jit -eq 0 ] ; then
372      if [ $do12 = "yes" ] ; then
373        echo "Can't run test 12 because JIT support is not configured"
374        exit 1
375      fi
376    else
377      if [ $do13 = "yes" ] ; then
378        echo "Can't run test 13 because JIT support is configured"
379        exit 1
380      fi
381    fi
382    
383  if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \  # If no specific tests were requested, select all. Those that are not
384       $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \  # relevant will be skipped.
385       $do9 = no -a $do10 = no -a $do11 = no -a $do12 = no ] ; then  
386    if [ $do1  = no -a $do2  = no -a $do3  = no -a $do4  = no -a \
387         $do5  = no -a $do6  = no -a $do7  = no -a $do8  = no -a \
388         $do9  = no -a $do10 = no -a $do11 = no -a $do12 = no -a \
389         $do13 = no -a $do14 = no -a $do15 = no -a $do16 = no -a \
390         $do17 = no -a $do18 = no -a $do19 = no -a $do20 = no -a \
391         $do21 = no -a $do22 = no -a $do23 = no -a $do24 = no -a \
392         $do25 = no -a $do26 = no ] ; then
393    do1=yes    do1=yes
394    do2=yes    do2=yes
395    do3=yes    do3=yes
396    if [ $utf8 -ne 0 ] ; then do4=yes; fi    do4=yes
397    if [ $utf8 -ne 0 ] ; then do5=yes; fi    do5=yes
398    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do6=yes; fi    do6=yes
399    do7=yes    do7=yes
400    if [ $utf8 -ne 0 ] ; then do8=yes; fi    do8=yes
401    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi    do9=yes
402    if [ $link_size -eq 2 -a $ucp -ne 0 ] ; then do10=yes; fi    do10=yes
403    do11=yes    do11=yes
404    if [ $utf8 -ne 0 ] ; then do12=yes; fi    do12=yes
405    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do13=yes; fi    do13=yes
406      do14=yes
407      do15=yes
408      do16=yes
409      do17=yes
410      do18=yes
411      do19=yes
412      do20=yes
413      do21=yes
414      do22=yes
415      do23=yes
416      do24=yes
417      do25=yes
418      do26=yes
419  fi  fi
420    
421  # Show which release  # Show which release and which test data
422    
423  echo ""  echo ""
424  echo PCRE C library tests  echo PCRE C library tests using test data from $testdata
425  ./pcretest /dev/null  $sim ./pcretest /dev/null
426    
427    for bmode in "$test8" "$test16" "$test32"; do
428      case "$bmode" in
429        skip) continue;;
430        -16)  if [ "$test8$test32" != "skipskip" ] ; then echo ""; fi
431              bits=16; echo "---- Testing 16-bit library ----"; echo "";;
432        -32)  if [ "$test8$test16" != "skipskip" ] ; then echo ""; fi
433              bits=32; echo "---- Testing 32-bit library ----"; echo "";;
434        *)    bits=8; echo "---- Testing 8-bit library ----"; echo "";;
435      esac
436    
437  # Primary test, compatible with all versions of Perl >= 5.8  # Primary test, compatible with JIT and all versions of Perl >= 5.8
438    
439  if [ $do1 = yes ] ; then  if [ $do1 = yes ] ; then
440    echo "Test 1: main functionality (Compatible with Perl >= 5.8)"    echo $title1
441    for opt in "" "-s"; do    for opt in "" "-s" $jitopt; do
442      $valgrind ./pcretest -q $opt $testdata/testinput1 testtry      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput1 testtry
443      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
444        $cf $testdata/testoutput1 testtry        $cf $testdata/testoutput1 testtry
445        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
446      else exit 1      else exit 1
447      fi      fi
448      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi      if [ "$opt" = "-s" ] ; then echo "  OK with study"
449    done      elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
450        else echo "  OK"
451        fi
452      done
453  fi  fi
454    
455  # PCRE tests that are not Perl-compatible - API, errors, internals  # PCRE tests that are not JIT or Perl-compatible: API, errors, internals
456    
457  if [ $do2 = yes ] ; then  if [ $do2 = yes ] ; then
458    echo "Test 2: API, errors, internals, and non-Perl stuff"    echo $title2 "(not UTF-$bits)"
459    for opt in "" "-s"; do    for opt in "" "-s" $jitopt; do
460      $valgrind ./pcretest -q $opt $testdata/testinput2 testtry      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput2 testtry
461      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
462        $cf $testdata/testoutput2 testtry        $cf $testdata/testoutput2 testtry
463        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
# Line 181  if [ $do2 = yes ] ; then Line 470  if [ $do2 = yes ] ; then
470        echo " "        echo " "
471        exit 1        exit 1
472      fi      fi
473      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi      if [ "$opt" = "-s" ] ; then echo "  OK with study"
474    done      elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
475        else echo "  OK"
476        fi
477      done
478  fi  fi
479    
480  # Locale-specific tests, provided that either the "fr_FR" or the "french"  # Locale-specific tests, provided that either the "fr_FR" or the "french"
481  # 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
482  # for Windows.  # for Windows. Another possibility is "fr", which needs to be run against
483    # the Windows-specific input and output files.
484    
485  if [ $do3 = yes ] ; then  if [ $do3 = yes ] ; then
486    locale -a | grep '^fr_FR$' >/dev/null    locale -a | grep '^fr_FR$' >/dev/null
# Line 196  if [ $do3 = yes ] ; then Line 489  if [ $do3 = yes ] ; then
489      infile=$testdata/testinput3      infile=$testdata/testinput3
490      outfile=$testdata/testoutput3      outfile=$testdata/testoutput3
491    else    else
492        infile=test3input
493        outfile=test3output
494      locale -a | grep '^french$' >/dev/null      locale -a | grep '^french$' >/dev/null
495      if [ $? -eq 0 ] ; then      if [ $? -eq 0 ] ; then
496        locale=french        locale=french
497        sed 's/fr_FR/french/' $testdata/testinput3 >test3input        sed 's/fr_FR/french/' $testdata/testinput3 >test3input
498        sed 's/fr_FR/french/' $testdata/testoutput3 >test3output        sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
       infile=test3input  
       outfile=test3output  
499      else      else
500        locale=        locale -a | grep '^fr$' >/dev/null
501          if [ $? -eq 0 ] ; then
502            locale=fr
503            sed 's/fr_FR/fr/' $testdata/wintestinput3 >test3input
504            sed 's/fr_FR/fr/' $testdata/wintestoutput3 >test3output
505          else
506            locale=
507          fi
508      fi      fi
509    fi    fi
510    
511    if [ "$locale" != "" ] ; then    if [ "$locale" != "" ] ; then
512      echo "Test 3: locale-specific features (using '$locale' locale)"      echo $title3 "(using '$locale' locale)"
513      for opt in "" "-s"; do      for opt in "" "-s" $jitopt; do
514        $valgrind ./pcretest -q $opt $infile testtry        $sim $valgrind ./pcretest -q $bmode $opt $infile testtry
515        if [ $? = 0 ] ; then        if [ $? = 0 ] ; then
516          $cf $outfile testtry          $cf $outfile testtry
517          if [ $? != 0 ] ; then          if [ $? != 0 ] ; then
# Line 219  if [ $do3 = yes ] ; then Line 519  if [ $do3 = yes ] ; then
519            echo "Locale test did not run entirely successfully."            echo "Locale test did not run entirely successfully."
520            echo "This usually means that there is a problem with the locale"            echo "This usually means that there is a problem with the locale"
521            echo "settings rather than a bug in PCRE."            echo "settings rather than a bug in PCRE."
522            break;            break;
523          else          else
524            if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi            if [ "$opt" = "-s" ] ; then echo "  OK with study"
525              elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
526              else echo "  OK"
527              fi
528          fi          fi
529        else exit 1        else exit 1
530        fi        fi
531      done      done
532    else    else
533      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"
534      echo "'french' locale exists, or the \"locale\" command is not available"      echo "'french' locales exist, or the \"locale\" command is not available"
535      echo "to check for them."      echo "to check for them."
536      echo " "      echo " "
537    fi    fi
538  fi  fi
539    
540  # Additional tests for UTF8 support  # Additional tests for UTF support
541    
542  if [ $do4 = yes ] ; then  if [ $do4 = yes ] ; then
543    echo "Test 4: UTF-8 support (Compatible with Perl >= 5.8)"    echo ${title4A}-${bits}${title4B}
544    for opt in "" "-s"; do    if [ $utf -eq 0 ] ; then
545      $valgrind ./pcretest -q $opt $testdata/testinput4 testtry      echo "  Skipped because UTF-$bits support is not available"
546      if [ $? = 0 ] ; then    else
547        $cf $testdata/testoutput4 testtry      for opt in "" "-s" $jitopt; do
548        if [ $? != 0 ] ; then exit 1; fi        $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput4 testtry
549      else exit 1        if [ $? = 0 ] ; then
550      fi          $cf $testdata/testoutput4 testtry
551      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi          if [ $? != 0 ] ; then exit 1; fi
552    done        else exit 1
553          fi
554          if [ "$opt" = "-s" ] ; then echo "  OK with study"
555          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
556          else echo "  OK"
557          fi
558        done
559      fi
560  fi  fi
561    
562  if [ $do5 = yes ] ; then  if [ $do5 = yes ] ; then
563    echo "Test 5: API, internals, and non-Perl stuff for UTF-8 support"    echo ${title5}-${bits} support
564    for opt in "" "-s"; do    if [ $utf -eq 0 ] ; then
565      $valgrind ./pcretest -q $opt $testdata/testinput5 testtry      echo "  Skipped because UTF-$bits support is not available"
566      else
567        for opt in "" "-s" $jitopt; do
568          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput5 testtry
569          if [ $? = 0 ] ; then
570            $cf $testdata/testoutput5 testtry
571            if [ $? != 0 ] ; then exit 1; fi
572          else exit 1
573          fi
574          if [ "$opt" = "-s" ] ; then echo "  OK with study"
575          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
576          else echo "  OK"
577          fi
578        done
579      fi
580    fi
581    
582    if [ $do6 = yes ] ; then
583      echo $title6
584      if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
585        echo "  Skipped because Unicode property support is not available"
586      else
587        for opt in "" "-s" $jitopt; do
588          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput6 testtry
589          if [ $? = 0 ] ; then
590            $cf $testdata/testoutput6 testtry
591            if [ $? != 0 ] ; then exit 1; fi
592          else exit 1
593          fi
594          if [ "$opt" = "-s" ] ; then echo "  OK with study"
595          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
596          else echo "  OK"
597          fi
598        done
599      fi
600    fi
601    
602    # Test non-Perl-compatible Unicode property support
603    
604    if [ $do7 = yes ] ; then
605      echo $title7
606      if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
607        echo "  Skipped because Unicode property support is not available"
608      else
609        for opt in "" "-s" $jitopt; do
610          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput7 testtry
611          if [ $? = 0 ] ; then
612            $cf $testdata/testoutput7 testtry
613            if [ $? != 0 ] ; then exit 1; fi
614          else exit 1
615          fi
616          if [ "$opt" = "-s" ] ; then echo "  OK with study"
617          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
618          else echo "  OK"
619          fi
620        done
621      fi
622    fi
623    
624    # Tests for DFA matching support
625    
626    if [ $do8 = yes ] ; then
627      echo $title8
628      for opt in "" "-s"; do
629        $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput8 testtry
630      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
631        $cf $testdata/testoutput5 testtry        $cf $testdata/testoutput8 testtry
632        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
633      else exit 1      else exit 1
634      fi      fi
635      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi      if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
636    done    done
637  fi  fi
638    
639  if [ $do6 = yes ] ; then  if [ $do9 = yes ] ; then
640    echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)"    echo ${title9}-${bits}
641    for opt in "" "-s"; do    if [ $utf -eq 0 ] ; then
642      $valgrind ./pcretest -q $opt $testdata/testinput6 testtry      echo "  Skipped because UTF-$bits support is not available"
643      else
644        for opt in "" "-s"; do
645          $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput9 testtry
646          if [ $? = 0 ] ; then
647            $cf $testdata/testoutput9 testtry
648            if [ $? != 0 ] ; then exit 1; fi
649          else exit 1
650          fi
651          if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
652        done
653      fi
654    fi
655    
656    if [ $do10 = yes ] ; then
657      echo $title10
658      if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
659        echo "  Skipped because Unicode property support is not available"
660      else
661        for opt in "" "-s"; do
662          $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput10 testtry
663          if [ $? = 0 ] ; then
664            $cf $testdata/testoutput10 testtry
665            if [ $? != 0 ] ; then exit 1; fi
666          else exit 1
667          fi
668          if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
669        done
670      fi
671    fi
672    
673    # Test of internal offsets and code sizes. This test is run only when there
674    # is Unicode property support and the link size is 2. The actual tests are
675    # mostly the same as in some of the above, but in this test we inspect some
676    # offsets and sizes that require a known link size. This is a doublecheck for
677    # the maintainer, just in case something changes unexpectely. The output from
678    # this test is not the same in 8-bit and 16-bit modes.
679    
680    if [ $do11 = yes ] ; then
681      echo $title11
682      if [ $link_size -ne 2 ] ; then
683        echo "  Skipped because link size is not 2"
684      elif [ $ucp -eq 0 ] ; then
685        echo "  Skipped because Unicode property support is not available"
686      else
687        for opt in "" "-s"; do
688          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput11 testtry
689          if [ $? = 0 ] ; then
690            $cf $testdata/testoutput11-$bits testtry
691            if [ $? != 0 ] ; then exit 1; fi
692          else exit 1
693          fi
694          if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
695        done
696      fi
697    fi
698    
699    # Test JIT-specific features when JIT is available
700    
701    if [ $do12 = yes ] ; then
702      echo $title12
703      if [ $jit -eq 0 ] ; then
704        echo "  Skipped because JIT is not available or not usable"
705      else
706        $sim $valgrind ./pcretest -q $bmode $testdata/testinput12 testtry
707      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
708        $cf $testdata/testoutput6 testtry        $cf $testdata/testoutput12 testtry
709        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
710      else exit 1      else exit 1
711      fi      fi
712      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi      echo "  OK"
713    done    fi
714  fi  fi
715    
716  # Tests for DFA matching support  # Test JIT-specific features when JIT is not available
717    
718  if [ $do7 = yes ] ; then  if [ $do13 = yes ] ; then
719    echo "Test 7: DFA matching"    echo $title13
720    for opt in "" "-s"; do    if [ $jit -ne 0 ] ; then
721      $valgrind ./pcretest -q $opt -dfa $testdata/testinput7 testtry      echo "  Skipped because JIT is available"
722      else
723        $sim $valgrind ./pcretest -q $bmode $testdata/testinput13 testtry
724      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
725        $cf $testdata/testoutput7 testtry        $cf $testdata/testoutput13 testtry
726        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
727      else exit 1      else exit 1
728      fi      fi
729      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi      echo "  OK"
730    done    fi
731  fi  fi
732    
733  if [ $do8 = yes ] ; then  # Tests for 8-bit-specific features
734    echo "Test 8: DFA matching with UTF-8"  
735    for opt in "" "-s"; do  if [ "$do14" = yes ] ; then
736      $valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry    echo $title14
737      if [ "$bits" = "16" -o "$bits" = "32" ] ; then
738        echo "  Skipped when running 16/32-bit tests"
739      else
740        cp -f $testdata/saved16 testsaved16
741        cp -f $testdata/saved32 testsaved32
742        for opt in "" "-s" $jitopt; do
743          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput14 testtry
744          if [ $? = 0 ] ; then
745            $cf $testdata/testoutput14 testtry
746            if [ $? != 0 ] ; then exit 1; fi
747          else exit 1
748          fi
749          if [ "$opt" = "-s" ] ; then echo "  OK with study"
750          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
751          else echo "  OK"
752          fi
753        done
754      fi
755    fi
756    
757    # Tests for 8-bit-specific features (needs UTF-8 support)
758    
759    if [ "$do15" = yes ] ; then
760      echo $title15
761      if [ "$bits" = "16" -o "$bits" = "32" ] ; then
762        echo "  Skipped when running 16/32-bit tests"
763      elif [ $utf -eq 0 ] ; then
764        echo "  Skipped because UTF-$bits support is not available"
765      else
766        for opt in "" "-s" $jitopt; do
767          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput15 testtry
768          if [ $? = 0 ] ; then
769            $cf $testdata/testoutput15 testtry
770            if [ $? != 0 ] ; then exit 1; fi
771          else exit 1
772          fi
773          if [ "$opt" = "-s" ] ; then echo "  OK with study"
774          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
775          else echo "  OK"
776          fi
777        done
778      fi
779    fi
780    
781    # Tests for 8-bit-specific features (Unicode property support)
782    
783    if [ $do16 = yes ] ; then
784      echo $title16
785      if [ "$bits" = "16" -o "$bits" = "32" ] ; then
786        echo "  Skipped when running 16/32-bit tests"
787      elif [ $ucp -eq 0 ] ; then
788        echo "  Skipped because Unicode property support is not available"
789      else
790        for opt in "" "-s" $jitopt; do
791          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput16 testtry
792          if [ $? = 0 ] ; then
793            $cf $testdata/testoutput16 testtry
794            if [ $? != 0 ] ; then exit 1; fi
795          else exit 1
796          fi
797          if [ "$opt" = "-s" ] ; then echo "  OK with study"
798          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
799          else echo "  OK"
800          fi
801        done
802      fi
803    fi
804    
805    # Tests for 16/32-bit-specific features
806    
807    if [ $do17 = yes ] ; then
808      echo $title17
809      if [ "$bits" = "8" ] ; then
810        echo "  Skipped when running 8-bit tests"
811      else
812        for opt in "" "-s" $jitopt; do
813          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput17 testtry
814          if [ $? = 0 ] ; then
815            $cf $testdata/testoutput17 testtry
816            if [ $? != 0 ] ; then exit 1; fi
817          else exit 1
818          fi
819          if [ "$opt" = "-s" ] ; then echo "  OK with study"
820          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
821          else echo "  OK"
822          fi
823        done
824      fi
825    fi
826    
827    # Tests for 16/32-bit-specific features (UTF-16/32 support)
828    
829    if [ $do18 = yes ] ; then
830      echo $title18
831      if [ "$bits" = "8" ] ; then
832        echo "  Skipped when running 8-bit tests"
833      elif [ $utf -eq 0 ] ; then
834        echo "  Skipped because UTF-$bits support is not available"
835      else
836        for opt in "" "-s" $jitopt; do
837          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput18 testtry
838          if [ $? = 0 ] ; then
839            $cf $testdata/testoutput18-$bits testtry
840            if [ $? != 0 ] ; then exit 1; fi
841          else exit 1
842          fi
843          if [ "$opt" = "-s" ] ; then echo "  OK with study"
844          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
845          else echo "  OK"
846          fi
847        done
848      fi
849    fi
850    
851    # Tests for 16/32-bit-specific features (Unicode property support)
852    
853    if [ $do19 = yes ] ; then
854      echo $title19
855      if [ "$bits" = "8" ] ; then
856        echo "  Skipped when running 8-bit tests"
857      elif [ $ucp -eq 0 ] ; then
858        echo "  Skipped because Unicode property support is not available"
859      else
860        for opt in "" "-s" $jitopt; do
861          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput19 testtry
862          if [ $? = 0 ] ; then
863            $cf $testdata/testoutput19 testtry
864            if [ $? != 0 ] ; then exit 1; fi
865          else exit 1
866          fi
867          if [ "$opt" = "-s" ] ; then echo "  OK with study"
868          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
869          else echo "  OK"
870          fi
871        done
872      fi
873    fi
874    
875    # Tests for 16/32-bit-specific features in DFA non-UTF-16 mode
876    
877    if [ $do20 = yes ] ; then
878      echo $title20
879      if [ "$bits" = "8" ] ; then
880        echo "  Skipped when running 8-bit tests"
881      else
882        for opt in "" "-s"; do
883          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput20 testtry
884          if [ $? = 0 ] ; then
885            $cf $testdata/testoutput20 testtry
886            if [ $? != 0 ] ; then exit 1; fi
887          else exit 1
888          fi
889          if [ "$opt" = "-s" ] ; then echo "  OK with study"
890          else echo "  OK"
891          fi
892        done
893      fi
894    fi
895    
896    # Tests for reloads with 16/32-bit library
897    
898    if [ $do21 = yes ] ; then
899      echo $title21
900      if [ "$bits" = "8" ] ; then
901        echo "  Skipped when running 8-bit tests"
902      elif [ $link_size -ne 2 ] ; then
903        echo "  Skipped because link size is not 2"
904      else
905        cp -f $testdata/saved8 testsaved8
906        cp -f $testdata/saved16LE-1 testsaved16LE-1
907        cp -f $testdata/saved16BE-1 testsaved16BE-1
908        cp -f $testdata/saved32LE-1 testsaved32LE-1
909        cp -f $testdata/saved32BE-1 testsaved32BE-1
910        $sim $valgrind ./pcretest -q $bmode $testdata/testinput21 testtry
911      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
912        $cf $testdata/testoutput8 testtry        $cf $testdata/testoutput21-$bits testtry
913        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
914      else exit 1      else exit 1
915      fi      fi
916      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi      echo "  OK"
917    done    fi
918  fi  fi
919    
920  if [ $do9 = yes ] ; then  # Tests for reloads with 16/32-bit library (UTF-16 support)
921    echo "Test 9: DFA matching with Unicode properties"  
922    for opt in "" "-s"; do  if [ $do22 = yes ] ; then
923      $valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry    echo $title22
924      if [ "$bits" = "8" ] ; then
925        echo "  Skipped when running 8-bit tests"
926      elif [ $utf -eq 0 ] ; then
927        echo "  Skipped because UTF-$bits support is not available"
928      elif [ $link_size -ne 2 ] ; then
929        echo "  Skipped because link size is not 2"
930      else
931        cp -f $testdata/saved16LE-2 testsaved16LE-2
932        cp -f $testdata/saved16BE-2 testsaved16BE-2
933        cp -f $testdata/saved32LE-2 testsaved32LE-2
934        cp -f $testdata/saved32BE-2 testsaved32BE-2
935        $sim $valgrind ./pcretest -q $bmode $testdata/testinput22 testtry
936      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
937        $cf $testdata/testoutput9 testtry        $cf $testdata/testoutput22-$bits testtry
938        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
939      else exit 1      else exit 1
940      fi      fi
941      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi      echo "  OK"
942    done    fi
943  fi  fi
944    
945  # Test of internal offsets and code sizes. This test is run only when there  if [ $do23 = yes ] ; then
946  # is Unicode property support and the link size is 2. The actual tests are    echo $title23
947  # mostly the same as in some of the above, but in this test we inspect some    if [ "$bits" = "8" -o "$bits" = "32" ] ; then
948  # offsets and sizes that require a known link size. This is a doublecheck for      echo "  Skipped when running 8/32-bit tests"
949  # the maintainer, just in case something changes unexpectely.    else
950        $sim $valgrind ./pcretest -q $bmode $testdata/testinput23 testtry
 if [ $do10 = yes ] ; then  
   echo "Test 10: Internal offsets and code size tests"  
   for opt in "" "-s"; do  
     $valgrind ./pcretest -q $opt $testdata/testinput10 testtry  
951      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
952        $cf $testdata/testoutput10 testtry        $cf $testdata/testoutput23 testtry
953        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
954      else exit 1      else exit 1
955      fi      fi
956      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi      echo "  OK"
957    done    fi
958  fi  fi
959    
960  # Test of Perl >= 5.10 features without UTF8 support  if [ $do24 = yes ] ; then
961      echo $title24
962  if [ $do11 = yes ] ; then    if [ "$bits" = "8" -o "$bits" = "32" ] ; then
963    echo "Test 11: Features from Perl >= 5.10 without UTF8 support"      echo "  Skipped when running 8/32-bit tests"
964    for opt in "" "-s"; do    elif [ $utf -eq 0 ] ; then
965      $valgrind ./pcretest -q $opt $testdata/testinput11 testtry      echo "  Skipped because UTF-$bits support is not available"
966      else
967        $sim $valgrind ./pcretest -q $bmode $testdata/testinput24 testtry
968      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
969        $cf $testdata/testoutput11 testtry        $cf $testdata/testoutput24 testtry
970        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
971      else exit 1      else exit 1
972      fi      fi
973      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi      echo "  OK"
974    done    fi
975  fi  fi
976    
977  # Test of Perl >= 5.10 features with UTF8 support  if [ $do25 = yes ] ; then
978      echo $title25
979  if [ $do12 = yes ] ; then    if [ "$bits" = "8" -o "$bits" = "16" ] ; then
980    echo "Test 12: Features from Perl >= 5.10 with UTF8 support"      echo "  Skipped when running 8/16-bit tests"
981    for opt in "" "-s"; do    else
982      $valgrind ./pcretest -q $opt $testdata/testinput12 testtry      $sim $valgrind ./pcretest -q $bmode $testdata/testinput25 testtry
983      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
984        $cf $testdata/testoutput12 testtry        $cf $testdata/testoutput25 testtry
985        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
986      else exit 1      else exit 1
987      fi      fi
988      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi      echo "  OK"
989    done    fi
990  fi  fi
991    
992  # Test non-Perl-compatible Unicode property support  if [ $do26 = yes ] ; then
993      echo $title26
994  if [ $do13 = yes ] ; then    if [ "$bits" = "8" -o "$bits" = "16" ] ; then
995    echo "Test 13: API, internals, and non-Perl stuff for Unicode property support"      echo "  Skipped when running 8/16-bit tests"
996    for opt in "" "-s"; do    elif [ $utf -eq 0 ] ; then
997      $valgrind ./pcretest -q $opt $testdata/testinput13 testtry      echo "  Skipped because UTF-$bits support is not available"
998      else
999        $sim $valgrind ./pcretest -q $bmode $testdata/testinput26 testtry
1000      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
1001        $cf $testdata/testoutput13 testtry        $cf $testdata/testoutput26 testtry
1002        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
1003      else exit 1      else exit 1
1004      fi      fi
1005      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi      echo "  OK"
1006    done    fi
1007  fi  fi
1008    
1009    # End of loop for 8/16/32-bit tests
1010    done
1011    
1012    # Clean up local working files
1013    rm -f test3input test3output testNinput testsaved* teststderr teststdout testtry
1014    
1015  # End  # End

Legend:
Removed from v.651  
changed lines
  Added in v.1200

  ViewVC Help
Powered by ViewVC 1.1.5