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

Contents of /code/trunk/RunTest

Parent Directory Parent Directory | Revision Log Revision Log


Revision 674 - (show annotations)
Fri Aug 26 18:17:51 2011 UTC (4 years ago) by ph10
File size: 14772 byte(s)
Error occurred while calculating annotation data.
More JIT testing.
1 #! /bin/sh
2
3 # Run the PCRE tests using the pcretest program. The appropriate tests are
4 # selected, depending on which build-time options were used.
5
6 # All tests are now run both with and without -s, to ensure that everything is
7 # tested with and without studying. However, there are some tests that produce
8 # different output after studying, typically when we are tracing the actual
9 # matching process (for example, using auto-callouts). In these few cases, the
10 # tests are duplicated in the files, one with /S to force studying always, and
11 # one with /SS to force *not* studying always. The use of -s doesn't then make
12 # any difference to their output. There is also one test which compiles invalid
13 # UTF-8 with the UTF-8 check turned off; for this, studying must also be
14 # disabled with /SS.
15
16 # When JIT support is available, all the tests are also run with -s+ to test
17 # (again, almost) everything with studying and the JIT option. There are also
18 # two tests for JIT-specific features, one to be run when JIT support is
19 # available, and one when it is not.
20
21 valgrind=
22
23 # Set up a suitable "diff" command for comparison. Some systems
24 # have a diff that lacks a -u option. Try to deal with this.
25
26 if diff -u /dev/null /dev/null; then cf="diff -u"; else cf="diff"; fi
27
28 # Find the test data
29
30 testdata=testdata
31 if [ -n "$srcdir" -a -d "$srcdir" ] ; then
32 testdata="$srcdir/testdata"
33 fi
34
35 # Find which optional facilities are available
36
37 case `./pcretest -C | ./pcregrep 'Internal link size'` in
38 *2) link_size=2;;
39 *3) link_size=3;;
40 *4) link_size=4;;
41 *) echo "Failed to find internal link size"; exit 1;;
42 esac
43
44 ./pcretest -C | ./pcregrep 'No UTF-8 support' >/dev/null
45 utf8=$?
46
47 ./pcretest -C | ./pcregrep 'No Unicode properties support' >/dev/null
48 ucp=$?
49
50 jitopt=
51 ./pcretest -C | ./pcregrep \
52 'No Just-in-time compiler support|this architecture is unsupported' \
53 >/dev/null
54 jit=$?
55 if [ $jit -ne 0 ] ; then
56 jitopt=-s+
57 else
58 ./pcretest -C | ./pcregrep 'this architecture is unsupported' >/dev/null
59 jitnotcompiled=$?
60 fi
61
62
63 # Select which tests to run; for those that are explicitly requested, check
64 # that the necessary optional facilities are available.
65
66 do1=no
67 do2=no
68 do3=no
69 do4=no
70 do5=no
71 do6=no
72 do7=no
73 do8=no
74 do9=no
75 do10=no
76 do11=no
77 do12=no
78 do13=no
79 do14=no
80 do15=no
81
82 while [ $# -gt 0 ] ; do
83 case $1 in
84 1) do1=yes;;
85 2) do2=yes;;
86 3) do3=yes;;
87 4) do4=yes;;
88 5) do5=yes;;
89 6) do6=yes;;
90 7) do7=yes;;
91 8) do8=yes;;
92 9) do9=yes;;
93 10) do10=yes;;
94 11) do11=yes;;
95 12) do12=yes;;
96 13) do13=yes;;
97 14) do14=yes;;
98 15) do15=yes;;
99 valgrind) valgrind="valgrind -q --smc-check=all";;
100 *) echo "Unknown test number $1"; exit 1;;
101 esac
102 shift
103 done
104
105 if [ $utf8 -eq 0 ] ; then
106 if [ $do4 = yes ] ; then
107 echo "Can't run test 4 because UTF-8 support is not configured"
108 exit 1
109 fi
110 if [ $do5 = yes ] ; then
111 echo "Can't run test 5 because UTF-8 support is not configured"
112 exit 1
113 fi
114 if [ $do8 = yes ] ; then
115 echo "Can't run test 8 because UTF-8 support is not configured"
116 exit 1
117 fi
118 if [ $do12 = yes ] ; then
119 echo "Can't run test 12 because UTF-8 support is not configured"
120 exit 1
121 fi
122 fi
123
124 if [ $ucp -eq 0 ] ; then
125 if [ $do6 = yes ] ; then
126 echo "Can't run test 6 because Unicode property support is not configured"
127 exit 1
128 fi
129 if [ $do9 = yes ] ; then
130 echo "Can't run test 9 because Unicode property support is not configured"
131 exit 1
132 fi
133 if [ $do10 = yes ] ; then
134 echo "Can't run test 10 because Unicode property support is not configured"
135 exit 1
136 fi
137 if [ $do13 = yes ] ; then
138 echo "Can't run test 12 because Unicode property support is not configured"
139 exit 1
140 fi
141 fi
142
143 if [ $link_size -ne 2 ] ; then
144 if [ $do10 = yes ] ; then
145 echo "Can't run test 10 because the link size ($link_size) is not 2"
146 exit 1
147 fi
148 fi
149
150 if [ $jit -eq 0 ] ; then
151 if [ $do14 = "yes" ] ; then
152 echo "Can't run test 14 because JIT support is not configured"
153 exit 1
154 fi
155 else
156 if [ $do15 = "yes" ] ; then
157 echo "Can't run test 15 because JIT support is configured"
158 exit 1
159 fi
160 fi
161
162 # If no specific tests were requested, select all. Those that are not
163 # relevant will be skipped.
164
165 if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \
166 $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
167 $do9 = no -a $do10 = no -a $do11 = no -a $do12 = no -a \
168 $do13 = no -a $do14 = no -a $do15 = no ] ; then
169 do1=yes
170 do2=yes
171 do3=yes
172 do4=yes
173 do5=yes
174 do6=yes
175 do7=yes
176 do8=yes
177 do9=yes
178 do10=yes
179 do11=yes
180 do12=yes
181 do13=yes
182 do14=yes
183 do15=yes
184 fi
185
186 # Show which release
187
188 echo ""
189 echo PCRE C library tests
190 ./pcretest /dev/null
191
192 # Primary test, compatible with JIT and all versions of Perl >= 5.8
193
194 if [ $do1 = yes ] ; then
195 echo "Test 1: main functionality (Compatible with Perl >= 5.8)"
196 for opt in "" "-s" $jitopt; do
197 $valgrind ./pcretest -q $opt $testdata/testinput1 testtry
198 if [ $? = 0 ] ; then
199 $cf $testdata/testoutput1 testtry
200 if [ $? != 0 ] ; then exit 1; fi
201 else exit 1
202 fi
203 if [ "$opt" = "-s" ] ; then echo " OK with study"
204 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
205 else echo " OK"
206 fi
207 done
208 fi
209
210 # PCRE tests that are not JIT or Perl-compatible: API, errors, internals
211
212 if [ $do2 = yes ] ; then
213 echo "Test 2: API, errors, internals, and non-Perl stuff"
214 for opt in "" "-s" $jitopt; do
215 $valgrind ./pcretest -q $opt $testdata/testinput2 testtry
216 if [ $? = 0 ] ; then
217 $cf $testdata/testoutput2 testtry
218 if [ $? != 0 ] ; then exit 1; fi
219 else
220 echo " "
221 echo "** Test 2 requires a lot of stack. If it has crashed with a"
222 echo "** segmentation fault, it may be that you do not have enough"
223 echo "** stack available by default. Please see the 'pcrestack' man"
224 echo "** page for a discussion of PCRE's stack usage."
225 echo " "
226 exit 1
227 fi
228 if [ "$opt" = "-s" ] ; then echo " OK with study"
229 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
230 else echo " OK"
231 fi
232 done
233 fi
234
235 # Locale-specific tests, provided that either the "fr_FR" or the "french"
236 # locale is available. The former is the Unix-like standard; the latter is
237 # for Windows.
238
239 if [ $do3 = yes ] ; then
240 locale -a | grep '^fr_FR$' >/dev/null
241 if [ $? -eq 0 ] ; then
242 locale=fr_FR
243 infile=$testdata/testinput3
244 outfile=$testdata/testoutput3
245 else
246 locale -a | grep '^french$' >/dev/null
247 if [ $? -eq 0 ] ; then
248 locale=french
249 sed 's/fr_FR/french/' $testdata/testinput3 >test3input
250 sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
251 infile=test3input
252 outfile=test3output
253 else
254 locale=
255 fi
256 fi
257
258 if [ "$locale" != "" ] ; then
259 echo "Test 3: locale-specific features (using '$locale' locale)"
260 for opt in "" "-s" $jitopt; do
261 $valgrind ./pcretest -q $opt $infile testtry
262 if [ $? = 0 ] ; then
263 $cf $outfile testtry
264 if [ $? != 0 ] ; then
265 echo " "
266 echo "Locale test did not run entirely successfully."
267 echo "This usually means that there is a problem with the locale"
268 echo "settings rather than a bug in PCRE."
269 break;
270 else
271 if [ "$opt" = "-s" ] ; then echo " OK with study"
272 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
273 else echo " OK"
274 fi
275 fi
276 else exit 1
277 fi
278 done
279 else
280 echo "Cannot test locale-specific features - neither the 'fr_FR' nor the"
281 echo "'french' locale exists, or the \"locale\" command is not available"
282 echo "to check for them."
283 echo " "
284 fi
285 fi
286
287 # Additional tests for UTF8 support
288
289 if [ $do4 = yes ] ; then
290 echo "Test 4: UTF-8 support (Compatible with Perl >= 5.8)"
291 if [ $utf8 -eq 0 ] ; then
292 echo " Skipped because UTF-8 support is not available"
293 else
294 for opt in "" "-s" $jitopt; do
295 $valgrind ./pcretest -q $opt $testdata/testinput4 testtry
296 if [ $? = 0 ] ; then
297 $cf $testdata/testoutput4 testtry
298 if [ $? != 0 ] ; then exit 1; fi
299 else exit 1
300 fi
301 if [ "$opt" = "-s" ] ; then echo " OK with study"
302 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
303 else echo " OK"
304 fi
305 done
306 fi
307 fi
308
309 if [ $do5 = yes ] ; then
310 echo "Test 5: API, internals, and non-Perl stuff for UTF-8 support"
311 if [ $utf8 -eq 0 ] ; then
312 echo " Skipped because UTF-8 support is not available"
313 else
314 for opt in "" "-s" $jitopt; do
315 $valgrind ./pcretest -q $opt $testdata/testinput5 testtry
316 if [ $? = 0 ] ; then
317 $cf $testdata/testoutput5 testtry
318 if [ $? != 0 ] ; then exit 1; fi
319 else exit 1
320 fi
321 if [ "$opt" = "-s" ] ; then echo " OK with study"
322 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
323 else echo " OK"
324 fi
325 done
326 fi
327 fi
328
329 if [ $do6 = yes ] ; then
330 echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)"
331 if [ $utf8 -eq 0 -o $ucp -eq 0 ] ; then
332 echo " Skipped because Unicode property support is not available"
333 else
334 for opt in "" "-s" $jitopt; do
335 $valgrind ./pcretest -q $opt $testdata/testinput6 testtry
336 if [ $? = 0 ] ; then
337 $cf $testdata/testoutput6 testtry
338 if [ $? != 0 ] ; then exit 1; fi
339 else exit 1
340 fi
341 if [ "$opt" = "-s" ] ; then echo " OK with study"
342 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
343 else echo " OK"
344 fi
345 done
346 fi
347 fi
348
349 # Tests for DFA matching support
350
351 if [ $do7 = yes ] ; then
352 echo "Test 7: DFA matching"
353 for opt in "" "-s"; do
354 $valgrind ./pcretest -q $opt -dfa $testdata/testinput7 testtry
355 if [ $? = 0 ] ; then
356 $cf $testdata/testoutput7 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 done
362 fi
363
364 if [ $do8 = yes ] ; then
365 echo "Test 8: DFA matching with UTF-8"
366 if [ $utf8 -eq 0 ] ; then
367 echo " Skipped because UTF-8 support is not available"
368 else
369 for opt in "" "-s"; do
370 $valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry
371 if [ $? = 0 ] ; then
372 $cf $testdata/testoutput8 testtry
373 if [ $? != 0 ] ; then exit 1; fi
374 else exit 1
375 fi
376 if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi
377 done
378 fi
379 fi
380
381 if [ $do9 = yes ] ; then
382 echo "Test 9: DFA matching with Unicode properties"
383 if [ $utf8 -eq 0 -o $ucp -eq 0 ] ; then
384 echo " Skipped because Unicode property support is not available"
385 else
386 for opt in "" "-s"; do
387 $valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry
388 if [ $? = 0 ] ; then
389 $cf $testdata/testoutput9 testtry
390 if [ $? != 0 ] ; then exit 1; fi
391 else exit 1
392 fi
393 if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi
394 done
395 fi
396 fi
397
398 # Test of internal offsets and code sizes. This test is run only when there
399 # is Unicode property support and the link size is 2. The actual tests are
400 # mostly the same as in some of the above, but in this test we inspect some
401 # offsets and sizes that require a known link size. This is a doublecheck for
402 # the maintainer, just in case something changes unexpectely.
403
404 if [ $do10 = yes ] ; then
405 echo "Test 10: Internal offsets and code size tests"
406 if [ $link_size -ne 2 ] ; then
407 echo " Skipped because link size is not 2"
408 elif [ $ucp -eq 0 ] ; then
409 echo " Skipped because Unicode property support is not available"
410 else
411 for opt in "" "-s"; do
412 $valgrind ./pcretest -q $opt $testdata/testinput10 testtry
413 if [ $? = 0 ] ; then
414 $cf $testdata/testoutput10 testtry
415 if [ $? != 0 ] ; then exit 1; fi
416 else exit 1
417 fi
418 if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi
419 done
420 fi
421 fi
422
423 # Test of Perl >= 5.10 features without UTF8 support
424
425 if [ $do11 = yes ] ; then
426 echo "Test 11: Features from Perl >= 5.10 without UTF8 support"
427 for opt in "" "-s" $jitopt; do
428 $valgrind ./pcretest -q $opt $testdata/testinput11 testtry
429 if [ $? = 0 ] ; then
430 $cf $testdata/testoutput11 testtry
431 if [ $? != 0 ] ; then exit 1; fi
432 else exit 1
433 fi
434 if [ "$opt" = "-s" ] ; then echo " OK with study"
435 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
436 else echo " OK"
437 fi
438 done
439 fi
440
441 # Test of Perl >= 5.10 features with UTF8 support
442
443 if [ $do12 = yes ] ; then
444 echo "Test 12: Features from Perl >= 5.10 with UTF8 support"
445 if [ $utf8 -eq 0 ] ; then
446 echo " Skipped because UTF-8 support is not available"
447 else
448 for opt in "" "-s" $jitopt; do
449 $valgrind ./pcretest -q $opt $testdata/testinput12 testtry
450 if [ $? = 0 ] ; then
451 $cf $testdata/testoutput12 testtry
452 if [ $? != 0 ] ; then exit 1; fi
453 else exit 1
454 fi
455 if [ "$opt" = "-s" ] ; then echo " OK with study"
456 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
457 else echo " OK"
458 fi
459 done
460 fi
461 fi
462
463 # Test non-Perl-compatible Unicode property support
464
465 if [ $do13 = yes ] ; then
466 echo "Test 13: API, internals, and non-Perl stuff for Unicode property support"
467 if [ $utf8 -eq 0 -o $ucp -eq 0 ] ; then
468 echo " Skipped because Unicode property support is not available"
469 else
470 for opt in "" "-s" $jitopt; do
471 $valgrind ./pcretest -q $opt $testdata/testinput13 testtry
472 if [ $? = 0 ] ; then
473 $cf $testdata/testoutput13 testtry
474 if [ $? != 0 ] ; then exit 1; fi
475 else exit 1
476 fi
477 if [ "$opt" = "-s" ] ; then echo " OK with study"
478 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
479 else echo " OK"
480 fi
481 done
482 fi
483 fi
484
485 # Test JIT-specific features when JIT is available
486
487 if [ $do14 = yes ] ; then
488 echo "Test 14: JIT-specific features (JIT available and usable)"
489 if [ $jit -eq 0 ] ; then
490 echo " Skipped because JIT is not available or not usable"
491 else
492 $valgrind ./pcretest -q $testdata/testinput14 testtry
493 if [ $? = 0 ] ; then
494 $cf $testdata/testoutput14 testtry
495 if [ $? != 0 ] ; then exit 1; fi
496 else exit 1
497 fi
498 echo " OK"
499 fi
500 fi
501
502 # Test JIT-specific features when JIT is not available
503
504 if [ $do15 = yes ] ; then
505 echo "Test 15: JIT-specific features (JIT not available or not usable)"
506 if [ $jit -ne 0 ] ; then
507 echo " Skipped because JIT is available"
508 elif [ $jitnotcompiled -eq 0 ] ; then
509 echo " Skipped because JIT does not support this architecture"
510 else
511 $valgrind ./pcretest -q $testdata/testinput15 testtry
512 if [ $? = 0 ] ; then
513 $cf $testdata/testoutput15 testtry
514 if [ $? != 0 ] ; then exit 1; fi
515 else exit 1
516 fi
517 echo " OK"
518 fi
519 fi
520
521 # End

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.5