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

Diff of /code/trunk/RunTest

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

revision 173 by ph10, Tue Jun 5 11:17:10 2007 UTC revision 666 by ph10, Mon Aug 22 14:56:43 2011 UTC
# Line 1  Line 1 
1  #! /bin/sh  #! /bin/sh
2    
3  # Run PCRE tests  # Run the PCRE tests using the pcretest program. All tests are now run both
4    # with and without -s, to ensure that everything is tested with and without
5    # studying. However, there are some tests that produce different output after
6    # studying, typically when we are tracing the actual matching process (for
7    # example, using auto-callouts). In these few cases, the tests are duplicated
8    # in the files, one with /S to force studying always, and one with /SS to force
9    # *not* studying always. The use of -s doesn't then make any difference to
10    # their output. There is also one test which compiles invalid UTF-8 with the
11    # UTF-8 check turned off for which studying is disabled with /SS.
12    
 cf="diff -u"  
13  valgrind=  valgrind=
 testdata=testdata  
14    
15    # Set up a suitable "diff" command for comparison. Some systems
16    # have a diff that lacks a -u option. Try to deal with this.
17    
18    if diff -u /dev/null /dev/null; then cf="diff -u"; else cf="diff"; fi
19    
20    # Find the test data
21    
22    testdata=testdata
23  if [ -n "$srcdir" -a -d "$srcdir" ] ; then  if [ -n "$srcdir" -a -d "$srcdir" ] ; then
24    testdata="$srcdir/testdata"    testdata="$srcdir/testdata"
25  fi  fi
# Line 25  utf8=$? Line 39  utf8=$?
39  ./pcretest -C | ./pcregrep 'No Unicode properties support' >/dev/null  ./pcretest -C | ./pcregrep 'No Unicode properties support' >/dev/null
40  ucp=$?  ucp=$?
41    
42    jitopt=
43    ./pcretest -C | ./pcregrep 'No Just-in-time compiler support' >/dev/null
44    jit=$?
45    if [ $jit -ne 0 ] ; then
46      jitopt=-s+
47    fi
48    
49  # Select which tests to run; for those that are explicitly requested, check  # Select which tests to run; for those that are explicitly requested, check
50  # that the necessary optional facilities are available.  # that the necessary optional facilities are available.
51    
# Line 38  do7=no Line 59  do7=no
59  do8=no  do8=no
60  do9=no  do9=no
61  do10=no  do10=no
62    do11=no
63    do12=no
64    do13=no
65    
66  while [ $# -gt 0 ] ; do  while [ $# -gt 0 ] ; do
67    case $1 in    case $1 in
# Line 51  while [ $# -gt 0 ] ; do Line 75  while [ $# -gt 0 ] ; do
75      8) do8=yes;;      8) do8=yes;;
76      9) do9=yes;;      9) do9=yes;;
77     10) do10=yes;;     10) do10=yes;;
78     valgrind) valgrind="valgrind -q";;     11) do11=yes;;
79       12) do12=yes;;
80       13) do13=yes;;
81       valgrind) valgrind="valgrind -q --smc-check=all";;
82      *) echo "Unknown test number $1"; exit 1;;      *) echo "Unknown test number $1"; exit 1;;
83    esac    esac
84    shift    shift
# Line 70  if [ $utf8 -eq 0 ] ; then Line 97  if [ $utf8 -eq 0 ] ; then
97      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"
98      exit 1      exit 1
99    fi    fi
100      if [ $do12 = yes ] ; then
101        echo "Can't run test 12 because UTF-8 support is not configured"
102        exit 1
103      fi
104  fi  fi
105    
106  if [ $ucp -eq 0 ] ; then  if [ $ucp -eq 0 ] ; then
# Line 85  if [ $ucp -eq 0 ] ; then Line 116  if [ $ucp -eq 0 ] ; then
116      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"
117      exit 1      exit 1
118    fi    fi
119      if [ $do13 = yes ] ; then
120        echo "Can't run test 12 because Unicode property support is not configured"
121        exit 1
122      fi
123  fi  fi
124    
125  if [ $link_size -ne 2 ] ; then  if [ $link_size -ne 2 ] ; then
# Line 98  fi Line 133  fi
133    
134  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 \
135       $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \       $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
136       $do9 = no -a $do10 = no ] ; then       $do9 = no -a $do10 = no -a $do11 = no -a $do12 = no -a \
137         $do13 = no ] ; then
138    do1=yes    do1=yes
139    do2=yes    do2=yes
140    do3=yes    do3=yes
# Line 109  if [ $do1 = no -a $do2 = no -a $do3 = no Line 145  if [ $do1 = no -a $do2 = no -a $do3 = no
145    if [ $utf8 -ne 0 ] ; then do8=yes; fi    if [ $utf8 -ne 0 ] ; then do8=yes; fi
146    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi
147    if [ $link_size -eq 2 -a $ucp -ne 0 ] ; then do10=yes; fi    if [ $link_size -eq 2 -a $ucp -ne 0 ] ; then do10=yes; fi
148      do11=yes
149      if [ $utf8 -ne 0 ] ; then do12=yes; fi
150      if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do13=yes; fi
151  fi  fi
152    
153  # Show which release  # Show which release
# Line 117  echo "" Line 156  echo ""
156  echo PCRE C library tests  echo PCRE C library tests
157  ./pcretest /dev/null  ./pcretest /dev/null
158    
159  # Primary test, Perl-compatible  # Primary test, compatible with JIT and all versions of Perl >= 5.8
160    
161  if [ $do1 = yes ] ; then  if [ $do1 = yes ] ; then
162    echo "Test 1: main functionality (Perl compatible)"    echo "Test 1: main functionality (Compatible with Perl >= 5.8)"
163    $valgrind ./pcretest -q $testdata/testinput1 testtry    for opt in "" "-s" $jitopt; do
164    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt $testdata/testinput1 testtry
165      $cf $testdata/testoutput1 testtry      if [ $? = 0 ] ; then
166      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput1 testtry
167    else exit 1        if [ $? != 0 ] ; then exit 1; fi
168    fi      else exit 1
169    echo "OK"      fi
170        if [ "$opt" = "-s" ] ; then echo "OK with study"
171        elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
172        else echo "OK"
173        fi
174      done
175  fi  fi
176    
177  # PCRE tests that are not Perl-compatible - API & error tests, mostly  # PCRE tests that are not JIT or Perl-compatible: API, errors, internals
178    
179  if [ $do2 = yes ] ; then  if [ $do2 = yes ] ; then
180    echo "Test 2: API and error handling (not Perl compatible)"    echo "Test 2: API, errors, internals, and non-Perl stuff"
181    $valgrind ./pcretest -q $testdata/testinput2 testtry    for opt in "" "-s" $jitopt; do
182    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt $testdata/testinput2 testtry
183      $cf $testdata/testoutput2 testtry      if [ $? = 0 ] ; then
184      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput2 testtry
185    else exit 1        if [ $? != 0 ] ; then exit 1; fi
186    fi      else
187    echo "OK"        echo " "
188          echo "** Test 2 requires a lot of stack. If it has crashed with a"
189          echo "** segmentation fault, it may be that you do not have enough"
190          echo "** stack available by default. Please see the 'pcrestack' man"
191          echo "** page for a discussion of PCRE's stack usage."
192          echo " "
193          exit 1
194        fi
195        if [ "$opt" = "-s" ] ; then echo "OK with study"
196        elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
197        else echo "OK"
198        fi
199      done
200  fi  fi
201    
202  # 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 168  if [ $do3 = yes ] ; then Line 224  if [ $do3 = yes ] ; then
224    
225    if [ "$locale" != "" ] ; then    if [ "$locale" != "" ] ; then
226      echo "Test 3: locale-specific features (using '$locale' locale)"      echo "Test 3: locale-specific features (using '$locale' locale)"
227      $valgrind ./pcretest -q $infile testtry      for opt in "" "-s" $jitopt; do
228      if [ $? = 0 ] ; then        $valgrind ./pcretest -q $opt $infile testtry
229        $cf $outfile testtry        if [ $? = 0 ] ; then
230        if [ $? != 0 ] ; then          $cf $outfile testtry
231          echo " "          if [ $? != 0 ] ; then
232          echo "Locale test did not run entirely successfully."            echo " "
233          echo "This usually means that there is a problem with the locale"            echo "Locale test did not run entirely successfully."
234          echo "settings rather than a bug in PCRE."            echo "This usually means that there is a problem with the locale"
235        else            echo "settings rather than a bug in PCRE."
236        echo "OK"            break;
237            else
238              if [ "$opt" = "-s" ] ; then echo "OK with study"
239              elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
240              else echo "OK"
241              fi
242            fi
243          else exit 1
244        fi        fi
245      else exit 1      done
     fi  
246    else    else
247      echo "Cannot test locale-specific features - neither the 'fr_FR' nor the"      echo "Cannot test locale-specific features - neither the 'fr_FR' nor the"
248      echo "'french' locale exists, or the \"locale\" command is not available"      echo "'french' locale exists, or the \"locale\" command is not available"
# Line 192  fi Line 254  fi
254  # Additional tests for UTF8 support  # Additional tests for UTF8 support
255    
256  if [ $do4 = yes ] ; then  if [ $do4 = yes ] ; then
257    echo "Test 4: UTF-8 support (Perl compatible)"    echo "Test 4: UTF-8 support (Compatible with Perl >= 5.8)"
258    $valgrind ./pcretest -q $testdata/testinput4 testtry    for opt in "" "-s" $jitopt; do
259    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt $testdata/testinput4 testtry
260      $cf $testdata/testoutput4 testtry      if [ $? = 0 ] ; then
261      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput4 testtry
262    else exit 1        if [ $? != 0 ] ; then exit 1; fi
263    fi      else exit 1
264    echo "OK"      fi
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      done
270  fi  fi
271    
272  if [ $do5 = yes ] ; then  if [ $do5 = yes ] ; then
273    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"
274    $valgrind ./pcretest -q $testdata/testinput5 testtry    for opt in "" "-s" $jitopt; do
275    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt $testdata/testinput5 testtry
276      $cf $testdata/testoutput5 testtry      if [ $? = 0 ] ; then
277      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput5 testtry
278    else exit 1        if [ $? != 0 ] ; then exit 1; fi
279    fi      else exit 1
280    echo "OK"      fi
281        if [ "$opt" = "-s" ] ; then echo "OK with study"
282        elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
283        else echo "OK"
284        fi
285      done
286  fi  fi
287    
288  if [ $do6 = yes ] ; then  if [ $do6 = yes ] ; then
289    echo "Test 6: Unicode property support"    echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)"
290    $valgrind ./pcretest -q $testdata/testinput6 testtry    for opt in "" "-s" $jitopt; do
291    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt $testdata/testinput6 testtry
292      $cf $testdata/testoutput6 testtry      if [ $? = 0 ] ; then
293      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput6 testtry
294    else exit 1        if [ $? != 0 ] ; then exit 1; fi
295    fi      else exit 1
296    echo "OK"      fi
297        if [ "$opt" = "-s" ] ; then echo "OK with study"
298        elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
299        else echo "OK"
300        fi
301      done
302  fi  fi
303    
304  # Tests for DFA matching support  # Tests for DFA matching support
305    
306  if [ $do7 = yes ] ; then  if [ $do7 = yes ] ; then
307    echo "Test 7: DFA matching"    echo "Test 7: DFA matching"
308    $valgrind ./pcretest -q -dfa $testdata/testinput7 testtry    for opt in "" "-s"; do
309    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt -dfa $testdata/testinput7 testtry
310      $cf $testdata/testoutput7 testtry      if [ $? = 0 ] ; then
311      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput7 testtry
312    else exit 1        if [ $? != 0 ] ; then exit 1; fi
313    fi      else exit 1
314    echo "OK"      fi
315        if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
316      done
317  fi  fi
318    
319  if [ $do8 = yes ] ; then  if [ $do8 = yes ] ; then
320    echo "Test 8: DFA matching with UTF-8"    echo "Test 8: DFA matching with UTF-8"
321    $valgrind ./pcretest -q -dfa $testdata/testinput8 testtry    for opt in "" "-s"; do
322    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry
323      $cf $testdata/testoutput8 testtry      if [ $? = 0 ] ; then
324      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput8 testtry
325    else exit 1        if [ $? != 0 ] ; then exit 1; fi
326    fi      else exit 1
327    echo "OK"      fi
328        if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
329      done
330  fi  fi
331    
332  if [ $do9 = yes ] ; then  if [ $do9 = yes ] ; then
333    echo "Test 9: DFA matching with Unicode properties"    echo "Test 9: DFA matching with Unicode properties"
334    $valgrind ./pcretest -q -dfa $testdata/testinput9 testtry    for opt in "" "-s"; do
335    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry
336      $cf $testdata/testoutput9 testtry      if [ $? = 0 ] ; then
337      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput9 testtry
338    else exit 1        if [ $? != 0 ] ; then exit 1; fi
339    fi      else exit 1
340    echo "OK"      fi
341        if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
342      done
343  fi  fi
344    
345  # 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 267  fi Line 350  fi
350    
351  if [ $do10 = yes ] ; then  if [ $do10 = yes ] ; then
352    echo "Test 10: Internal offsets and code size tests"    echo "Test 10: Internal offsets and code size tests"
353    $valgrind ./pcretest -q $testdata/testinput10 testtry    for opt in "" "-s"; do
354    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt $testdata/testinput10 testtry
355      $cf $testdata/testoutput10 testtry      if [ $? = 0 ] ; then
356      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput10 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
363    
364    # Test of Perl >= 5.10 features without UTF8 support
365    
366    if [ $do11 = yes ] ; then
367      echo "Test 11: Features from Perl >= 5.10 without UTF8 support"
368      for opt in "" "-s" $jitopt; do
369        $valgrind ./pcretest -q $opt $testdata/testinput11 testtry
370        if [ $? = 0 ] ; then
371          $cf $testdata/testoutput11 testtry
372          if [ $? != 0 ] ; then exit 1; fi
373        else exit 1
374        fi
375        if [ "$opt" = "-s" ] ; then echo "OK with study"
376        elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
377        else echo "OK"
378        fi
379      done
380    fi
381    
382    # Test of Perl >= 5.10 features with UTF8 support
383    
384    if [ $do12 = yes ] ; then
385      echo "Test 12: Features from Perl >= 5.10 with UTF8 support"
386      for opt in "" "-s" $jitopt; do
387        $valgrind ./pcretest -q $opt $testdata/testinput12 testtry
388        if [ $? = 0 ] ; then
389          $cf $testdata/testoutput12 testtry
390          if [ $? != 0 ] ; then exit 1; fi
391        else exit 1
392        fi
393        if [ "$opt" = "-s" ] ; then echo "OK with study"
394        elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
395        else echo "OK"
396        fi
397      done
398    fi
399    
400    # Test non-Perl-compatible Unicode property support
401    
402    if [ $do13 = yes ] ; then
403      echo "Test 13: API, internals, and non-Perl stuff for Unicode property support"
404      for opt in "" "-s" $jitopt; do
405        $valgrind ./pcretest -q $opt $testdata/testinput13 testtry
406        if [ $? = 0 ] ; then
407          $cf $testdata/testoutput13 testtry
408          if [ $? != 0 ] ; then exit 1; fi
409        else exit 1
410        fi
411        if [ "$opt" = "-s" ] ; then echo "OK with study"
412        elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
413        else echo "OK"
414        fi
415      done
416  fi  fi
417    
418  # End  # End

Legend:
Removed from v.173  
changed lines
  Added in v.666

  ViewVC Help
Powered by ViewVC 1.1.5