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

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12