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

Diff of /code/trunk/RunTest

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

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

Legend:
Removed from v.507  
changed lines
  Added in v.674

  ViewVC Help
Powered by ViewVC 1.1.5