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

Diff of /code/trunk/RunTest

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

revision 651 by ph10, Mon Aug 1 16:32:40 2011 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 the PCRE tests using the pcretest program. All tests are now run both  # Run the PCRE tests using the pcretest program. The appropriate tests are
4  # with and without -s, to ensure that everything is tested with and without  # selected, depending on which build-time options were used.
5  # studying. However, there are some tests that produce different output after  
6  # studying, typically when we are tracing the actual matching process (for  # All tests are now run both with and without -s, to ensure that everything is
7  # example, using auto-callouts). In these few cases, the tests are duplicated  # tested with and without studying. However, there are some tests that produce
8  # in the files, one with /S to force studying always, and one with /SS to force  # different output after studying, typically when we are tracing the actual
9  # *not* studying always. The use of -s doesn't then make any difference to  # matching process (for example, using auto-callouts). In these few cases, the
10  # their output. There is also one test which compiles invalid UTF-8 with the  # tests are duplicated in the files, one with /S to force studying always, and
11  # UTF-8 check turned off for which studying is disabled with /SS.  # 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 39  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 55  do10=no Line 76  do10=no
76  do11=no  do11=no
77  do12=no  do12=no
78  do13=no  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 70  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     13) do12=yes;;     13) do13=yes;;
97     valgrind) valgrind="valgrind -q";;     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 122  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 ] ; then do12=yes; fi    do12=yes
181    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do13=yes; fi    do13=yes
182      do14=yes
183      do15=yes
184  fi  fi
185    
186  # Show which release  # Show which release
# Line 148  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 all versions of Perl >= 5.8  # 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 (Compatible with Perl >= 5.8)"    echo "Test 1: main functionality (Compatible with Perl >= 5.8)"
196    for opt in "" "-s"; do    for opt in "" "-s" $jitopt; do
197      $valgrind ./pcretest -q $opt $testdata/testinput1 testtry      $valgrind ./pcretest -q $opt $testdata/testinput1 testtry
198      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
199        $cf $testdata/testoutput1 testtry        $cf $testdata/testoutput1 testtry
200        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
201      else exit 1      else exit 1
202      fi      fi
203      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi      if [ "$opt" = "-s" ] ; then echo "  OK with study"
204    done      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    for opt in "" "-s"; do    for opt in "" "-s" $jitopt; do
215      $valgrind ./pcretest -q $opt $testdata/testinput2 testtry      $valgrind ./pcretest -q $opt $testdata/testinput2 testtry
216      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
217        $cf $testdata/testoutput2 testtry        $cf $testdata/testoutput2 testtry
# Line 181  if [ $do2 = yes ] ; then Line 225  if [ $do2 = yes ] ; then
225        echo " "        echo " "
226        exit 1        exit 1
227      fi      fi
228      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi      if [ "$opt" = "-s" ] ; then echo "  OK with study"
229    done      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 210  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      for opt in "" "-s"; do      for opt in "" "-s" $jitopt; do
261        $valgrind ./pcretest -q $opt $infile testtry        $valgrind ./pcretest -q $opt $infile testtry
262        if [ $? = 0 ] ; then        if [ $? = 0 ] ; then
263          $cf $outfile testtry          $cf $outfile testtry
# Line 219  if [ $do3 = yes ] ; then Line 266  if [ $do3 = yes ] ; then
266            echo "Locale test did not run entirely successfully."            echo "Locale test did not run entirely successfully."
267            echo "This usually means that there is a problem with the locale"            echo "This usually means that there is a problem with the locale"
268            echo "settings rather than a bug in PCRE."            echo "settings rather than a bug in PCRE."
269            break;            break;
270          else          else
271            if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi            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          fi
276        else exit 1        else exit 1
277        fi        fi
278      done      done
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 238  fi Line 288  fi
288    
289  if [ $do4 = yes ] ; then  if [ $do4 = yes ] ; then
290    echo "Test 4: UTF-8 support (Compatible with Perl >= 5.8)"    echo "Test 4: UTF-8 support (Compatible with Perl >= 5.8)"
291    for opt in "" "-s"; do    if [ $utf8 -eq 0 ] ; then
292      $valgrind ./pcretest -q $opt $testdata/testinput4 testtry      echo "  Skipped because UTF-8 support is not available"
293      if [ $? = 0 ] ; then    else
294        $cf $testdata/testoutput4 testtry      for opt in "" "-s" $jitopt; do
295        if [ $? != 0 ] ; then exit 1; fi        $valgrind ./pcretest -q $opt $testdata/testinput4 testtry
296      else exit 1        if [ $? = 0 ] ; then
297      fi          $cf $testdata/testoutput4 testtry
298      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi          if [ $? != 0 ] ; then exit 1; fi
299    done        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
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    for opt in "" "-s"; do    if [ $utf8 -eq 0 ] ; then
312      $valgrind ./pcretest -q $opt $testdata/testinput5 testtry      echo "  Skipped because UTF-8 support is not available"
313      if [ $? = 0 ] ; then    else
314        $cf $testdata/testoutput5 testtry      for opt in "" "-s" $jitopt; do
315        if [ $? != 0 ] ; then exit 1; fi        $valgrind ./pcretest -q $opt $testdata/testinput5 testtry
316      else exit 1        if [ $? = 0 ] ; then
317      fi          $cf $testdata/testoutput5 testtry
318      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi          if [ $? != 0 ] ; then exit 1; fi
319    done        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
327  fi  fi
328    
329  if [ $do6 = yes ] ; then  if [ $do6 = yes ] ; then
330    echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)"    echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)"
331    for opt in "" "-s"; do    if [ $utf8 -eq 0 -o $ucp -eq 0 ] ; then
332      $valgrind ./pcretest -q $opt $testdata/testinput6 testtry      echo "  Skipped because Unicode property support is not available"
333      if [ $? = 0 ] ; then    else
334        $cf $testdata/testoutput6 testtry      for opt in "" "-s" $jitopt; do
335        if [ $? != 0 ] ; then exit 1; fi        $valgrind ./pcretest -q $opt $testdata/testinput6 testtry
336      else exit 1        if [ $? = 0 ] ; then
337      fi          $cf $testdata/testoutput6 testtry
338      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi          if [ $? != 0 ] ; then exit 1; fi
339    done        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
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    for opt in "" "-s"; do    for opt in "" "-s"; do
354      $valgrind ./pcretest -q $opt -dfa $testdata/testinput7 testtry      $valgrind ./pcretest -q $opt -dfa $testdata/testinput7 testtry
355      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
356        $cf $testdata/testoutput7 testtry        $cf $testdata/testoutput7 testtry
357        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
358      else exit 1      else exit 1
359      fi      fi
360      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi      if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
361    done    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    for opt in "" "-s"; do    if [ $utf8 -eq 0 ] ; then
367      $valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry      echo "  Skipped because UTF-8 support is not available"
368      if [ $? = 0 ] ; then    else
369        $cf $testdata/testoutput8 testtry      for opt in "" "-s"; do
370        if [ $? != 0 ] ; then exit 1; fi        $valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry
371      else exit 1        if [ $? = 0 ] ; then
372      fi          $cf $testdata/testoutput8 testtry
373      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi          if [ $? != 0 ] ; then exit 1; fi
374    done        else exit 1
375          fi
376          if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
377        done
378      fi
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    for opt in "" "-s"; do    if [ $utf8 -eq 0 -o $ucp -eq 0 ] ; then
384      $valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry      echo "  Skipped because Unicode property support is not available"
385      if [ $? = 0 ] ; then    else
386        $cf $testdata/testoutput9 testtry      for opt in "" "-s"; do
387        if [ $? != 0 ] ; then exit 1; fi        $valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry
388      else exit 1        if [ $? = 0 ] ; then
389      fi          $cf $testdata/testoutput9 testtry
390      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi          if [ $? != 0 ] ; then exit 1; fi
391    done        else exit 1
392          fi
393          if [ "$opt" = "-s" ] ; then echo "  OK with study" ; else echo "  OK"; fi
394        done
395      fi
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 324  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    for opt in "" "-s"; do    if [ $link_size -ne 2 ] ; then
407      $valgrind ./pcretest -q $opt $testdata/testinput10 testtry      echo "  Skipped because link size is not 2"
408      if [ $? = 0 ] ; then    elif [ $ucp -eq 0 ] ; then
409        $cf $testdata/testoutput10 testtry      echo "  Skipped because Unicode property support is not available"
410        if [ $? != 0 ] ; then exit 1; fi    else
411      else exit 1      for opt in "" "-s"; do
412      fi        $valgrind ./pcretest -q $opt $testdata/testinput10 testtry
413      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi        if [ $? = 0 ] ; then
414    done          $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
421  fi  fi
422    
423  # Test of Perl >= 5.10 features without UTF8 support  # Test of Perl >= 5.10 features without UTF8 support
424    
425  if [ $do11 = yes ] ; then  if [ $do11 = yes ] ; then
426    echo "Test 11: Features from Perl >= 5.10 without UTF8 support"    echo "Test 11: Features from Perl >= 5.10 without UTF8 support"
427    for opt in "" "-s"; do    for opt in "" "-s" $jitopt; do
428      $valgrind ./pcretest -q $opt $testdata/testinput11 testtry      $valgrind ./pcretest -q $opt $testdata/testinput11 testtry
429      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
430        $cf $testdata/testoutput11 testtry        $cf $testdata/testoutput11 testtry
431        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
432      else exit 1      else exit 1
433      fi      fi
434      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi      if [ "$opt" = "-s" ] ; then echo "  OK with study"
435    done      elif [ "$opt" = "-s+" ] ; then echo "  OK with JIT study"
436        else echo "  OK"
437        fi
438      done
439  fi  fi
440    
441  # Test of Perl >= 5.10 features with UTF8 support  # Test of Perl >= 5.10 features with UTF8 support
442    
443  if [ $do12 = yes ] ; then  if [ $do12 = yes ] ; then
444    echo "Test 12: Features from Perl >= 5.10 with UTF8 support"    echo "Test 12: Features from Perl >= 5.10 with UTF8 support"
445    for opt in "" "-s"; do    if [ $utf8 -eq 0 ] ; then
446      $valgrind ./pcretest -q $opt $testdata/testinput12 testtry      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
461    fi
462    
463    # Test non-Perl-compatible Unicode property support
464    
465    if [ $do13 = yes ] ; then
466      echo "Test 13: API, internals, and non-Perl stuff for Unicode property support"
467      if [ $utf8 -eq 0 -o $ucp -eq 0 ] ; then
468        echo "  Skipped because Unicode property support is not available"
469      else
470        for opt in "" "-s" $jitopt; do
471          $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      if [ $? = 0 ] ; then
494        $cf $testdata/testoutput12 testtry        $cf $testdata/testoutput14 testtry
495        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
496      else exit 1      else exit 1
497      fi      fi
498      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi      echo "  OK"
499    done    fi
500  fi  fi
501    
502  # Test non-Perl-compatible Unicode property support  # Test JIT-specific features when JIT is not available
503    
504  if [ $do13 = yes ] ; then  if [ $do15 = yes ] ; then
505    echo "Test 13: API, internals, and non-Perl stuff for Unicode property support"    echo "Test 15: JIT-specific features (JIT not available or not usable)"
506    for opt in "" "-s"; do    if [ $jit -ne 0 ] ; then
507      $valgrind ./pcretest -q $opt $testdata/testinput13 testtry      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      if [ $? = 0 ] ; then
513        $cf $testdata/testoutput13 testtry        $cf $testdata/testoutput15 testtry
514        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
515      else exit 1      else exit 1
516      fi      fi
517      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi      echo "  OK"
518    done    fi
519  fi  fi
520    
521  # End  # End

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

  ViewVC Help
Powered by ViewVC 1.1.5