/[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 1173 by chpe, Wed Oct 24 18:14:10 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", "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
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 -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 [ "@LINK_SIZE@" != "" -a "@LINK_SIZE@" != "-DLINK_SIZE=2" ] ; then  # Find which optional facilities are available.
233    if [ $do2 = yes ] ; then  
234      echo "Can't run test 2 with an internal link size other than 2"  $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
318        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 with an internal link size other than 2"      echo "Can't run test 5 because UTF support is not configured"
323      exit 1      exit 1
324    fi    fi
325    if [ $do6 = yes ] ; then    if [ $do9 = yes ] ; then
326      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"
327        exit 1
328      fi
329      if [ $do15 = yes ] ; then
330        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 [ "@UTF8@" = "" ] ; then  if [ $ucp -eq 0 ] ; then
342    if [ $do4 = yes ] ; then    if [ $do6 = yes ] ; then
343      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"
344      exit 1      exit 1
345    fi    fi
346    if [ $do5 = yes ] ; then    if [ $do7 = yes ] ; then
347      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"
348      exit 1      exit 1
349    fi    fi
350    if [ $do6 = yes ] ; then    if [ $do10 = yes ] ; then
351      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"
352      exit 1      exit 1
353    fi    fi
354    if [ $do8 = yes ] ; then    if [ $do16 = yes ] ; then
355      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"
356      exit 1      exit 1
357    fi    fi
358    if [ $do9 = yes ] ; then    if [ $do19 = yes ] ; then
359      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"
360      exit 1      exit 1
361    fi    fi
362  fi  fi
363    
364  if [ "@UCP@" = "" ] ; then  if [ $link_size -ne 2 ] ; then
365    if [ $do6 = yes ] ; then    if [ $do11 = yes ] ; then
366      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"
367      exit 1      exit 1
368    fi    fi
369    if [ $do9 = yes ] ; then  fi
370      echo "Can't run test 9 because Unicode property support is not configured"  
371    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      exit 1
380    fi    fi
381  fi  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 ] ; 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@" != "" ] ; then do4=yes; fi    do4=yes
397    if [ "@UTF8@" != "" ] ; then do5=yes; fi    do5=yes
398    if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do6=yes; fi    do6=yes
399    do7=yes    do7=yes
400    if [ "@UTF8@" != "" ] ; then do8=yes; fi    do8=yes
401    if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do9=yes; fi    do9=yes
402      do10=yes
403      do11=yes
404      do12=yes
405      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
420    
421    # Extra test round for testing 32-bit UTF mode with high bits set
422    if test "$test32" != "skip" -a $utf -eq 1; then
423      test32plus="-32+"
424    else
425      test32plus=skip
426  fi  fi
427    
428  # Show which release  # Show which release and which test data
429    
430  ./pcretest /dev/null  echo ""
431    echo PCRE C library tests using test data from $testdata
432    $sim ./pcretest /dev/null
433    
434    for bmode in "$test8" "$test16" "$test32" "$test32plus"; do
435      case "$bmode" in
436        skip) continue;;
437        -16)  if [ "$test8$test32" != "skipskip" ] ; then echo ""; fi
438              bits=16; echo "---- Testing 16-bit library ----"; echo "";;
439        -32)  if [ "$test8$test16" != "skipskip" ] ; then echo ""; fi
440              bits=32; echo "---- Testing 32-bit library ----"; echo "";;
441        -32+) echo ""
442              bits=32; echo "---- Testing 32-bit library UTF-32 mode with high bits set ----"; echo "";;
443        *)    bits=8; echo "---- Testing 8-bit library ----"; echo "";;
444      esac
445    
446      # When testing 32-bit UTF mode with high bits masked, skip all non-UTF tests
447      # Since this is the last test, we can just set doN=no
448      if test "$bmode" = "-32+"; then
449        do1=no do2=no do3=no do8=no
450        do12=no do13=no do14=no do15=no do16=no do17=no
451        do20=no do21=no do23=no do24=no do25=no
452      fi
453    
454  # Primary test, Perl-compatible  # Primary test, compatible with JIT and all versions of Perl >= 5.8
455    
456  if [ $do1 = yes ] ; then  if [ $do1 = yes ] ; then
457    echo "Test 1: main functionality (Perl compatible)"    echo $title1
458    ./pcretest $testdata/testinput1 testtry    for opt in "" "-s" $jitopt; do
459    if [ $? = 0 ] ; then      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput1 testtry
460      $cf testtry $testdata/testoutput1      if [ $? = 0 ] ; then
461      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput1 testtry
462    else exit 1        if [ $? != 0 ] ; then exit 1; fi
463    fi      else exit 1
464    echo "OK"      fi
465    echo " "      if [ "$opt" = "-s" ] ; then echo "  OK with study"
466        elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
467        else echo "  OK"
468        fi
469      done
470  fi  fi
471    
472  # PCRE tests that are not Perl-compatible - API & error tests, mostly  # PCRE tests that are not JIT or Perl-compatible: API, errors, internals
473    
474  if [ $do2 = yes ] ; then  if [ $do2 = yes ] ; then
475    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    echo $title2 "(not UTF-$bits)"
476      echo "Test 2: API and error handling (not Perl compatible)"    for opt in "" "-s" $jitopt; do
477      ./pcretest -i $testdata/testinput2 testtry      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput2 testtry
478      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
479        $cf testtry $testdata/testoutput2        $cf $testdata/testoutput2 testtry
480        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
481      else exit 1      else
482          echo " "
483          echo "** Test 2 requires a lot of stack. If it has crashed with a"
484          echo "** segmentation fault, it may be that you do not have enough"
485          echo "** stack available by default. Please see the 'pcrestack' man"
486          echo "** page for a discussion of PCRE's stack usage."
487          echo " "
488          exit 1
489      fi      fi
490      echo "OK"      if [ "$opt" = "-s" ] ; then echo "  OK with study"
491      echo " "      elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
492    else      else echo "  OK"
493      echo Test 2 skipped for link size other than 2 \(@LINK_SIZE@\)      fi
494      echo " "    done
   fi  
495  fi  fi
496    
497  # Locale-specific tests, provided the "fr_FR" locale is available  # Locale-specific tests, provided that either the "fr_FR" or the "french"
498    # locale is available. The former is the Unix-like standard; the latter is
499    # for Windows. Another possibility is "fr", which needs to be run against
500    # the Windows-specific input and output files.
501    
502  if [ $do3 = yes ] ; then  if [ $do3 = yes ] ; then
503    locale -a | grep '^fr_FR$' >/dev/null    locale -a | grep '^fr_FR$' >/dev/null
504    if [ $? -eq 0 ] ; then    if [ $? -eq 0 ] ; then
505      echo "Test 3: locale-specific features (using 'fr_FR' locale)"      locale=fr_FR
506      ./pcretest $testdata/testinput3 testtry      infile=$testdata/testinput3
507      if [ $? = 0 ] ; then      outfile=$testdata/testoutput3
508        $cf testtry $testdata/testoutput3    else
509        if [ $? != 0 ] ; then      infile=test3input
510          echo " "      outfile=test3output
511          echo "Locale test did not run entirely successfully."      locale -a | grep '^french$' >/dev/null
512          echo "This usually means that there is a problem with the locale"      if [ $? -eq 0 ] ; then
513          echo "settings rather than a bug in PCRE."        locale=french
514          sed 's/fr_FR/french/' $testdata/testinput3 >test3input
515          sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
516        else
517          locale -a | grep '^fr$' >/dev/null
518          if [ $? -eq 0 ] ; then
519            locale=fr
520            sed 's/fr_FR/fr/' $testdata/wintestinput3 >test3input
521            sed 's/fr_FR/fr/' $testdata/wintestoutput3 >test3output
522        else        else
523        echo "OK"          locale=
524        fi        fi
       echo " "  
     else exit 1  
525      fi      fi
526      fi
527    
528      if [ "$locale" != "" ] ; then
529        echo $title3 "(using '$locale' locale)"
530        for opt in "" "-s" $jitopt; do
531          $sim $valgrind ./pcretest -q $bmode $opt $infile testtry
532          if [ $? = 0 ] ; then
533            $cf $outfile testtry
534            if [ $? != 0 ] ; then
535              echo " "
536              echo "Locale test did not run entirely successfully."
537              echo "This usually means that there is a problem with the locale"
538              echo "settings rather than a bug in PCRE."
539              break;
540            else
541              if [ "$opt" = "-s" ] ; then echo "  OK with study"
542              elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
543              else echo "  OK"
544              fi
545            fi
546          else exit 1
547          fi
548        done
549    else    else
550      echo "Cannot test locale-specific features - 'fr_FR' locale not found,"      echo "Cannot test locale-specific features - none of the 'fr_FR', 'fr' or"
551      echo "or the \"locale\" command is not available to check for it."      echo "'french' locales exist, or the \"locale\" command is not available"
552        echo "to check for them."
553      echo " "      echo " "
554    fi    fi
555  fi  fi
556    
557  # Additional tests for UTF8 support  # Additional tests for UTF support
558    
559  if [ $do4 = yes ] ; then  if [ $do4 = yes ] ; then
560    echo "Test 4: UTF-8 support (Perl compatible)"    echo ${title4A}-${bits}${title4B}
561    ./pcretest $testdata/testinput4 testtry    if [ $utf -eq 0 ] ; then
562    if [ $? = 0 ] ; then      echo "  Skipped because UTF-$bits support is not available"
563      $cf testtry $testdata/testoutput4    else
564      if [ $? != 0 ] ; then exit 1; fi      for opt in "" "-s" $jitopt; do
565    else exit 1        $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput4 testtry
566          if [ $? = 0 ] ; then
567            $cf $testdata/testoutput4 testtry
568            if [ $? != 0 ] ; then exit 1; fi
569          else exit 1
570          fi
571          if [ "$opt" = "-s" ] ; then echo "  OK with study"
572          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
573          else echo "  OK"
574          fi
575        done
576    fi    fi
   echo "OK"  
   echo " "  
577  fi  fi
578    
579  if [ $do5 = yes ] ; then  if [ $do5 = yes ] ; then
580    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    echo ${title5}-${bits} support
581      echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"    if [ $utf -eq 0 ] ; then
582      ./pcretest $testdata/testinput5 testtry      echo "  Skipped because UTF-$bits support is not available"
583      else
584        for opt in "" "-s" $jitopt; do
585          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput5 testtry
586          if [ $? = 0 ] ; then
587            $cf $testdata/testoutput5 testtry
588            if [ $? != 0 ] ; then exit 1; fi
589          else exit 1
590          fi
591          if [ "$opt" = "-s" ] ; then echo "  OK with study"
592          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
593          else echo "  OK"
594          fi
595        done
596      fi
597    fi
598    
599    if [ $do6 = yes ] ; then
600      echo $title6
601      if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
602        echo "  Skipped because Unicode property support is not available"
603      else
604        for opt in "" "-s" $jitopt; do
605          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput6 testtry
606          if [ $? = 0 ] ; then
607            $cf $testdata/testoutput6 testtry
608            if [ $? != 0 ] ; then exit 1; fi
609          else exit 1
610          fi
611          if [ "$opt" = "-s" ] ; then echo "  OK with study"
612          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
613          else echo "  OK"
614          fi
615        done
616      fi
617    fi
618    
619    # Test non-Perl-compatible Unicode property support
620    
621    if [ $do7 = yes ] ; then
622      echo $title7
623      if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
624        echo "  Skipped because Unicode property support is not available"
625      else
626        for opt in "" "-s" $jitopt; do
627          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput7 testtry
628          if [ $? = 0 ] ; then
629            $cf $testdata/testoutput7 testtry
630            if [ $? != 0 ] ; then exit 1; fi
631          else exit 1
632          fi
633          if [ "$opt" = "-s" ] ; then echo "  OK with study"
634          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
635          else echo "  OK"
636          fi
637        done
638      fi
639    fi
640    
641    # Tests for DFA matching support
642    
643    if [ $do8 = yes ] ; then
644      echo $title8
645      for opt in "" "-s"; do
646        $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput8 testtry
647      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
648        $cf testtry $testdata/testoutput5        $cf $testdata/testoutput8 testtry
649        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
650      else exit 1      else exit 1
651      fi      fi
652      echo "OK"      if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
653      echo " "    done
654    fi
655    
656    if [ $do9 = yes ] ; then
657      echo ${title9}-${bits}
658      if [ $utf -eq 0 ] ; then
659        echo "  Skipped because UTF-$bits support is not available"
660    else    else
661      echo Test 5 skipped for link size other than 2 \(@LINK_SIZE@\)      for opt in "" "-s"; do
662      echo " "        $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput9 testtry
663          if [ $? = 0 ] ; then
664            $cf $testdata/testoutput9 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    fi
671  fi  fi
672    
673  if [ $do6 = yes ] ; then  if [ $do10 = yes ] ; then
674    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    echo $title10
675      echo "Test 6: Unicode property support"    if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
676      ./pcretest $testdata/testinput6 testtry      echo "  Skipped because Unicode property support is not available"
677      else
678        for opt in "" "-s"; do
679          $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput10 testtry
680          if [ $? = 0 ] ; then
681            $cf $testdata/testoutput10 testtry
682            if [ $? != 0 ] ; then exit 1; fi
683          else exit 1
684          fi
685          if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
686        done
687      fi
688    fi
689    
690    # Test of internal offsets and code sizes. This test is run only when there
691    # is Unicode property support and the link size is 2. The actual tests are
692    # mostly the same as in some of the above, but in this test we inspect some
693    # offsets and sizes that require a known link size. This is a doublecheck for
694    # the maintainer, just in case something changes unexpectely. The output from
695    # this test is not the same in 8-bit and 16-bit modes.
696    
697    if [ $do11 = yes ] ; then
698      echo $title11
699      if [ $link_size -ne 2 ] ; then
700        echo "  Skipped because link size is not 2"
701      elif [ $ucp -eq 0 ] ; then
702        echo "  Skipped because Unicode property support is not available"
703      else
704        for opt in "" "-s"; do
705          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput11 testtry
706          if [ $? = 0 ] ; then
707            $cf $testdata/testoutput11-$bits testtry
708            if [ $? != 0 ] ; then exit 1; fi
709          else exit 1
710          fi
711          if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
712        done
713      fi
714    fi
715    
716    # Test JIT-specific features when JIT is available
717    
718    if [ $do12 = yes ] ; then
719      echo $title12
720      if [ $jit -eq 0 ] ; then
721        echo "  Skipped because JIT is not available or not usable"
722      else
723        $sim $valgrind ./pcretest -q $bmode $testdata/testinput12 testtry
724      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
725        $cf testtry $testdata/testoutput6        $cf $testdata/testoutput12 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      echo "OK"      echo "  OK"
730      echo " "    fi
731    fi
732    
733    # Test JIT-specific features when JIT is not available
734    
735    if [ $do13 = yes ] ; then
736      echo $title13
737      if [ $jit -ne 0 ] ; then
738        echo "  Skipped because JIT is available"
739    else    else
740      echo Test 6 skipped for link size other than 2 \(@LINK_SIZE@\)      $sim $valgrind ./pcretest -q $bmode $testdata/testinput13 testtry
741      echo " "      if [ $? = 0 ] ; then
742          $cf $testdata/testoutput13 testtry
743          if [ $? != 0 ] ; then exit 1; fi
744        else exit 1
745        fi
746        echo "  OK"
747    fi    fi
748  fi  fi
749    
750  # Tests for DFA matching support  # Tests for 8-bit-specific features
751    
752  if [ $do7 = yes ] ; then  if [ "$do14" = yes ] ; then
753    echo "Test 7: DFA matching"    echo $title14
754    ./pcretest -dfa $testdata/testinput7 testtry    if [ "$bits" = "16" -o "$bits" = "32" ] ; then
755    if [ $? = 0 ] ; then      echo "  Skipped when running 16/32-bit tests"
756      $cf testtry $testdata/testoutput7    else
757      if [ $? != 0 ] ; then exit 1; fi      cp -f $testdata/saved16 testsaved16
758    else exit 1      cp -f $testdata/saved32 testsaved32
759        for opt in "" "-s" $jitopt; do
760          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput14 testtry
761          if [ $? = 0 ] ; then
762            $cf $testdata/testoutput14 testtry
763            if [ $? != 0 ] ; then exit 1; fi
764          else exit 1
765          fi
766          if [ "$opt" = "-s" ] ; then echo "  OK with study"
767          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
768          else echo "  OK"
769          fi
770        done
771    fi    fi
   echo "OK"  
   echo " "  
772  fi  fi
773    
774  if [ $do8 = yes ] ; then  # Tests for 8-bit-specific features (needs UTF-8 support)
775    echo "Test 8: DFA matching with UTF-8"  
776    ./pcretest -dfa $testdata/testinput8 testtry  if [ "$do15" = yes ] ; then
777    if [ $? = 0 ] ; then    echo $title15
778      $cf testtry $testdata/testoutput8    if [ "$bits" = "16" -o "$bits" = "32" ] ; then
779      if [ $? != 0 ] ; then exit 1; fi      echo "  Skipped when running 16/32-bit tests"
780    else exit 1    elif [ $utf -eq 0 ] ; then
781        echo "  Skipped because UTF-$bits support is not available"
782      else
783        for opt in "" "-s" $jitopt; do
784          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput15 testtry
785          if [ $? = 0 ] ; then
786            $cf $testdata/testoutput15 testtry
787            if [ $? != 0 ] ; then exit 1; fi
788          else exit 1
789          fi
790          if [ "$opt" = "-s" ] ; then echo "  OK with study"
791          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
792          else echo "  OK"
793          fi
794        done
795    fi    fi
   echo "OK"  
   echo " "  
796  fi  fi
797    
798  if [ $do9 = yes ] ; then  # Tests for 8-bit-specific features (Unicode property support)
799    echo "Test 9: DFA matching with Unicode properties"  
800    ./pcretest -dfa $testdata/testinput9 testtry  if [ $do16 = yes ] ; then
801    if [ $? = 0 ] ; then    echo $title16
802      $cf testtry $testdata/testoutput9    if [ "$bits" = "16" -o "$bits" = "32" ] ; then
803      if [ $? != 0 ] ; then exit 1; fi      echo "  Skipped when running 16/32-bit tests"
804    else exit 1    elif [ $ucp -eq 0 ] ; then
805        echo "  Skipped because Unicode property support is not available"
806      else
807        for opt in "" "-s" $jitopt; do
808          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput16 testtry
809          if [ $? = 0 ] ; then
810            $cf $testdata/testoutput16 testtry
811            if [ $? != 0 ] ; then exit 1; fi
812          else exit 1
813          fi
814          if [ "$opt" = "-s" ] ; then echo "  OK with study"
815          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
816          else echo "  OK"
817          fi
818        done
819    fi    fi
   echo "OK"  
   echo " "  
820  fi  fi
821    
822    # Tests for 16/32-bit-specific features
823    
824    if [ $do17 = yes ] ; then
825      echo $title17
826      if [ "$bits" = "8" ] ; then
827        echo "  Skipped when running 8-bit tests"
828      else
829        for opt in "" "-s" $jitopt; do
830          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput17 testtry
831          if [ $? = 0 ] ; then
832            $cf $testdata/testoutput17 testtry
833            if [ $? != 0 ] ; then exit 1; fi
834          else exit 1
835          fi
836          if [ "$opt" = "-s" ] ; then echo "  OK with study"
837          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
838          else echo "  OK"
839          fi
840        done
841      fi
842    fi
843    
844    # Tests for 16/32-bit-specific features (UTF-16/32 support)
845    
846    if [ $do18 = yes ] ; then
847      echo $title18
848      if [ "$bits" = "8" ] ; then
849        echo "  Skipped when running 8-bit tests"
850      elif [ $utf -eq 0 ] ; then
851        echo "  Skipped because UTF-$bits support is not available"
852      else
853        for opt in "" "-s" $jitopt; do
854          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput18 testtry
855          if [ $? = 0 ] ; then
856            $cf $testdata/testoutput18-$bits testtry
857            if [ $? != 0 ] ; then exit 1; fi
858          else exit 1
859          fi
860          if [ "$opt" = "-s" ] ; then echo "  OK with study"
861          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
862          else echo "  OK"
863          fi
864        done
865      fi
866    fi
867    
868    # Tests for 16/32-bit-specific features (Unicode property support)
869    
870    if [ $do19 = yes ] ; then
871      echo $title19
872      if [ "$bits" = "8" ] ; then
873        echo "  Skipped when running 8-bit tests"
874      elif [ $ucp -eq 0 ] ; then
875        echo "  Skipped because Unicode property support is not available"
876      else
877        for opt in "" "-s" $jitopt; do
878          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput19 testtry
879          if [ $? = 0 ] ; then
880            $cf $testdata/testoutput19 testtry
881            if [ $? != 0 ] ; then exit 1; fi
882          else exit 1
883          fi
884          if [ "$opt" = "-s" ] ; then echo "  OK with study"
885          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
886          else echo "  OK"
887          fi
888        done
889      fi
890    fi
891    
892    # Tests for 16/32-bit-specific features in DFA non-UTF-16 mode
893    
894    if [ $do20 = yes ] ; then
895      echo $title20
896      if [ "$bits" = "8" ] ; then
897        echo "  Skipped when running 8-bit tests"
898      else
899        for opt in "" "-s"; do
900          $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput20 testtry
901          if [ $? = 0 ] ; then
902            $cf $testdata/testoutput20 testtry
903            if [ $? != 0 ] ; then exit 1; fi
904          else exit 1
905          fi
906          if [ "$opt" = "-s" ] ; then echo "  OK with study"
907          else echo "  OK"
908          fi
909        done
910      fi
911    fi
912    
913    # Tests for reloads with 16/32-bit library
914    
915    if [ $do21 = yes ] ; then
916      echo $title21
917      if [ "$bits" = "8" ] ; then
918        echo "  Skipped when running 8-bit tests"
919      elif [ $link_size -ne 2 ] ; then
920        echo "  Skipped because link size is not 2"
921      else
922        cp -f $testdata/saved8 testsaved8
923        cp -f $testdata/saved16LE-1 testsaved16LE-1
924        cp -f $testdata/saved16BE-1 testsaved16BE-1
925        cp -f $testdata/saved32LE-1 testsaved32LE-1
926        cp -f $testdata/saved32BE-1 testsaved32BE-1
927        $sim $valgrind ./pcretest -q $bmode $testdata/testinput21 testtry
928        if [ $? = 0 ] ; then
929          $cf $testdata/testoutput21-$bits testtry
930          if [ $? != 0 ] ; then exit 1; fi
931        else exit 1
932        fi
933        echo "  OK"
934      fi
935    fi
936    
937    # Tests for reloads with 16/32-bit library (UTF-16 support)
938    
939    if [ $do22 = yes ] ; then
940      echo $title22
941      if [ "$bits" = "8" ] ; then
942        echo "  Skipped when running 8-bit tests"
943      elif [ $utf -eq 0 ] ; then
944        echo "  Skipped because UTF-$bits support is not available"
945      elif [ $link_size -ne 2 ] ; then
946        echo "  Skipped because link size is not 2"
947      else
948        cp -f $testdata/saved16LE-2 testsaved16LE-2
949        cp -f $testdata/saved16BE-2 testsaved16BE-2
950        cp -f $testdata/saved32LE-2 testsaved32LE-2
951        cp -f $testdata/saved32BE-2 testsaved32BE-2
952        $sim $valgrind ./pcretest -q $bmode $testdata/testinput22 testtry
953        if [ $? = 0 ] ; then
954          $cf $testdata/testoutput22-$bits testtry
955          if [ $? != 0 ] ; then exit 1; fi
956        else exit 1
957        fi
958        echo "  OK"
959      fi
960    fi
961    
962    if [ $do23 = yes ] ; then
963      echo $title23
964      if [ "$bits" = "8" -o "$bits" = "32" ] ; then
965        echo "  Skipped when running 8/32-bit tests"
966      else
967        $sim $valgrind ./pcretest -q $bmode $testdata/testinput23 testtry
968        if [ $? = 0 ] ; then
969          $cf $testdata/testoutput23 testtry
970          if [ $? != 0 ] ; then exit 1; fi
971        else exit 1
972        fi
973        echo "  OK"
974      fi
975    fi
976    
977    if [ $do24 = yes ] ; then
978      echo $title24
979      if [ "$bits" = "8" -o "$bits" = "32" ] ; then
980        echo "  Skipped when running 8/32-bit tests"
981      elif [ $utf -eq 0 ] ; then
982        echo "  Skipped because UTF-$bits support is not available"
983      else
984        $sim $valgrind ./pcretest -q $bmode $testdata/testinput24 testtry
985        if [ $? = 0 ] ; then
986          $cf $testdata/testoutput24 testtry
987          if [ $? != 0 ] ; then exit 1; fi
988        else exit 1
989        fi
990        echo "  OK"
991      fi
992    fi
993    
994    if [ $do25 = yes ] ; then
995      echo $title25
996      if [ "$bits" = "8" -o "$bits" = "16" ] ; then
997        echo "  Skipped when running 8/16-bit tests"
998      else
999        $sim $valgrind ./pcretest -q $bmode $testdata/testinput25 testtry
1000        if [ $? = 0 ] ; then
1001          $cf $testdata/testoutput25 testtry
1002          if [ $? != 0 ] ; then exit 1; fi
1003        else exit 1
1004        fi
1005        echo "  OK"
1006      fi
1007    fi
1008    
1009    if [ $do26 = yes ] ; then
1010      echo $title26
1011      if [ "$bits" = "8" -o "$bits" = "16" ] ; then
1012        echo "  Skipped when running 8/16-bit tests"
1013      elif [ $utf -eq 0 ] ; then
1014        echo "  Skipped because UTF-$bits support is not available"
1015      else
1016        $sim $valgrind ./pcretest -q $bmode $testdata/testinput26 testtry
1017        if [ $? = 0 ] ; then
1018          $cf $testdata/testoutput26 testtry
1019          if [ $? != 0 ] ; then exit 1; fi
1020        else exit 1
1021        fi
1022        echo "  OK"
1023      fi
1024    fi
1025    
1026    # End of loop for 8/16/32-bit tests
1027    done
1028    
1029    # Clean up local working files
1030    rm -f test3input test3output testNinput testsaved* teststderr teststdout testtry
1031    
1032  # End  # End

Legend:
Removed from v.81  
changed lines
  Added in v.1173

  ViewVC Help
Powered by ViewVC 1.1.5