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

Diff of /code/trunk/RunTest

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

code/trunk/RunTest.in revision 81 by nigel, Sat Feb 24 21:40:59 2007 UTC code/trunk/RunTest revision 1123 by ph10, Wed Oct 17 18:06:16 2012 UTC
# Line 1  Line 1 
1  #! /bin/sh  #! /bin/sh
2    
3  # This file is generated by configure from RunTest.in. Make any changes  # Run the PCRE tests using the pcretest program. The appropriate tests are
4  # to that file.  # selected, depending on which build-time options were used.
5    #
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
103    # have a diff that lacks a -u option. Try to deal with this.
104    
105    cf="diff"
106    diff -u /dev/null /dev/null 2>/dev/null && cf="diff -u"
107    
108    # Find the test data
109    
110    if [ -n "$srcdir" -a -d "$srcdir" ] ; then
111      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
120    
121    
122    # ------ Special EBCDIC Test -------
123    
124  # Run PCRE tests  if [ $# -eq 1 -a "$1" = "ebcdic" ]; then
125      ./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      for opt in "" "-s" "-dfa" "-s -dfa"; do
133        ./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  cf=diff  exit 0
 if [ ! -d testdata ] ; then  
   ln -s @top_srcdir@/testdata testdata  
147  fi  fi
 testdata=./testdata  
148    
149  # Select which tests to run; if no selection, run all  
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
164    # that the necessary optional facilities are available.
165    
166  do1=no  do1=no
167  do2=no  do2=no
# Line 22  do6=no Line 172  do6=no
172  do7=no  do7=no
173  do8=no  do8=no
174  do9=no  do9=no
175    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 34  while [ $# -gt 0 ] ; do Line 201  while [ $# -gt 0 ] ; do
201      7) do7=yes;;      7) do7=yes;;
202      8) do8=yes;;      8) do8=yes;;
203      9) do9=yes;;      9) do9=yes;;
204      *) echo "Unknown test number $1"; exit 1;;     10) do10=yes;;
205       11) do11=yes;;
206       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 [ "@LINK_SIZE@" != "" -a "@LINK_SIZE@" != "-DLINK_SIZE=2" ] ; then  # Find which optional facilities are available.
232    if [ $do2 = yes ] ; then  
233      echo "Can't run test 2 with an internal link size other than 2"  $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
317        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 with an internal link size other than 2"      echo "Can't run test 5 because UTF support is not configured"
322      exit 1      exit 1
323    fi    fi
324    if [ $do6 = yes ] ; then    if [ $do9 = yes ] ; then
325      echo "Can't run test 6 with an internal link size other than 2"      echo "Can't run test 8 because UTF support is not configured"
326        exit 1
327      fi
328      if [ $do15 = yes ] ; then
329        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 [ "@UTF8@" = "" ] ; then  if [ $ucp -eq 0 ] ; then
341    if [ $do4 = yes ] ; then    if [ $do6 = yes ] ; then
342      echo "Can't run test 4 because UTF-8 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 [ $do5 = yes ] ; then    if [ $do7 = yes ] ; then
346      echo "Can't run test 5 because UTF-8 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 [ $do6 = yes ] ; then    if [ $do10 = yes ] ; then
350      echo "Can't run test 6 because UTF-8 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 [ $do8 = yes ] ; then    if [ $do16 = yes ] ; then
354      echo "Can't run test 8 because UTF-8 support is not configured"      echo "Can't run test 16 because Unicode property support is not configured"
355      exit 1      exit 1
356    fi    fi
357    if [ $do9 = yes ] ; then    if [ $do19 = yes ] ; then
358      echo "Can't run test 9 because UTF-8 support is not configured"      echo "Can't run test 19 because Unicode property support is not configured"
359      exit 1      exit 1
360    fi    fi
361  fi  fi
362    
363  if [ "@UCP@" = "" ] ; then  if [ $link_size -ne 2 ] ; then
364    if [ $do6 = yes ] ; then    if [ $do11 = yes ] ; then
365      echo "Can't run test 6 because Unicode property support is not configured"      echo "Can't run test 11 because the link size ($link_size) is not 2"
366      exit 1      exit 1
367    fi    fi
368    if [ $do9 = yes ] ; then  fi
369      echo "Can't run test 9 because Unicode property support is not configured"  
370    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      exit 1
379    fi    fi
380  fi  fi
381    
382  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
383       $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \  # relevant will be skipped.
384       $do9 = no ] ; then  
385    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 \
387         $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@" != "" ] ; then do4=yes; fi    do4=yes
396    if [ "@UTF8@" != "" ] ; then do5=yes; fi    do5=yes
397    if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do6=yes; fi    do6=yes
398    do7=yes    do7=yes
399    if [ "@UTF8@" != "" ] ; then do8=yes; fi    do8=yes
400    if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do9=yes; fi    do9=yes
401      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  ./pcretest /dev/null  echo ""
430    echo PCRE C library tests using test data from $testdata
431    $sim ./pcretest /dev/null
432    
433    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      # When testing 32-bit UTF mode with high bits masked, skip all non-UTF tests
446      # Since this is the last test, we can just set doN=no
447      if test "$bmode" = "-32+"; then
448        do1=no do2=no do3=no do8=no
449        do12=no do13=no do14=no do15=no do16=no do17=no
450        do20=no do21=no do23=no do24=no do25=no
451      fi
452    
453  # Primary test, Perl-compatible  # Primary test, compatible with JIT and all versions of Perl >= 5.8
454    
455  if [ $do1 = yes ] ; then  if [ $do1 = yes ] ; then
456    echo "Test 1: main functionality (Perl compatible)"    echo $title1
457    ./pcretest $testdata/testinput1 testtry    for opt in "" "-s" $jitopt; do
458    if [ $? = 0 ] ; then      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput1 testtry
459      $cf testtry $testdata/testoutput1      if [ $? = 0 ] ; then
460      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput1 testtry
461    else exit 1        if [ $? != 0 ] ; then exit 1; fi
462    fi      else exit 1
463    echo "OK"      fi
464    echo " "      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    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    echo $title2 "(not UTF-$bits)"
475      echo "Test 2: API and error handling (not Perl compatible)"    for opt in "" "-s" $jitopt; do
476      ./pcretest -i $testdata/testinput2 testtry      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput2 testtry
477      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
478        $cf testtry $testdata/testoutput2        $cf $testdata/testoutput2 testtry
479        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
480      else exit 1      else
481          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      fi
489      echo "OK"      if [ "$opt" = "-s" ] ; then echo "  OK with study"
490      echo " "      elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
491    else      else echo "  OK"
492      echo Test 2 skipped for link size other than 2 \(@LINK_SIZE@\)      fi
493      echo " "    done
   fi  
494  fi  fi
495    
496  # Locale-specific tests, provided the "fr_FR" locale is available  # 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
498    # 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
503    if [ $? -eq 0 ] ; then    if [ $? -eq 0 ] ; then
504      echo "Test 3: locale-specific features (using 'fr_FR' locale)"      locale=fr_FR
505      ./pcretest $testdata/testinput3 testtry      infile=$testdata/testinput3
506      if [ $? = 0 ] ; then      outfile=$testdata/testoutput3
507        $cf testtry $testdata/testoutput3    else
508        if [ $? != 0 ] ; then      infile=test3input
509          echo " "      outfile=test3output
510          echo "Locale test did not run entirely successfully."      locale -a | grep '^french$' >/dev/null
511          echo "This usually means that there is a problem with the locale"      if [ $? -eq 0 ] ; then
512          echo "settings rather than a bug in PCRE."        locale=french
513          sed 's/fr_FR/french/' $testdata/testinput3 >test3input
514          sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
515        else
516          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        else
522        echo "OK"          locale=
523        fi        fi
       echo " "  
     else exit 1  
524      fi      fi
525      fi
526    
527      if [ "$locale" != "" ] ; then
528        echo $title3 "(using '$locale' locale)"
529        for opt in "" "-s" $jitopt; do
530          $sim $valgrind ./pcretest -q $bmode $opt $infile testtry
531          if [ $? = 0 ] ; then
532            $cf $outfile testtry
533            if [ $? != 0 ] ; then
534              echo " "
535              echo "Locale test did not run entirely successfully."
536              echo "This usually means that there is a problem with the locale"
537              echo "settings rather than a bug in PCRE."
538              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
547        done
548    else    else
549      echo "Cannot test locale-specific features - 'fr_FR' locale not found,"      echo "Cannot test locale-specific features - none of the 'fr_FR', 'fr' or"
550      echo "or the \"locale\" command is not available to check for it."      echo "'french' locales exist, or the \"locale\" command is not available"
551        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    ./pcretest $testdata/testinput4 testtry    if [ $utf -eq 0 ] ; then
561    if [ $? = 0 ] ; then      echo "  Skipped because UTF-$bits support is not available"
562      $cf testtry $testdata/testoutput4    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"  
   echo " "  
576  fi  fi
577    
578  if [ $do5 = yes ] ; then  if [ $do5 = yes ] ; then
579    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    echo ${title5}-${bits} support
580      echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"    if [ $utf -eq 0 ] ; then
581      ./pcretest $testdata/testinput5 testtry      echo "  Skipped because UTF-$bits support is not available"
582      else
583        for opt in "" "-s" $jitopt; do
584          $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
596    fi
597    
598    if [ $do6 = yes ] ; then
599      echo $title6
600      if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
601        echo "  Skipped because Unicode property support is not available"
602      else
603        for opt in "" "-s" $jitopt; do
604          $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
616    fi
617    
618    # Test non-Perl-compatible Unicode property support
619    
620    if [ $do7 = yes ] ; then
621      echo $title7
622      if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
623        echo "  Skipped because Unicode property support is not available"
624      else
625        for opt in "" "-s" $jitopt; do
626          $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
638    fi
639    
640    # Tests for DFA matching support
641    
642    if [ $do8 = yes ] ; then
643      echo $title8
644      for opt in "" "-s"; do
645        $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput8 testtry
646      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
647        $cf testtry $testdata/testoutput5        $cf $testdata/testoutput8 testtry
648        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
649      else exit 1      else exit 1
650      fi      fi
651      echo "OK"      if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
652      echo " "    done
653    fi
654    
655    if [ $do9 = yes ] ; then
656      echo ${title9}-${bits}
657      if [ $utf -eq 0 ] ; then
658        echo "  Skipped because UTF-$bits support is not available"
659    else    else
660      echo Test 5 skipped for link size other than 2 \(@LINK_SIZE@\)      for opt in "" "-s"; do
661      echo " "        $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    fi
670  fi  fi
671    
672  if [ $do6 = yes ] ; then  if [ $do10 = yes ] ; then
673    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    echo $title10
674      echo "Test 6: Unicode property support"    if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
675      ./pcretest $testdata/testinput6 testtry      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
687    fi
688    
689    # 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
691    # 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
693    # 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 [ $do11 = yes ] ; then
697      echo $title11
698      if [ $link_size -ne 2 ] ; then
699        echo "  Skipped because link size is not 2"
700      elif [ $ucp -eq 0 ] ; then
701        echo "  Skipped because Unicode property support is not available"
702      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      if [ $? = 0 ] ; then
724        $cf testtry $testdata/testoutput6        $cf $testdata/testoutput12 testtry
725        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
726      else exit 1      else exit 1
727      fi      fi
728      echo "OK"      echo "  OK"
729      echo " "    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    else
739      echo Test 6 skipped for link size other than 2 \(@LINK_SIZE@\)      $sim $valgrind ./pcretest -q $bmode $testdata/testinput13 testtry
740      echo " "      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    fi
747  fi  fi
748    
749  # Tests for DFA matching support  # Tests for 8-bit-specific features
750    
751  if [ $do7 = yes ] ; then  if [ "$do14" = yes ] ; then
752    echo "Test 7: DFA matching"    echo $title14
753    ./pcretest -dfa $testdata/testinput7 testtry    if [ "$bits" = "16" -o "$bits" = "32" ] ; then
754    if [ $? = 0 ] ; then      echo "  Skipped when running 16/32-bit tests"
755      $cf testtry $testdata/testoutput7    else
756      if [ $? != 0 ] ; then exit 1; fi      cp -f $testdata/saved16 testsaved16
757    else exit 1      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    fi
   echo "OK"  
   echo " "  
771  fi  fi
772    
773  if [ $do8 = yes ] ; then  # Tests for 8-bit-specific features (needs UTF-8 support)
774    echo "Test 8: DFA matching with UTF-8"  
775    ./pcretest -dfa $testdata/testinput8 testtry  if [ "$do15" = yes ] ; then
776    if [ $? = 0 ] ; then    echo $title15
777      $cf testtry $testdata/testoutput8    if [ "$bits" = "16" -o "$bits" = "32" ] ; then
778      if [ $? != 0 ] ; then exit 1; fi      echo "  Skipped when running 16/32-bit tests"
779    else exit 1    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    fi
   echo "OK"  
   echo " "  
795  fi  fi
796    
797  if [ $do9 = yes ] ; then  # Tests for 8-bit-specific features (Unicode property support)
798    echo "Test 9: DFA matching with Unicode properties"  
799    ./pcretest -dfa $testdata/testinput9 testtry  if [ $do16 = yes ] ; then
800    if [ $? = 0 ] ; then    echo $title16
801      $cf testtry $testdata/testoutput9    if [ "$bits" = "16" -o "$bits" = "32" ] ; then
802      if [ $? != 0 ] ; then exit 1; fi      echo "  Skipped when running 16/32-bit tests"
803    else exit 1    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    fi
   echo "OK"  
   echo " "  
819  fi  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
841    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.81  
changed lines
  Added in v.1123

  ViewVC Help
Powered by ViewVC 1.1.5