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

Contents of /code/trunk/RunTest

Parent Directory Parent Directory | Revision Log Revision Log


Revision 666 - (hide annotations) (download)
Mon Aug 22 14:56:43 2011 UTC (3 years, 3 months ago) by ph10
File size: 11976 byte(s)
Commit changes for JIT support

1 nigel 49 #! /bin/sh
2    
3 ph10 612 # 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 nigel 49
13 nigel 87 valgrind=
14 ph10 339
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 ph10 137 testdata=testdata
23     if [ -n "$srcdir" -a -d "$srcdir" ] ; then
24     testdata="$srcdir/testdata"
25 nigel 81 fi
26 nigel 49
27 ph10 116 # Find which optional facilities are available
28 nigel 87
29 ph10 116 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 nigel 49
36 ph10 116 ./pcretest -C | ./pcregrep 'No UTF-8 support' >/dev/null
37     utf8=$?
38    
39     ./pcretest -C | ./pcregrep 'No Unicode properties support' >/dev/null
40     ucp=$?
41    
42 ph10 666 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 ph10 116 # Select which tests to run; for those that are explicitly requested, check
50     # that the necessary optional facilities are available.
51    
52 nigel 49 do1=no
53     do2=no
54     do3=no
55     do4=no
56     do5=no
57 nigel 75 do6=no
58 nigel 77 do7=no
59     do8=no
60     do9=no
61 ph10 164 do10=no
62 ph10 448 do11=no
63     do12=no
64 ph10 651 do13=no
65 nigel 49
66     while [ $# -gt 0 ] ; do
67     case $1 in
68     1) do1=yes;;
69     2) do2=yes;;
70     3) do3=yes;;
71     4) do4=yes;;
72 nigel 77 5) do5=yes;;
73     6) do6=yes;;
74     7) do7=yes;;
75     8) do8=yes;;
76     9) do9=yes;;
77 ph10 165 10) do10=yes;;
78 ph10 448 11) do11=yes;;
79 ph10 461 12) do12=yes;;
80 ph10 666 13) do13=yes;;
81     valgrind) valgrind="valgrind -q --smc-check=all";;
82 nigel 49 *) echo "Unknown test number $1"; exit 1;;
83     esac
84     shift
85     done
86    
87 ph10 116 if [ $utf8 -eq 0 ] ; then
88 nigel 63 if [ $do4 = yes ] ; then
89 nigel 75 echo "Can't run test 4 because UTF-8 support is not configured"
90 nigel 63 exit 1
91 nigel 77 fi
92 nigel 49 if [ $do5 = yes ] ; then
93 nigel 75 echo "Can't run test 5 because UTF-8 support is not configured"
94 nigel 49 exit 1
95 nigel 77 fi
96     if [ $do8 = yes ] ; then
97     echo "Can't run test 8 because UTF-8 support is not configured"
98     exit 1
99     fi
100 ph10 651 if [ $do12 = yes ] ; then
101     echo "Can't run test 12 because UTF-8 support is not configured"
102     exit 1
103     fi
104 nigel 77 fi
105 nigel 49
106 ph10 116 if [ $ucp -eq 0 ] ; then
107 nigel 75 if [ $do6 = yes ] ; then
108     echo "Can't run test 6 because Unicode property support is not configured"
109     exit 1
110     fi
111 nigel 77 if [ $do9 = yes ] ; then
112     echo "Can't run test 9 because Unicode property support is not configured"
113     exit 1
114     fi
115 ph10 164 if [ $do10 = yes ] ; then
116     echo "Can't run test 10 because Unicode property support is not configured"
117     exit 1
118     fi
119 ph10 651 if [ $do13 = yes ] ; then
120 ph10 448 echo "Can't run test 12 because Unicode property support is not configured"
121     exit 1
122     fi
123 nigel 77 fi
124 nigel 75
125 ph10 164 if [ $link_size -ne 2 ] ; then
126     if [ $do10 = yes ] ; then
127     echo "Can't run test 10 because the link size ($link_size) is not 2"
128     exit 1
129     fi
130 ph10 165 fi
131 ph10 164
132 ph10 116 # If no specific tests were requested, select all that are relevant.
133    
134 nigel 75 if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \
135 nigel 77 $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
136 ph10 666 $do9 = no -a $do10 = no -a $do11 = no -a $do12 = no -a \
137     $do13 = no ] ; then
138 nigel 49 do1=yes
139 ph10 247 do2=yes
140 nigel 49 do3=yes
141 ph10 116 if [ $utf8 -ne 0 ] ; then do4=yes; fi
142 ph10 247 if [ $utf8 -ne 0 ] ; then do5=yes; fi
143 ph10 116 if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do6=yes; fi
144 ph10 247 do7=yes
145     if [ $utf8 -ne 0 ] ; then do8=yes; fi
146 ph10 116 if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi
147 ph10 173 if [ $link_size -eq 2 -a $ucp -ne 0 ] ; then do10=yes; fi
148 ph10 448 do11=yes
149 ph10 651 if [ $utf8 -ne 0 ] ; then do12=yes; fi
150     if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do13=yes; fi
151 nigel 49 fi
152    
153 nigel 73 # Show which release
154    
155 ph10 128 echo ""
156     echo PCRE C library tests
157 nigel 73 ./pcretest /dev/null
158    
159 ph10 666 # Primary test, compatible with JIT and all versions of Perl >= 5.8
160 nigel 49
161     if [ $do1 = yes ] ; then
162 ph10 559 echo "Test 1: main functionality (Compatible with Perl >= 5.8)"
163 ph10 666 for opt in "" "-s" $jitopt; do
164 ph10 612 $valgrind ./pcretest -q $opt $testdata/testinput1 testtry
165     if [ $? = 0 ] ; then
166     $cf $testdata/testoutput1 testtry
167     if [ $? != 0 ] ; then exit 1; fi
168     else exit 1
169     fi
170 ph10 666 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 ph10 654 done
175 nigel 49 fi
176    
177 ph10 666 # PCRE tests that are not JIT or Perl-compatible: API, errors, internals
178 nigel 49
179     if [ $do2 = yes ] ; then
180 ph10 449 echo "Test 2: API, errors, internals, and non-Perl stuff"
181 ph10 666 for opt in "" "-s" $jitopt; do
182 ph10 612 $valgrind ./pcretest -q $opt $testdata/testinput2 testtry
183     if [ $? = 0 ] ; then
184     $cf $testdata/testoutput2 testtry
185     if [ $? != 0 ] ; then exit 1; fi
186     else
187     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 ph10 666 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 ph10 654 done
200 nigel 49 fi
201    
202 ph10 157 # Locale-specific tests, provided that either the "fr_FR" or the "french"
203     # locale is available. The former is the Unix-like standard; the latter is
204     # for Windows.
205 nigel 49
206 nigel 63 if [ $do3 = yes ] ; then
207 nigel 73 locale -a | grep '^fr_FR$' >/dev/null
208 nigel 49 if [ $? -eq 0 ] ; then
209 ph10 157 locale=fr_FR
210     infile=$testdata/testinput3
211     outfile=$testdata/testoutput3
212     else
213     locale -a | grep '^french$' >/dev/null
214     if [ $? -eq 0 ] ; then
215     locale=french
216     sed 's/fr_FR/french/' $testdata/testinput3 >test3input
217     sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
218     infile=test3input
219 ph10 159 outfile=test3output
220 ph10 157 else
221 ph10 159 locale=
222 ph10 157 fi
223 ph10 159 fi
224 ph10 157
225     if [ "$locale" != "" ] ; then
226     echo "Test 3: locale-specific features (using '$locale' locale)"
227 ph10 666 for opt in "" "-s" $jitopt; do
228 ph10 612 $valgrind ./pcretest -q $opt $infile testtry
229     if [ $? = 0 ] ; then
230     $cf $outfile testtry
231     if [ $? != 0 ] ; then
232     echo " "
233     echo "Locale test did not run entirely successfully."
234     echo "This usually means that there is a problem with the locale"
235     echo "settings rather than a bug in PCRE."
236 ph10 654 break;
237 ph10 612 else
238 ph10 666 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 ph10 612 fi
243     else exit 1
244 nigel 77 fi
245 ph10 654 done
246 nigel 49 else
247 ph10 157 echo "Cannot test locale-specific features - neither the 'fr_FR' nor the"
248     echo "'french' locale exists, or the \"locale\" command is not available"
249     echo "to check for them."
250 nigel 77 echo " "
251 nigel 49 fi
252     fi
253    
254     # Additional tests for UTF8 support
255    
256 nigel 63 if [ $do4 = yes ] ; then
257 ph10 559 echo "Test 4: UTF-8 support (Compatible with Perl >= 5.8)"
258 ph10 666 for opt in "" "-s" $jitopt; do
259 ph10 612 $valgrind ./pcretest -q $opt $testdata/testinput4 testtry
260     if [ $? = 0 ] ; then
261     $cf $testdata/testoutput4 testtry
262     if [ $? != 0 ] ; then exit 1; fi
263     else exit 1
264     fi
265 ph10 666 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 ph10 654 done
270 nigel 49 fi
271    
272 nigel 63 if [ $do5 = yes ] ; then
273 ph10 426 echo "Test 5: API, internals, and non-Perl stuff for UTF-8 support"
274 ph10 666 for opt in "" "-s" $jitopt; do
275 ph10 612 $valgrind ./pcretest -q $opt $testdata/testinput5 testtry
276     if [ $? = 0 ] ; then
277     $cf $testdata/testoutput5 testtry
278     if [ $? != 0 ] ; then exit 1; fi
279     else exit 1
280     fi
281 ph10 666 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 ph10 654 done
286 nigel 49 fi
287    
288 nigel 75 if [ $do6 = yes ] ; then
289 ph10 559 echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)"
290 ph10 666 for opt in "" "-s" $jitopt; do
291 ph10 612 $valgrind ./pcretest -q $opt $testdata/testinput6 testtry
292     if [ $? = 0 ] ; then
293     $cf $testdata/testoutput6 testtry
294     if [ $? != 0 ] ; then exit 1; fi
295     else exit 1
296     fi
297 ph10 666 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 ph10 654 done
302 nigel 75 fi
303    
304 nigel 77 # Tests for DFA matching support
305    
306     if [ $do7 = yes ] ; then
307     echo "Test 7: DFA matching"
308 ph10 654 for opt in "" "-s"; do
309 ph10 612 $valgrind ./pcretest -q $opt -dfa $testdata/testinput7 testtry
310     if [ $? = 0 ] ; then
311     $cf $testdata/testoutput7 testtry
312     if [ $? != 0 ] ; then exit 1; fi
313     else exit 1
314     fi
315     if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
316 ph10 654 done
317 nigel 77 fi
318    
319     if [ $do8 = yes ] ; then
320     echo "Test 8: DFA matching with UTF-8"
321 ph10 654 for opt in "" "-s"; do
322 ph10 612 $valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry
323     if [ $? = 0 ] ; then
324     $cf $testdata/testoutput8 testtry
325     if [ $? != 0 ] ; then exit 1; fi
326     else exit 1
327     fi
328     if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
329 ph10 654 done
330 nigel 77 fi
331    
332     if [ $do9 = yes ] ; then
333     echo "Test 9: DFA matching with Unicode properties"
334 ph10 654 for opt in "" "-s"; do
335 ph10 612 $valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry
336     if [ $? = 0 ] ; then
337     $cf $testdata/testoutput9 testtry
338     if [ $? != 0 ] ; then exit 1; fi
339     else exit 1
340     fi
341     if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
342 ph10 654 done
343 nigel 77 fi
344    
345 ph10 164 # Test of internal offsets and code sizes. This test is run only when there
346     # is Unicode property support and the link size is 2. The actual tests are
347     # mostly the same as in some of the above, but in this test we inspect some
348     # offsets and sizes that require a known link size. This is a doublecheck for
349     # the maintainer, just in case something changes unexpectely.
350    
351     if [ $do10 = yes ] ; then
352     echo "Test 10: Internal offsets and code size tests"
353 ph10 654 for opt in "" "-s"; do
354 ph10 612 $valgrind ./pcretest -q $opt $testdata/testinput10 testtry
355     if [ $? = 0 ] ; then
356     $cf $testdata/testoutput10 testtry
357     if [ $? != 0 ] ; then exit 1; fi
358     else exit 1
359     fi
360     if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
361 ph10 654 done
362 ph10 164 fi
363    
364 ph10 651 # Test of Perl >= 5.10 features without UTF8 support
365 ph10 448
366     if [ $do11 = yes ] ; then
367 ph10 651 echo "Test 11: Features from Perl >= 5.10 without UTF8 support"
368 ph10 666 for opt in "" "-s" $jitopt; do
369 ph10 612 $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 ph10 666 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 ph10 654 done
380 ph10 448 fi
381    
382 ph10 651 # Test of Perl >= 5.10 features with UTF8 support
383 ph10 448
384     if [ $do12 = yes ] ; then
385 ph10 651 echo "Test 12: Features from Perl >= 5.10 with UTF8 support"
386 ph10 666 for opt in "" "-s" $jitopt; do
387 ph10 612 $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 ph10 666 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 ph10 654 done
398 ph10 448 fi
399    
400 ph10 651 # 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 ph10 666 for opt in "" "-s" $jitopt; do
405 ph10 651 $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 ph10 666 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 ph10 654 done
416 ph10 651 fi
417    
418 nigel 49 # End

Properties

Name Value
svn:executable *
svn:keywords "Author Date Id Revision Url"

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12