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

Diff of /code/trunk/RunTest

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

code/trunk/RunTest.in revision 96 by nigel, Fri Mar 2 13:10:43 2007 UTC code/trunk/RunTest revision 612 by ph10, Sat Jul 2 15:20:59 2011 UTC
# Line 1  Line 1 
1  #! /bin/sh  #! /bin/sh
2    
3  # This file is generated by configure from RunTest.in. Make any changes  # Run the PCRE tests using the pcretest program. All tests are now run both
4  # to that file.  # 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    
 # Run PCRE tests  
   
 cf=diff  
13  valgrind=  valgrind=
14  if [ ! -d testdata ] ; then  
15    ln -s @top_srcdir@/testdata testdata  # 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
24      testdata="$srcdir/testdata"
25  fi  fi
 testdata=./testdata  
26    
27    # Find which optional facilities are available
28    
29    case `./pcretest -C | ./pcregrep 'Internal link size'` in
30      *2) link_size=2;;
31      *3) link_size=3;;
32      *4) link_size=4;;
33       *) echo "Failed to find internal link size"; exit 1;;
34    esac
35    
36    ./pcretest -C | ./pcregrep 'No UTF-8 support' >/dev/null
37    utf8=$?
38    
39  # Select which tests to run; if no selection, run all  ./pcretest -C | ./pcregrep 'No Unicode properties support' >/dev/null
40    ucp=$?
41    
42    # Select which tests to run; for those that are explicitly requested, check
43    # that the necessary optional facilities are available.
44    
45  do1=no  do1=no
46  do2=no  do2=no
# Line 24  do6=no Line 51  do6=no
51  do7=no  do7=no
52  do8=no  do8=no
53  do9=no  do9=no
54    do10=no
55    do11=no
56    do12=no
57    
58  while [ $# -gt 0 ] ; do  while [ $# -gt 0 ] ; do
59    case $1 in    case $1 in
# Line 36  while [ $# -gt 0 ] ; do Line 66  while [ $# -gt 0 ] ; do
66      7) do7=yes;;      7) do7=yes;;
67      8) do8=yes;;      8) do8=yes;;
68      9) do9=yes;;      9) do9=yes;;
69      valgrind) valgrind="valgrind -q";;     10) do10=yes;;
70       11) do11=yes;;
71       12) do12=yes;;
72       valgrind) valgrind="valgrind -q";;
73      *) echo "Unknown test number $1"; exit 1;;      *) echo "Unknown test number $1"; exit 1;;
74    esac    esac
75    shift    shift
76  done  done
77    
78  if [ "@LINK_SIZE@" != "" -a "@LINK_SIZE@" != "-DLINK_SIZE=2" ] ; then  if [ $utf8 -eq 0 ] ; then
   if [ $do2 = yes ] ; then  
     echo "Can't run test 2 with an internal link size other than 2"  
     exit 1  
   fi  
   if [ $do5 = yes ] ; then  
     echo "Can't run test 5 with an internal link size other than 2"  
     exit 1  
   fi  
   if [ $do6 = yes ] ; then  
     echo "Can't run test 6 with an internal link size other than 2"  
     exit 1  
   fi  
 fi  
   
 if [ "@UTF8@" = "" ] ; then  
79    if [ $do4 = yes ] ; then    if [ $do4 = yes ] ; then
80      echo "Can't run test 4 because UTF-8 support is not configured"      echo "Can't run test 4 because UTF-8 support is not configured"
81      exit 1      exit 1
# Line 66  if [ "@UTF8@" = "" ] ; then Line 84  if [ "@UTF8@" = "" ] ; then
84      echo "Can't run test 5 because UTF-8 support is not configured"      echo "Can't run test 5 because UTF-8 support is not configured"
85      exit 1      exit 1
86    fi    fi
   if [ $do6 = yes ] ; then  
     echo "Can't run test 6 because UTF-8 support is not configured"  
     exit 1  
   fi  
87    if [ $do8 = yes ] ; then    if [ $do8 = yes ] ; then
88      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"
89      exit 1      exit 1
90    fi    fi
   if [ $do9 = yes ] ; then  
     echo "Can't run test 9 because UTF-8 support is not configured"  
     exit 1  
   fi  
91  fi  fi
92    
93  if [ "@UCP@" = "" ] ; then  if [ $ucp -eq 0 ] ; then
94    if [ $do6 = yes ] ; then    if [ $do6 = yes ] ; then
95      echo "Can't run test 6 because Unicode property support is not configured"      echo "Can't run test 6 because Unicode property support is not configured"
96      exit 1      exit 1
# Line 89  if [ "@UCP@" = "" ] ; then Line 99  if [ "@UCP@" = "" ] ; then
99      echo "Can't run test 9 because Unicode property support is not configured"      echo "Can't run test 9 because Unicode property support is not configured"
100      exit 1      exit 1
101    fi    fi
102      if [ $do10 = yes ] ; then
103        echo "Can't run test 10 because Unicode property support is not configured"
104        exit 1
105      fi
106      if [ $do12 = yes ] ; then
107        echo "Can't run test 12 because Unicode property support is not configured"
108        exit 1
109      fi
110    fi
111    
112    if [ $link_size -ne 2 ] ; then
113      if [ $do10 = yes ] ; then
114        echo "Can't run test 10 because the link size ($link_size) is not 2"
115        exit 1
116      fi
117  fi  fi
118    
119    # If no specific tests were requested, select all that are relevant.
120    
121  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 \
122       $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \       $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
123       $do9 = no ] ; then       $do9 = no -a $do10 = no -a $do11 = no -a $do12 = no ] ; then
124    do1=yes    do1=yes
125    do2=yes    do2=yes
126    do3=yes    do3=yes
127    if [ "@UTF8@" != "" ] ; then do4=yes; fi    if [ $utf8 -ne 0 ] ; then do4=yes; fi
128    if [ "@UTF8@" != "" ] ; then do5=yes; fi    if [ $utf8 -ne 0 ] ; then do5=yes; fi
129    if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do6=yes; fi    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do6=yes; fi
130    do7=yes    do7=yes
131    if [ "@UTF8@" != "" ] ; then do8=yes; fi    if [ $utf8 -ne 0 ] ; then do8=yes; fi
132    if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do9=yes; fi    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi
133      if [ $link_size -eq 2 -a $ucp -ne 0 ] ; then do10=yes; fi
134      do11=yes
135      if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do12=yes; fi
136  fi  fi
137    
138  # Show which release  # Show which release
139    
140    echo ""
141    echo PCRE C library tests
142  ./pcretest /dev/null  ./pcretest /dev/null
143    
144  # Primary test, Perl-compatible  # Primary test, compatible with all versions of Perl >= 5.8
145    
146  if [ $do1 = yes ] ; then  if [ $do1 = yes ] ; then
147    echo "Test 1: main functionality (Perl compatible)"    echo "Test 1: main functionality (Compatible with Perl >= 5.8)"
148    $valgrind ./pcretest -q $testdata/testinput1 testtry    for opt in "" "-s"; do
149    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt $testdata/testinput1 testtry
150      $cf testtry $testdata/testoutput1      if [ $? = 0 ] ; then
151      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput1 testtry
152    else exit 1        if [ $? != 0 ] ; then exit 1; fi
153    fi      else exit 1
154    echo "OK"      fi
155    echo " "      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
156      done
157  fi  fi
158    
159  # PCRE tests that are not Perl-compatible - API & error tests, mostly  # PCRE tests that are not Perl-compatible - API, errors, internals
160    
161  if [ $do2 = yes ] ; then  if [ $do2 = yes ] ; then
162    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    echo "Test 2: API, errors, internals, and non-Perl stuff"
163      echo "Test 2: API and error handling (not Perl compatible)"    for opt in "" "-s"; do
164      $valgrind ./pcretest -q $testdata/testinput2 testtry      $valgrind ./pcretest -q $opt $testdata/testinput2 testtry
165      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
166        $cf testtry $testdata/testoutput2        $cf $testdata/testoutput2 testtry
167        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
168      else exit 1      else
169          echo " "
170          echo "** Test 2 requires a lot of stack. If it has crashed with a"
171          echo "** segmentation fault, it may be that you do not have enough"
172          echo "** stack available by default. Please see the 'pcrestack' man"
173          echo "** page for a discussion of PCRE's stack usage."
174          echo " "
175          exit 1
176      fi      fi
177      echo "OK"      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
178      echo " "    done
   else  
     echo Test 2 skipped for link size other than 2 \(@LINK_SIZE@\)  
     echo " "  
   fi  
179  fi  fi
180    
181  # Locale-specific tests, provided the "fr_FR" locale is available  # Locale-specific tests, provided that either the "fr_FR" or the "french"
182    # locale is available. The former is the Unix-like standard; the latter is
183    # for Windows.
184    
185  if [ $do3 = yes ] ; then  if [ $do3 = yes ] ; then
186    locale -a | grep '^fr_FR$' >/dev/null    locale -a | grep '^fr_FR$' >/dev/null
187    if [ $? -eq 0 ] ; then    if [ $? -eq 0 ] ; then
188      echo "Test 3: locale-specific features (using 'fr_FR' locale)"      locale=fr_FR
189      $valgrind ./pcretest -q $testdata/testinput3 testtry      infile=$testdata/testinput3
190      if [ $? = 0 ] ; then      outfile=$testdata/testoutput3
191        $cf testtry $testdata/testoutput3    else
192        if [ $? != 0 ] ; then      locale -a | grep '^french$' >/dev/null
193          echo " "      if [ $? -eq 0 ] ; then
194          echo "Locale test did not run entirely successfully."        locale=french
195          echo "This usually means that there is a problem with the locale"        sed 's/fr_FR/french/' $testdata/testinput3 >test3input
196          echo "settings rather than a bug in PCRE."        sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
197        else        infile=test3input
198        echo "OK"        outfile=test3output
199        fi      else
200        echo " "        locale=
     else exit 1  
201      fi      fi
202      fi
203    
204      if [ "$locale" != "" ] ; then
205        echo "Test 3: locale-specific features (using '$locale' locale)"
206        for opt in "" "-s"; do
207          $valgrind ./pcretest -q $opt $infile testtry
208          if [ $? = 0 ] ; then
209            $cf $outfile testtry
210            if [ $? != 0 ] ; then
211              echo " "
212              echo "Locale test did not run entirely successfully."
213              echo "This usually means that there is a problem with the locale"
214              echo "settings rather than a bug in PCRE."
215              break;
216            else
217              if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
218            fi
219          else exit 1
220          fi
221        done
222    else    else
223      echo "Cannot test locale-specific features - 'fr_FR' locale not found,"      echo "Cannot test locale-specific features - neither the 'fr_FR' nor the"
224      echo "or the \"locale\" command is not available to check for it."      echo "'french' locale exists, or the \"locale\" command is not available"
225        echo "to check for them."
226      echo " "      echo " "
227    fi    fi
228  fi  fi
# Line 172  fi Line 230  fi
230  # Additional tests for UTF8 support  # Additional tests for UTF8 support
231    
232  if [ $do4 = yes ] ; then  if [ $do4 = yes ] ; then
233    echo "Test 4: UTF-8 support (Perl compatible)"    echo "Test 4: UTF-8 support (Compatible with Perl >= 5.8)"
234    $valgrind ./pcretest -q $testdata/testinput4 testtry    for opt in "" "-s"; do
235    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt $testdata/testinput4 testtry
236      $cf testtry $testdata/testoutput4      if [ $? = 0 ] ; then
237      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput4 testtry
238    else exit 1        if [ $? != 0 ] ; then exit 1; fi
239    fi      else exit 1
240    echo "OK"      fi
241    echo " "      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
242      done
243  fi  fi
244    
245  if [ $do5 = yes ] ; then  if [ $do5 = yes ] ; then
246    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    echo "Test 5: API, internals, and non-Perl stuff for UTF-8 support"
247      echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"    for opt in "" "-s"; do
248      $valgrind ./pcretest -q $testdata/testinput5 testtry      $valgrind ./pcretest -q $opt $testdata/testinput5 testtry
249      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
250        $cf testtry $testdata/testoutput5        $cf $testdata/testoutput5 testtry
251        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
252      else exit 1      else exit 1
253      fi      fi
254      echo "OK"      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
255      echo " "    done
   else  
     echo Test 5 skipped for link size other than 2 \(@LINK_SIZE@\)  
     echo " "  
   fi  
256  fi  fi
257    
258  if [ $do6 = yes ] ; then  if [ $do6 = yes ] ; then
259    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)"
260      echo "Test 6: Unicode property support"    for opt in "" "-s"; do
261      $valgrind ./pcretest -q $testdata/testinput6 testtry      $valgrind ./pcretest -q $opt $testdata/testinput6 testtry
262      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
263        $cf testtry $testdata/testoutput6        $cf $testdata/testoutput6 testtry
264        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
265      else exit 1      else exit 1
266      fi      fi
267      echo "OK"      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
268      echo " "    done
   else  
     echo Test 6 skipped for link size other than 2 \(@LINK_SIZE@\)  
     echo " "  
   fi  
269  fi  fi
270    
271  # Tests for DFA matching support  # Tests for DFA matching support
272    
273  if [ $do7 = yes ] ; then  if [ $do7 = yes ] ; then
274    echo "Test 7: DFA matching"    echo "Test 7: DFA matching"
275    $valgrind ./pcretest -q -dfa $testdata/testinput7 testtry    for opt in "" "-s"; do
276    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt -dfa $testdata/testinput7 testtry
277      $cf testtry $testdata/testoutput7      if [ $? = 0 ] ; then
278      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput7 testtry
279    else exit 1        if [ $? != 0 ] ; then exit 1; fi
280    fi      else exit 1
281    echo "OK"      fi
282    echo " "      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
283      done
284  fi  fi
285    
286  if [ $do8 = yes ] ; then  if [ $do8 = yes ] ; then
287    echo "Test 8: DFA matching with UTF-8"    echo "Test 8: DFA matching with UTF-8"
288    $valgrind ./pcretest -q -dfa $testdata/testinput8 testtry    for opt in "" "-s"; do
289    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry
290      $cf testtry $testdata/testoutput8      if [ $? = 0 ] ; then
291      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput8 testtry
292    else exit 1        if [ $? != 0 ] ; then exit 1; fi
293    fi      else exit 1
294    echo "OK"      fi
295    echo " "      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
296      done
297  fi  fi
298    
299  if [ $do9 = yes ] ; then  if [ $do9 = yes ] ; then
300    echo "Test 9: DFA matching with Unicode properties"    echo "Test 9: DFA matching with Unicode properties"
301    $valgrind ./pcretest -q -dfa $testdata/testinput9 testtry    for opt in "" "-s"; do
302    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry
303      $cf testtry $testdata/testoutput9      if [ $? = 0 ] ; then
304      if [ $? != 0 ] ; then exit 1; fi        $cf $testdata/testoutput9 testtry
305    else exit 1        if [ $? != 0 ] ; then exit 1; fi
306    fi      else exit 1
307    echo "OK"      fi
308    echo " "      if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
309      done
310    fi
311    
312    # Test of internal offsets and code sizes. This test is run only when there
313    # is Unicode property support and the link size is 2. The actual tests are
314    # mostly the same as in some of the above, but in this test we inspect some
315    # offsets and sizes that require a known link size. This is a doublecheck for
316    # the maintainer, just in case something changes unexpectely.
317    
318    if [ $do10 = yes ] ; then
319      echo "Test 10: Internal offsets and code size tests"
320      for opt in "" "-s"; do
321        $valgrind ./pcretest -q $opt $testdata/testinput10 testtry
322        if [ $? = 0 ] ; then
323          $cf $testdata/testoutput10 testtry
324          if [ $? != 0 ] ; then exit 1; fi
325        else exit 1
326        fi
327        if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
328      done
329    fi
330    
331    # Test of Perl >= 5.10 features
332    
333    if [ $do11 = yes ] ; then
334      echo "Test 11: Features from Perl >= 5.10"
335      for opt in "" "-s"; do
336        $valgrind ./pcretest -q $opt $testdata/testinput11 testtry
337        if [ $? = 0 ] ; then
338          $cf $testdata/testoutput11 testtry
339          if [ $? != 0 ] ; then exit 1; fi
340        else exit 1
341        fi
342        if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
343      done
344    fi
345    
346    # Test non-Perl-compatible Unicode property support
347    
348    if [ $do12 = yes ] ; then
349      echo "Test 12: API, internals, and non-Perl stuff for Unicode property support"
350      for opt in "" "-s"; do
351        $valgrind ./pcretest -q $opt $testdata/testinput12 testtry
352        if [ $? = 0 ] ; then
353          $cf $testdata/testoutput12 testtry
354          if [ $? != 0 ] ; then exit 1; fi
355        else exit 1
356        fi
357        if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
358      done
359  fi  fi
360    
361  # End  # End

Legend:
Removed from v.96  
changed lines
  Added in v.612

  ViewVC Help
Powered by ViewVC 1.1.5