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

Diff of /code/trunk/RunTest

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

revision 559 by ph10, Wed Oct 27 09:45:20 2010 UTC revision 651 by ph10, Mon Aug 1 16:32:40 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    
13  valgrind=  valgrind=
14    
# Line 46  do9=no Line 54  do9=no
54  do10=no  do10=no
55  do11=no  do11=no
56  do12=no  do12=no
57    do13=no
58    
59  while [ $# -gt 0 ] ; do  while [ $# -gt 0 ] ; do
60    case $1 in    case $1 in
# Line 61  while [ $# -gt 0 ] ; do Line 70  while [ $# -gt 0 ] ; do
70     10) do10=yes;;     10) do10=yes;;
71     11) do11=yes;;     11) do11=yes;;
72     12) do12=yes;;     12) do12=yes;;
73       13) do12=yes;;
74     valgrind) valgrind="valgrind -q";;     valgrind) valgrind="valgrind -q";;
75      *) echo "Unknown test number $1"; exit 1;;      *) echo "Unknown test number $1"; exit 1;;
76    esac    esac
# Line 80  if [ $utf8 -eq 0 ] ; then Line 90  if [ $utf8 -eq 0 ] ; then
90      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"
91      exit 1      exit 1
92    fi    fi
93      if [ $do12 = yes ] ; then
94        echo "Can't run test 12 because UTF-8 support is not configured"
95        exit 1
96      fi
97  fi  fi
98    
99  if [ $ucp -eq 0 ] ; then  if [ $ucp -eq 0 ] ; then
# Line 95  if [ $ucp -eq 0 ] ; then Line 109  if [ $ucp -eq 0 ] ; then
109      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"
110      exit 1      exit 1
111    fi    fi
112    if [ $do12 = yes ] ; then    if [ $do13 = yes ] ; then
113      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"
114      exit 1      exit 1
115    fi    fi
# Line 124  if [ $do1 = no -a $do2 = no -a $do3 = no Line 138  if [ $do1 = no -a $do2 = no -a $do3 = no
138    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi
139    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
140    do11=yes    do11=yes
141    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do12=yes; fi    if [ $utf8 -ne 0 ] ; then do12=yes; fi
142      if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do13=yes; fi
143  fi  fi
144    
145  # Show which release  # Show which release
# Line 137  echo PCRE C library tests Line 152  echo PCRE C library tests
152    
153  if [ $do1 = yes ] ; then  if [ $do1 = yes ] ; then
154    echo "Test 1: main functionality (Compatible with Perl >= 5.8)"    echo "Test 1: main functionality (Compatible with Perl >= 5.8)"
155    $valgrind ./pcretest -q $testdata/testinput1 testtry    for opt in "" "-s"; do
156    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt $testdata/testinput1 testtry
157      $cf $testdata/testoutput1 testtry      if [ $? = 0 ] ; then
158      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput1 testtry
159    else exit 1        if [ $? != 0 ] ; then exit 1; fi
160    fi      else exit 1
161    echo "OK"      fi
162        if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
163      done
164  fi  fi
165    
166  # PCRE tests that are not Perl-compatible - API, errors, internals  # PCRE tests that are not Perl-compatible - API, errors, internals
167    
168  if [ $do2 = yes ] ; then  if [ $do2 = yes ] ; then
169    echo "Test 2: API, errors, internals, and non-Perl stuff"    echo "Test 2: API, errors, internals, and non-Perl stuff"
170    $valgrind ./pcretest -q $testdata/testinput2 testtry    for opt in "" "-s"; do
171    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt $testdata/testinput2 testtry
172      $cf $testdata/testoutput2 testtry      if [ $? = 0 ] ; then
173      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput2 testtry
174    else        if [ $? != 0 ] ; then exit 1; fi
175      echo " "      else
176      echo "** Test 2 requires a lot of stack. If it has crashed with a"        echo " "
177      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"
178      echo "** stack available by default. Please see the 'pcrestack' man"        echo "** segmentation fault, it may be that you do not have enough"
179      echo "** page for a discussion of PCRE's stack usage."        echo "** stack available by default. Please see the 'pcrestack' man"
180      echo " "        echo "** page for a discussion of PCRE's stack usage."
181      exit 1        echo " "
182    fi        exit 1
183    echo "OK"      fi
184        if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
185      done
186  fi  fi
187    
188  # 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 210  if [ $do3 = yes ] ; then
210    
211    if [ "$locale" != "" ] ; then    if [ "$locale" != "" ] ; then
212      echo "Test 3: locale-specific features (using '$locale' locale)"      echo "Test 3: locale-specific features (using '$locale' locale)"
213      $valgrind ./pcretest -q $infile testtry      for opt in "" "-s"; do
214      if [ $? = 0 ] ; then        $valgrind ./pcretest -q $opt $infile testtry
215        $cf $outfile testtry        if [ $? = 0 ] ; then
216        if [ $? != 0 ] ; then          $cf $outfile testtry
217          echo " "          if [ $? != 0 ] ; then
218          echo "Locale test did not run entirely successfully."            echo " "
219          echo "This usually means that there is a problem with the locale"            echo "Locale test did not run entirely successfully."
220          echo "settings rather than a bug in PCRE."            echo "This usually means that there is a problem with the locale"
221        else            echo "settings rather than a bug in PCRE."
222        echo "OK"            break;
223            else
224              if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
225            fi
226          else exit 1
227        fi        fi
228      else exit 1      done
     fi  
229    else    else
230      echo "Cannot test locale-specific features - neither the 'fr_FR' nor the"      echo "Cannot test locale-specific features - neither the 'fr_FR' nor the"
231      echo "'french' locale exists, or the \"locale\" command is not available"      echo "'french' locale exists, or the \"locale\" command is not available"
# Line 216  fi Line 238  fi
238    
239  if [ $do4 = yes ] ; then  if [ $do4 = yes ] ; then
240    echo "Test 4: UTF-8 support (Compatible with Perl >= 5.8)"    echo "Test 4: UTF-8 support (Compatible with Perl >= 5.8)"
241    $valgrind ./pcretest -q $testdata/testinput4 testtry    for opt in "" "-s"; do
242    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt $testdata/testinput4 testtry
243      $cf $testdata/testoutput4 testtry      if [ $? = 0 ] ; then
244      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput4 testtry
245    else exit 1        if [ $? != 0 ] ; then exit 1; fi
246    fi      else exit 1
247    echo "OK"      fi
248        if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
249      done
250  fi  fi
251    
252  if [ $do5 = yes ] ; then  if [ $do5 = yes ] ; then
253    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"
254    $valgrind ./pcretest -q $testdata/testinput5 testtry    for opt in "" "-s"; do
255    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt $testdata/testinput5 testtry
256      $cf $testdata/testoutput5 testtry      if [ $? = 0 ] ; then
257      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput5 testtry
258    else exit 1        if [ $? != 0 ] ; then exit 1; fi
259    fi      else exit 1
260    echo "OK"      fi
261        if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
262      done
263  fi  fi
264    
265  if [ $do6 = yes ] ; then  if [ $do6 = yes ] ; then
266    echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)"    echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)"
267    $valgrind ./pcretest -q $testdata/testinput6 testtry    for opt in "" "-s"; do
268    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt $testdata/testinput6 testtry
269      $cf $testdata/testoutput6 testtry      if [ $? = 0 ] ; then
270      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput6 testtry
271    else exit 1        if [ $? != 0 ] ; then exit 1; fi
272    fi      else exit 1
273    echo "OK"      fi
274        if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
275      done
276  fi  fi
277    
278  # Tests for DFA matching support  # Tests for DFA matching support
279    
280  if [ $do7 = yes ] ; then  if [ $do7 = yes ] ; then
281    echo "Test 7: DFA matching"    echo "Test 7: DFA matching"
282    $valgrind ./pcretest -q -dfa $testdata/testinput7 testtry    for opt in "" "-s"; do
283    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt -dfa $testdata/testinput7 testtry
284      $cf $testdata/testoutput7 testtry      if [ $? = 0 ] ; then
285      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput7 testtry
286    else exit 1        if [ $? != 0 ] ; then exit 1; fi
287    fi      else exit 1
288    echo "OK"      fi
289        if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
290      done
291  fi  fi
292    
293  if [ $do8 = yes ] ; then  if [ $do8 = yes ] ; then
294    echo "Test 8: DFA matching with UTF-8"    echo "Test 8: DFA matching with UTF-8"
295    $valgrind ./pcretest -q -dfa $testdata/testinput8 testtry    for opt in "" "-s"; do
296    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry
297      $cf $testdata/testoutput8 testtry      if [ $? = 0 ] ; then
298      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput8 testtry
299    else exit 1        if [ $? != 0 ] ; then exit 1; fi
300    fi      else exit 1
301    echo "OK"      fi
302        if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
303      done
304  fi  fi
305    
306  if [ $do9 = yes ] ; then  if [ $do9 = yes ] ; then
307    echo "Test 9: DFA matching with Unicode properties"    echo "Test 9: DFA matching with Unicode properties"
308    $valgrind ./pcretest -q -dfa $testdata/testinput9 testtry    for opt in "" "-s"; do
309    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry
310      $cf $testdata/testoutput9 testtry      if [ $? = 0 ] ; then
311      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput9 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  # 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 324  fi
324    
325  if [ $do10 = yes ] ; then  if [ $do10 = yes ] ; then
326    echo "Test 10: Internal offsets and code size tests"    echo "Test 10: Internal offsets and code size tests"
327    $valgrind ./pcretest -q $testdata/testinput10 testtry    for opt in "" "-s"; do
328    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt $testdata/testinput10 testtry
329      $cf $testdata/testoutput10 testtry      if [ $? = 0 ] ; then
330      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput10 testtry
331    else exit 1        if [ $? != 0 ] ; then exit 1; fi
332    fi      else exit 1
333    echo "OK"      fi
334        if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
335      done
336  fi  fi
337    
338  # Test of Perl >= 5.10 features  # Test of Perl >= 5.10 features without UTF8 support
339    
340  if [ $do11 = yes ] ; then  if [ $do11 = yes ] ; then
341    echo "Test 11: Features from Perl >= 5.10"    echo "Test 11: Features from Perl >= 5.10 without UTF8 support"
342    $valgrind ./pcretest -q $testdata/testinput11 testtry    for opt in "" "-s"; do
343    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt $testdata/testinput11 testtry
344      $cf $testdata/testoutput11 testtry      if [ $? = 0 ] ; then
345      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput11 testtry
346    else exit 1        if [ $? != 0 ] ; then exit 1; fi
347    fi      else exit 1
348    echo "OK"      fi
349        if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
350      done
351  fi  fi
352    
353  # Test non-Perl-compatible Unicode property support  # Test of Perl >= 5.10 features with UTF8 support
354    
355  if [ $do12 = yes ] ; then  if [ $do12 = yes ] ; then
356    echo "Test 12: API, internals, and non-Perl stuff for Unicode property support"    echo "Test 12: Features from Perl >= 5.10 with UTF8 support"
357    $valgrind ./pcretest -q $testdata/testinput12 testtry    for opt in "" "-s"; do
358    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt $testdata/testinput12 testtry
359      $cf $testdata/testoutput12 testtry      if [ $? = 0 ] ; then
360      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput12 testtry
361    else exit 1        if [ $? != 0 ] ; then exit 1; fi
362    fi      else exit 1
363    echo "OK"      fi
364        if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
365      done
366    fi
367    
368    # Test non-Perl-compatible Unicode property support
369    
370    if [ $do13 = yes ] ; then
371      echo "Test 13: API, internals, and non-Perl stuff for Unicode property support"
372      for opt in "" "-s"; do
373        $valgrind ./pcretest -q $opt $testdata/testinput13 testtry
374        if [ $? = 0 ] ; then
375          $cf $testdata/testoutput13 testtry
376          if [ $? != 0 ] ; then exit 1; fi
377        else exit 1
378        fi
379        if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
380      done
381  fi  fi
382    
383  # End  # End

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

  ViewVC Help
Powered by ViewVC 1.1.5