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

Diff of /code/trunk/RunTest

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

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

Legend:
Removed from v.159  
changed lines
  Added in v.1251

  ViewVC Help
Powered by ViewVC 1.1.5