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

Diff of /code/trunk/RunTest

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

revision 339 by ph10, Sun Apr 13 15:14:34 2008 UTC revision 671 by ph10, Tue Aug 23 11:17:49 2011 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. 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  valgrind=  valgrind=
22    
# Line 31  utf8=$? Line 47  utf8=$?
47  ./pcretest -C | ./pcregrep 'No Unicode properties support' >/dev/null  ./pcretest -C | ./pcregrep 'No Unicode properties support' >/dev/null
48  ucp=$?  ucp=$?
49    
50    jitopt=
51    ./pcretest -C | ./pcregrep 'No Just-in-time compiler support' >/dev/null
52    jit=$?
53    if [ $jit -ne 0 ] ; then
54      jitopt=-s+
55    fi
56    
57  # Select which tests to run; for those that are explicitly requested, check  # Select which tests to run; for those that are explicitly requested, check
58  # that the necessary optional facilities are available.  # that the necessary optional facilities are available.
59    
# Line 44  do7=no Line 67  do7=no
67  do8=no  do8=no
68  do9=no  do9=no
69  do10=no  do10=no
70    do11=no
71    do12=no
72    do13=no
73    do14=no
74    do15=no
75    
76  while [ $# -gt 0 ] ; do  while [ $# -gt 0 ] ; do
77    case $1 in    case $1 in
# Line 57  while [ $# -gt 0 ] ; do Line 85  while [ $# -gt 0 ] ; do
85      8) do8=yes;;      8) do8=yes;;
86      9) do9=yes;;      9) do9=yes;;
87     10) do10=yes;;     10) do10=yes;;
88     valgrind) valgrind="valgrind -q";;     11) do11=yes;;
89       12) do12=yes;;
90       13) do13=yes;;
91       14) do14=yes;;
92       15) do15=yes;;
93       valgrind) valgrind="valgrind -q --smc-check=all";;
94      *) echo "Unknown test number $1"; exit 1;;      *) echo "Unknown test number $1"; exit 1;;
95    esac    esac
96    shift    shift
# Line 76  if [ $utf8 -eq 0 ] ; then Line 109  if [ $utf8 -eq 0 ] ; then
109      echo "Can't run test 8 because UTF-8 support is not configured"      echo "Can't run test 8 because UTF-8 support is not configured"
110      exit 1      exit 1
111    fi    fi
112      if [ $do12 = yes ] ; then
113        echo "Can't run test 12 because UTF-8 support is not configured"
114        exit 1
115      fi
116  fi  fi
117    
118  if [ $ucp -eq 0 ] ; then  if [ $ucp -eq 0 ] ; then
# Line 91  if [ $ucp -eq 0 ] ; then Line 128  if [ $ucp -eq 0 ] ; then
128      echo "Can't run test 10 because Unicode property support is not configured"      echo "Can't run test 10 because Unicode property support is not configured"
129      exit 1      exit 1
130    fi    fi
131      if [ $do13 = yes ] ; then
132        echo "Can't run test 12 because Unicode property support is not configured"
133        exit 1
134      fi
135  fi  fi
136    
137  if [ $link_size -ne 2 ] ; then  if [ $link_size -ne 2 ] ; then
# Line 100  if [ $link_size -ne 2 ] ; then Line 141  if [ $link_size -ne 2 ] ; then
141    fi    fi
142  fi  fi
143    
144  # If no specific tests were requested, select all that are relevant.  if [ $jit -eq 0 ] ; then
145      if [ $do14 = "yes" ] ; then
146        echo "Can't run test 14 because JIT support is not configured"
147        exit 1
148      fi
149    else
150      if [ $do15 = "yes" ] ; then
151        echo "Can't run test 15 because JIT support is configured"
152        exit 1
153      fi
154    fi
155    
156  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
157       $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \  # relevant will be skipped.
158       $do9 = no -a $do10 = no ] ; then  
159    if [ $do1  = no -a $do2  = no -a $do3  = no -a $do4  = no -a \
160         $do5  = no -a $do6  = no -a $do7  = no -a $do8  = no -a \
161         $do9  = no -a $do10 = no -a $do11 = no -a $do12 = no -a \
162         $do13 = no -a $do14 = no -a $do15 = no ] ; then
163    do1=yes    do1=yes
164    do2=yes    do2=yes
165    do3=yes    do3=yes
166    if [ $utf8 -ne 0 ] ; then do4=yes; fi    do4=yes
167    if [ $utf8 -ne 0 ] ; then do5=yes; fi    do5=yes
168    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do6=yes; fi    do6=yes
169    do7=yes    do7=yes
170    if [ $utf8 -ne 0 ] ; then do8=yes; fi    do8=yes
171    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi    do9=yes
172    if [ $link_size -eq 2 -a $ucp -ne 0 ] ; then do10=yes; fi    do10=yes
173      do11=yes
174      do12=yes
175      do13=yes
176      do14=yes
177      do15=yes
178  fi  fi
179    
180  # Show which release  # Show which release
# Line 123  echo "" Line 183  echo ""
183  echo PCRE C library tests  echo PCRE C library tests
184  ./pcretest /dev/null  ./pcretest /dev/null
185    
186  # Primary test, Perl-compatible  # Primary test, compatible with JIT and all versions of Perl >= 5.8
187    
188  if [ $do1 = yes ] ; then  if [ $do1 = yes ] ; then
189    echo "Test 1: main functionality (Perl compatible)"    echo "Test 1: main functionality (Compatible with Perl >= 5.8)"
190    $valgrind ./pcretest -q $testdata/testinput1 testtry    for opt in "" "-s" $jitopt; do
191    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt $testdata/testinput1 testtry
192      $cf $testdata/testoutput1 testtry      if [ $? = 0 ] ; then
193      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput1 testtry
194    else exit 1        if [ $? != 0 ] ; then exit 1; fi
195    fi      else exit 1
196    echo "OK"      fi
197        if [ "$opt" = "-s" ] ; then echo "  OK with study"
198        elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
199        else echo "  OK"
200        fi
201      done
202  fi  fi
203    
204  # PCRE tests that are not Perl-compatible - API & error tests, mostly  # PCRE tests that are not JIT or Perl-compatible: API, errors, internals
205    
206  if [ $do2 = yes ] ; then  if [ $do2 = yes ] ; then
207    echo "Test 2: API and error handling (not Perl compatible)"    echo "Test 2: API, errors, internals, and non-Perl stuff"
208    $valgrind ./pcretest -q $testdata/testinput2 testtry    for opt in "" "-s" $jitopt; do
209    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt $testdata/testinput2 testtry
210      $cf $testdata/testoutput2 testtry      if [ $? = 0 ] ; then
211      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput2 testtry
212    else exit 1        if [ $? != 0 ] ; then exit 1; fi
213    fi      else
214    echo "OK"        echo " "
215          echo "** Test 2 requires a lot of stack. If it has crashed with a"
216          echo "** segmentation fault, it may be that you do not have enough"
217          echo "** stack available by default. Please see the 'pcrestack' man"
218          echo "** page for a discussion of PCRE's stack usage."
219          echo " "
220          exit 1
221        fi
222        if [ "$opt" = "-s" ] ; then echo "  OK with study"
223        elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
224        else echo "  OK"
225        fi
226      done
227  fi  fi
228    
229  # Locale-specific tests, provided that either the "fr_FR" or the "french"  # Locale-specific tests, provided that either the "fr_FR" or the "french"
# Line 174  if [ $do3 = yes ] ; then Line 251  if [ $do3 = yes ] ; then
251    
252    if [ "$locale" != "" ] ; then    if [ "$locale" != "" ] ; then
253      echo "Test 3: locale-specific features (using '$locale' locale)"      echo "Test 3: locale-specific features (using '$locale' locale)"
254      $valgrind ./pcretest -q $infile testtry      for opt in "" "-s" $jitopt; do
255      if [ $? = 0 ] ; then        $valgrind ./pcretest -q $opt $infile testtry
256        $cf $outfile testtry        if [ $? = 0 ] ; then
257        if [ $? != 0 ] ; then          $cf $outfile testtry
258          echo " "          if [ $? != 0 ] ; then
259          echo "Locale test did not run entirely successfully."            echo " "
260          echo "This usually means that there is a problem with the locale"            echo "Locale test did not run entirely successfully."
261          echo "settings rather than a bug in PCRE."            echo "This usually means that there is a problem with the locale"
262        else            echo "settings rather than a bug in PCRE."
263        echo "OK"            break;
264            else
265              if [ "$opt" = "-s" ] ; then echo "  OK with study"
266              elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
267              else echo "  OK"
268              fi
269            fi
270          else exit 1
271        fi        fi
272      else exit 1      done
     fi  
273    else    else
274      echo "Cannot test locale-specific features - neither the 'fr_FR' nor the"      echo "Cannot test locale-specific features - neither the 'fr_FR' nor the"
275      echo "'french' locale exists, or the \"locale\" command is not available"      echo "'french' locale exists, or the \"locale\" command is not available"
# Line 198  fi Line 281  fi
281  # Additional tests for UTF8 support  # Additional tests for UTF8 support
282    
283  if [ $do4 = yes ] ; then  if [ $do4 = yes ] ; then
284    echo "Test 4: UTF-8 support (Perl compatible)"    echo "Test 4: UTF-8 support (Compatible with Perl >= 5.8)"
285    $valgrind ./pcretest -q $testdata/testinput4 testtry    if [ $utf8 -eq 0 ] ; then
286    if [ $? = 0 ] ; then      echo "  Skipped because UTF-8 support is not available"
287      $cf $testdata/testoutput4 testtry    else
288      if [ $? != 0 ] ; then exit 1; fi      for opt in "" "-s" $jitopt; do
289    else exit 1        $valgrind ./pcretest -q $opt $testdata/testinput4 testtry
290    fi        if [ $? = 0 ] ; then
291    echo "OK"          $cf $testdata/testoutput4 testtry
292            if [ $? != 0 ] ; then exit 1; fi
293          else exit 1
294          fi
295          if [ "$opt" = "-s" ] ; then echo "  OK with study"
296          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
297          else echo "  OK"
298          fi
299        done
300      fi
301  fi  fi
302    
303  if [ $do5 = yes ] ; then  if [ $do5 = yes ] ; then
304    echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"    echo "Test 5: API, internals, and non-Perl stuff for UTF-8 support"
305    $valgrind ./pcretest -q $testdata/testinput5 testtry    if [ $utf8 -eq 0 ] ; then
306    if [ $? = 0 ] ; then      echo "  Skipped because UTF-8 support is not available"
307      $cf $testdata/testoutput5 testtry    else
308      if [ $? != 0 ] ; then exit 1; fi      for opt in "" "-s" $jitopt; do
309    else exit 1        $valgrind ./pcretest -q $opt $testdata/testinput5 testtry
310    fi        if [ $? = 0 ] ; then
311    echo "OK"          $cf $testdata/testoutput5 testtry
312            if [ $? != 0 ] ; then exit 1; fi
313          else exit 1
314          fi
315          if [ "$opt" = "-s" ] ; then echo "  OK with study"
316          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
317          else echo "  OK"
318          fi
319        done
320      fi
321  fi  fi
322    
323  if [ $do6 = yes ] ; then  if [ $do6 = yes ] ; then
324    echo "Test 6: Unicode property support"    echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)"
325    $valgrind ./pcretest -q $testdata/testinput6 testtry    if [ $utf8 -eq 0 -o $ucp -eq 0 ] ; then
326    if [ $? = 0 ] ; then      echo "  Skipped because Unicode property support is not available"
327      $cf $testdata/testoutput6 testtry    else
328      if [ $? != 0 ] ; then exit 1; fi      for opt in "" "-s" $jitopt; do
329    else exit 1        $valgrind ./pcretest -q $opt $testdata/testinput6 testtry
330    fi        if [ $? = 0 ] ; then
331    echo "OK"          $cf $testdata/testoutput6 testtry
332            if [ $? != 0 ] ; then exit 1; fi
333          else exit 1
334          fi
335          if [ "$opt" = "-s" ] ; then echo "  OK with study"
336          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
337          else echo "  OK"
338          fi
339        done
340      fi
341  fi  fi
342    
343  # Tests for DFA matching support  # Tests for DFA matching support
344    
345  if [ $do7 = yes ] ; then  if [ $do7 = yes ] ; then
346    echo "Test 7: DFA matching"    echo "Test 7: DFA matching"
347    $valgrind ./pcretest -q -dfa $testdata/testinput7 testtry    for opt in "" "-s"; do
348    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt -dfa $testdata/testinput7 testtry
349      $cf $testdata/testoutput7 testtry      if [ $? = 0 ] ; then
350      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput7 testtry
351    else exit 1        if [ $? != 0 ] ; then exit 1; fi
352    fi      else exit 1
353    echo "OK"      fi
354        if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
355      done
356  fi  fi
357    
358  if [ $do8 = yes ] ; then  if [ $do8 = yes ] ; then
359    echo "Test 8: DFA matching with UTF-8"    echo "Test 8: DFA matching with UTF-8"
360    $valgrind ./pcretest -q -dfa $testdata/testinput8 testtry    if [ $utf8 -eq 0 ] ; then
361    if [ $? = 0 ] ; then      echo "  Skipped because UTF-8 support is not available"
362      $cf $testdata/testoutput8 testtry    else
363      if [ $? != 0 ] ; then exit 1; fi      for opt in "" "-s"; do
364    else exit 1        $valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry
365    fi        if [ $? = 0 ] ; then
366    echo "OK"          $cf $testdata/testoutput8 testtry
367            if [ $? != 0 ] ; then exit 1; fi
368          else exit 1
369          fi
370          if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
371        done
372      fi
373  fi  fi
374    
375  if [ $do9 = yes ] ; then  if [ $do9 = yes ] ; then
376    echo "Test 9: DFA matching with Unicode properties"    echo "Test 9: DFA matching with Unicode properties"
377    $valgrind ./pcretest -q -dfa $testdata/testinput9 testtry    if [ $utf8 -eq 0 -o $ucp -eq 0 ] ; then
378    if [ $? = 0 ] ; then      echo "  Skipped because Unicode property support is not available"
379      $cf $testdata/testoutput9 testtry    else
380      if [ $? != 0 ] ; then exit 1; fi      for opt in "" "-s"; do
381    else exit 1        $valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry
382    fi        if [ $? = 0 ] ; then
383    echo "OK"          $cf $testdata/testoutput9 testtry
384            if [ $? != 0 ] ; then exit 1; fi
385          else exit 1
386          fi
387          if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
388        done
389      fi
390  fi  fi
391    
392  # Test of internal offsets and code sizes. This test is run only when there  # Test of internal offsets and code sizes. This test is run only when there
# Line 273  fi Line 397  fi
397    
398  if [ $do10 = yes ] ; then  if [ $do10 = yes ] ; then
399    echo "Test 10: Internal offsets and code size tests"    echo "Test 10: Internal offsets and code size tests"
400    $valgrind ./pcretest -q $testdata/testinput10 testtry    if [ $link_size -ne 2 ] ; then
401    if [ $? = 0 ] ; then      echo "  Skipped because link size is not 2"
402      $cf $testdata/testoutput10 testtry    elif [ $ucp -eq 0 ] ; then
403      if [ $? != 0 ] ; then exit 1; fi      echo "  Skipped because Unicode property support is not available"
404    else exit 1    else
405    fi      for opt in "" "-s"; do
406    echo "OK"        $valgrind ./pcretest -q $opt $testdata/testinput10 testtry
407          if [ $? = 0 ] ; then
408            $cf $testdata/testoutput10 testtry
409            if [ $? != 0 ] ; then exit 1; fi
410          else exit 1
411          fi
412          if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
413        done
414      fi
415    fi
416    
417    # Test of Perl >= 5.10 features without UTF8 support
418    
419    if [ $do11 = yes ] ; then
420      echo "Test 11: Features from Perl >= 5.10 without UTF8 support"
421      for opt in "" "-s" $jitopt; do
422        $valgrind ./pcretest -q $opt $testdata/testinput11 testtry
423        if [ $? = 0 ] ; then
424          $cf $testdata/testoutput11 testtry
425          if [ $? != 0 ] ; then exit 1; fi
426        else exit 1
427        fi
428        if [ "$opt" = "-s" ] ; then echo "  OK with study"
429        elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
430        else echo "  OK"
431        fi
432      done
433    fi
434    
435    # Test of Perl >= 5.10 features with UTF8 support
436    
437    if [ $do12 = yes ] ; then
438      echo "Test 12: Features from Perl >= 5.10 with UTF8 support"
439      if [ $utf8 -eq 0 ] ; then
440        echo "  Skipped because UTF-8 support is not available"
441      else
442        for opt in "" "-s" $jitopt; do
443          $valgrind ./pcretest -q $opt $testdata/testinput12 testtry
444          if [ $? = 0 ] ; then
445            $cf $testdata/testoutput12 testtry
446            if [ $? != 0 ] ; then exit 1; fi
447          else exit 1
448          fi
449          if [ "$opt" = "-s" ] ; then echo "  OK with study"
450          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
451          else echo "  OK"
452          fi
453        done
454      fi
455    fi
456    
457    # Test non-Perl-compatible Unicode property support
458    
459    if [ $do13 = yes ] ; then
460      echo "Test 13: API, internals, and non-Perl stuff for Unicode property support"
461      if [ $utf8 -eq 0 -o $ucp -eq 0 ] ; then
462        echo "  Skipped because Unicode property support is not available"
463      else
464        for opt in "" "-s" $jitopt; do
465          $valgrind ./pcretest -q $opt $testdata/testinput13 testtry
466          if [ $? = 0 ] ; then
467            $cf $testdata/testoutput13 testtry
468            if [ $? != 0 ] ; then exit 1; fi
469          else exit 1
470          fi
471          if [ "$opt" = "-s" ] ; then echo "  OK with study"
472          elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
473          else echo "  OK"
474          fi
475        done
476      fi
477    fi
478    
479    # Test JIT-specific features when JIT is available
480    
481    if [ $do14 = yes ] ; then
482      echo "Test 14: JIT-specific features (JIT available)"
483      if [ $jit -eq 0 ] ; then
484        echo "  Skipped because JIT is not available"
485      else
486        $valgrind ./pcretest -q $testdata/testinput14 testtry
487        if [ $? = 0 ] ; then
488          $cf $testdata/testoutput14 testtry
489          if [ $? != 0 ] ; then exit 1; fi
490        else exit 1
491        fi
492        echo "  OK"
493      fi
494    fi
495    
496    # Test JIT-specific features when JIT is not available
497    
498    if [ $do15 = yes ] ; then
499      echo "Test 15: JIT-specific features (JIT not available)"
500      if [ $jit -ne 0 ] ; then
501        echo "  Skipped because JIT is available"
502      else
503        $valgrind ./pcretest -q $testdata/testinput15 testtry
504        if [ $? = 0 ] ; then
505          $cf $testdata/testoutput15 testtry
506          if [ $? != 0 ] ; then exit 1; fi
507        else exit 1
508        fi
509        echo "  OK"
510      fi
511  fi  fi
512    
513  # End  # End

Legend:
Removed from v.339  
changed lines
  Added in v.671

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12