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

Contents of /code/trunk/RunTest

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1642 - (show annotations)
Tue Mar 1 12:48:35 2016 UTC (3 years, 9 months ago) by ph10
File size: 29654 byte(s)
Add valgrind suppressions file to RunTest so that issued that are provoked by 
the SSE2 instruction set when JIT is in use are ignored.
1 #! /bin/sh
2
3 ###############################################################################
4 # Run the PCRE tests using the pcretest program. The appropriate tests are
5 # selected, depending on which build-time options were used.
6 #
7 # All tests are now run both with and without -s, to ensure that everything is
8 # tested with and without studying. However, there are some tests that produce
9 # different output after studying, typically when we are tracing the actual
10 # matching process (for example, using auto-callouts). In these few cases, the
11 # tests are duplicated in the files, one with /S to force studying always, and
12 # one with /SS to force *not* studying always. The use of -s doesn't then make
13 # any difference to their output. There is also one test which compiles invalid
14 # UTF-8 with the UTF-8 check turned off; for this, studying must also be
15 # disabled with /SS.
16 #
17 # When JIT support is available, all appropriate tests are also run with -s+ to
18 # test (again, almost) everything with studying and the JIT option, unless
19 # "nojit" is given on the command line. There are also two tests for
20 # JIT-specific features, one to be run when JIT support is available (unless
21 # "nojit" is specified), and one when it is not.
22 #
23 # Whichever of the 8-, 16- and 32-bit libraries exist are tested. It is also
24 # possible to select which to test by giving "-8", "-16" or "-32" on the
25 # command line.
26 #
27 # As well as "nojit", "-8", "-16", and "-32", arguments for this script are
28 # individual test numbers, ranges of tests such as 3-6 or 3- (meaning 3 to the
29 # end), or a number preceded by ~ to exclude a test. For example, "3-15 ~10"
30 # runs tests 3 to 15, excluding test 10, and just "~10" runs all the tests
31 # except test 10. Whatever order the arguments are in, the tests are always run
32 # in numerical order.
33 #
34 # The special argument "3S" runs test 3, stopping if it fails. Test 3 is the
35 # locale test, and failure usually means there's an issue with the locale
36 # rather than a bug in PCRE, so normally subsequent tests are run. "3S" is
37 # useful when you want to debug or update the test.
38 #
39 # Inappropriate tests are automatically skipped (with a comment to say so): for
40 # example, if JIT support is not compiled, test 12 is skipped, whereas if JIT
41 # support is compiled, test 13 is skipped.
42 #
43 # Other arguments can be one of the words "valgrind", "valgrind-log", or "sim"
44 # followed by an argument to run cross-compiled executables under a simulator,
45 # for example:
46 #
47 # RunTest 3 sim "qemu-arm -s 8388608"
48 #
49 # There are two special cases where only one argument is allowed:
50 #
51 # If the first and only argument is "ebcdic", the script runs the special
52 # EBCDIC test that can be useful for checking certain EBCDIC features, even
53 # when run in an ASCII environment.
54 #
55 # If the script is obeyed as "RunTest list", a list of available tests is
56 # output, but none of them are run.
57 ###############################################################################
58
59 # Define test titles in variables so that they can be output as a list. Some
60 # of them are modified (e.g. with -8 or -16) when used in the actual tests.
61
62 title1="Test 1: Main functionality (Compatible with Perl >= 5.10)"
63 title2="Test 2: API, errors, internals, and non-Perl stuff"
64 title3="Test 3: Locale-specific features"
65 title4A="Test 4: UTF"
66 title4B=" support (Compatible with Perl >= 5.10)"
67 title5="Test 5: API, internals, and non-Perl stuff for UTF"
68 title6="Test 6: Unicode property support (Compatible with Perl >= 5.10)"
69 title7="Test 7: API, internals, and non-Perl stuff for Unicode property support"
70 title8="Test 8: DFA matching main functionality"
71 title9="Test 9: DFA matching with UTF"
72 title10="Test 10: DFA matching with Unicode properties"
73 title11="Test 11: Internal offsets and code size tests"
74 title12="Test 12: JIT-specific features (when JIT is available)"
75 title13="Test 13: JIT-specific features (when JIT is not available)"
76 title14="Test 14: Specials for the basic 8-bit library"
77 title15="Test 15: Specials for the 8-bit library with UTF-8 support"
78 title16="Test 16: Specials for the 8-bit library with Unicode propery support"
79 title17="Test 17: Specials for the basic 16/32-bit library"
80 title18="Test 18: Specials for the 16/32-bit library with UTF-16/32 support"
81 title19="Test 19: Specials for the 16/32-bit library with Unicode property support"
82 title20="Test 20: DFA specials for the basic 16/32-bit library"
83 title21="Test 21: Reloads for the basic 16/32-bit library"
84 title22="Test 22: Reloads for the 16/32-bit library with UTF-16/32 support"
85 title23="Test 23: Specials for the 16-bit library"
86 title24="Test 24: Specials for the 16-bit library with UTF-16 support"
87 title25="Test 25: Specials for the 32-bit library"
88 title26="Test 26: Specials for the 32-bit library with UTF-32 support"
89
90 maxtest=26
91
92 if [ $# -eq 1 -a "$1" = "list" ]; then
93 echo $title1
94 echo $title2 "(not UTF)"
95 echo $title3
96 echo $title4A $title4B
97 echo $title5 support
98 echo $title6
99 echo $title7
100 echo $title8
101 echo $title9
102 echo $title10
103 echo $title11
104 echo $title12
105 echo $title13
106 echo $title14
107 echo $title15
108 echo $title16
109 echo $title17
110 echo $title18
111 echo $title19
112 echo $title20
113 echo $title21
114 echo $title22
115 echo $title23
116 echo $title24
117 echo $title25
118 echo $title26
119 exit 0
120 fi
121
122 # Set up a suitable "diff" command for comparison. Some systems
123 # have a diff that lacks a -u option. Try to deal with this.
124
125 cf="diff"
126 diff -u /dev/null /dev/null 2>/dev/null && cf="diff -u"
127
128 # Find the test data
129
130 if [ -n "$srcdir" -a -d "$srcdir" ] ; then
131 testdata="$srcdir/testdata"
132 elif [ -d "./testdata" ] ; then
133 testdata=./testdata
134 elif [ -d "../testdata" ] ; then
135 testdata=../testdata
136 else
137 echo "Cannot find the testdata directory"
138 exit 1
139 fi
140
141
142 # ------ Special EBCDIC Test -------
143
144 if [ $# -eq 1 -a "$1" = "ebcdic" ]; then
145 ./pcretest -C ebcdic >/dev/null
146 ebcdic=$?
147 if [ $ebcdic -ne 1 ] ; then
148 echo "Cannot run EBCDIC tests: EBCDIC support not compiled"
149 exit 1
150 fi
151
152 for opt in "" "-s" "-dfa" "-s -dfa"; do
153 ./pcretest -q $opt $testdata/testinputEBC >testtry
154 if [ $? = 0 ] ; then
155 $cf $testdata/testoutputEBC testtry
156 if [ $? != 0 ] ; then exit 1; fi
157 else exit 1
158 fi
159 if [ "$opt" = "-s" ] ; then echo " OK with study"
160 elif [ "$opt" = "-dfa" ] ; then echo " OK using DFA"
161 elif [ "$opt" = "-s -dfa" ] ; then echo " OK using DFA with study"
162 else echo " OK"
163 fi
164 done
165
166 exit 0
167 fi
168
169
170 # ------ Normal Tests ------
171
172 # Default values
173
174 arg8=
175 arg16=
176 arg32=
177 nojit=
178 sim=
179 skip=
180 valgrind=
181 vjs=
182
183 # This is in case the caller has set aliases (as I do - PH)
184 unset cp ls mv rm
185
186 # Process options and select which tests to run; for those that are explicitly
187 # requested, check that the necessary optional facilities are available.
188
189 do1=no
190 do2=no
191 do3=no
192 do4=no
193 do5=no
194 do6=no
195 do7=no
196 do8=no
197 do9=no
198 do10=no
199 do11=no
200 do12=no
201 do13=no
202 do14=no
203 do15=no
204 do16=no
205 do17=no
206 do18=no
207 do19=no
208 do20=no
209 do21=no
210 do22=no
211 do23=no
212 do24=no
213 do25=no
214 do26=no
215
216 while [ $# -gt 0 ] ; do
217 case $1 in
218 1) do1=yes;;
219 2) do2=yes;;
220 3) do3=yes;;
221 4) do4=yes;;
222 5) do5=yes;;
223 6) do6=yes;;
224 7) do7=yes;;
225 8) do8=yes;;
226 9) do9=yes;;
227 10) do10=yes;;
228 11) do11=yes;;
229 12) do12=yes;;
230 13) do13=yes;;
231 14) do14=yes;;
232 15) do15=yes;;
233 16) do16=yes;;
234 17) do17=yes;;
235 18) do18=yes;;
236 19) do19=yes;;
237 20) do20=yes;;
238 21) do21=yes;;
239 22) do22=yes;;
240 23) do23=yes;;
241 24) do24=yes;;
242 25) do25=yes;;
243 26) do26=yes;;
244 -8) arg8=yes;;
245 -16) arg16=yes;;
246 -32) arg32=yes;;
247 nojit) nojit=yes;;
248 sim) shift; sim=$1;;
249 valgrind) valgrind="valgrind --tool=memcheck -q --smc-check=all";;
250 valgrind-log) valgrind="valgrind --tool=memcheck --num-callers=30 --leak-check=no --error-limit=no --smc-check=all --log-file=report.%p ";;
251 ~*)
252 if expr "$1" : '~[0-9][0-9]*$' >/dev/null; then
253 skip="$skip `expr "$1" : '~\([0-9]*\)*$'`"
254 else
255 echo "Unknown option or test selector '$1'"; exit 1
256 fi
257 ;;
258 *-*)
259 if expr "$1" : '[0-9][0-9]*-[0-9]*$' >/dev/null; then
260 tf=`expr "$1" : '\([0-9]*\)'`
261 tt=`expr "$1" : '.*-\([0-9]*\)'`
262 if [ "$tt" = "" ] ; then tt=$maxtest; fi
263 if expr \( "$tf" "<" 1 \) \| \( "$tt" ">" "$maxtest" \) >/dev/null; then
264 echo "Invalid test range '$1'"; exit 1
265 fi
266 while expr "$tf" "<=" "$tt" >/dev/null; do
267 eval do${tf}=yes
268 tf=`expr $tf + 1`
269 done
270 else
271 echo "Invalid test range '$1'"; exit 1
272 fi
273 ;;
274 *) echo "Unknown option or test selector '$1'"; exit 1;;
275 esac
276 shift
277 done
278
279 # Find which optional facilities are available.
280
281 $sim ./pcretest -C linksize >/dev/null
282 link_size=$?
283 if [ $link_size -lt 2 ] ; then
284 echo "Failed to find internal link size"
285 exit 1
286 fi
287 if [ $link_size -gt 4 ] ; then
288 echo "Failed to find internal link size"
289 exit 1
290 fi
291
292 # All of 8-bit, 16-bit, and 32-bit character strings may be supported, but only
293 # one need be.
294
295 $sim ./pcretest -C pcre8 >/dev/null
296 support8=$?
297 $sim ./pcretest -C pcre16 >/dev/null
298 support16=$?
299 $sim ./pcretest -C pcre32 >/dev/null
300 support32=$?
301
302 # Initialize all bitsizes skipped
303
304 test8=skip
305 test16=skip
306 test32=skip
307
308 # If no bitsize arguments, select all that are available
309
310 if [ "$arg8$arg16$arg32" = "" ] ; then
311 if [ $support8 -ne 0 ] ; then
312 test8=
313 fi
314 if [ $support16 -ne 0 ] ; then
315 test16=-16
316 fi
317 if [ $support32 -ne 0 ] ; then
318 test32=-32
319 fi
320
321 # Select requested bit sizes
322
323 else
324 if [ "$arg8" = yes ] ; then
325 if [ $support8 -eq 0 ] ; then
326 echo "Cannot run 8-bit library tests: 8-bit library not compiled"
327 exit 1
328 fi
329 test8=
330 fi
331 if [ "$arg16" = yes ] ; then
332 if [ $support16 -eq 0 ] ; then
333 echo "Cannot run 16-bit library tests: 16-bit library not compiled"
334 exit 1
335 fi
336 test16=-16
337 fi
338 if [ "$arg32" = yes ] ; then
339 if [ $support32 -eq 0 ] ; then
340 echo "Cannot run 32-bit library tests: 32-bit library not compiled"
341 exit 1
342 fi
343 test32=-32
344 fi
345 fi
346
347 # UTF support always applies to all bit sizes if both are supported; we can't
348 # have UTF-8 support without UTF-16 support (for example).
349
350 $sim ./pcretest -C utf >/dev/null
351 utf=$?
352
353 $sim ./pcretest -C ucp >/dev/null
354 ucp=$?
355
356 jitopt=
357 $sim ./pcretest -C jit >/dev/null
358 jit=$?
359 if [ $jit -ne 0 -a "$nojit" != "yes" ] ; then
360 jitopt=-s+
361 if [ "$valgrind" != "" ] ; then
362 vjs="--suppressions=$testdata/valgrind-jit.supp"
363 fi
364 fi
365
366 # If no specific tests were requested, select all. Those that are not
367 # relevant will be automatically skipped.
368
369 if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \
370 $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
371 $do9 = no -a $do10 = no -a $do11 = no -a $do12 = no -a \
372 $do13 = no -a $do14 = no -a $do15 = no -a $do16 = no -a \
373 $do17 = no -a $do18 = no -a $do19 = no -a $do20 = no -a \
374 $do21 = no -a $do22 = no -a $do23 = no -a $do24 = no -a \
375 $do25 = no -a $do26 = no ] ; then
376 do1=yes
377 do2=yes
378 do3=yes
379 do4=yes
380 do5=yes
381 do6=yes
382 do7=yes
383 do8=yes
384 do9=yes
385 do10=yes
386 do11=yes
387 do12=yes
388 do13=yes
389 do14=yes
390 do15=yes
391 do16=yes
392 do17=yes
393 do18=yes
394 do19=yes
395 do20=yes
396 do21=yes
397 do22=yes
398 do23=yes
399 do24=yes
400 do25=yes
401 do26=yes
402 fi
403
404 # Handle any explicit skips at this stage, so that an argument list may consist
405 # only of explicit skips.
406
407 for i in $skip; do eval do$i=no; done
408
409 # Show which release and which test data
410
411 echo ""
412 echo PCRE C library tests using test data from $testdata
413 $sim ./pcretest /dev/null
414
415 for bmode in "$test8" "$test16" "$test32"; do
416 case "$bmode" in
417 skip) continue;;
418 -16) if [ "$test8$test32" != "skipskip" ] ; then echo ""; fi
419 bits=16; echo "---- Testing 16-bit library ----"; echo "";;
420 -32) if [ "$test8$test16" != "skipskip" ] ; then echo ""; fi
421 bits=32; echo "---- Testing 32-bit library ----"; echo "";;
422 *) bits=8; echo "---- Testing 8-bit library ----"; echo "";;
423 esac
424
425 # Primary test, compatible with JIT and all versions of Perl >= 5.8
426
427 if [ $do1 = yes ] ; then
428 echo $title1
429 for opt in "" "-s" $jitopt; do
430 $sim $valgrind ${opt:+$vjs} ./pcretest -q $bmode $opt $testdata/testinput1 testtry
431 if [ $? = 0 ] ; then
432 $cf $testdata/testoutput1 testtry
433 if [ $? != 0 ] ; then exit 1; fi
434 else exit 1
435 fi
436 if [ "$opt" = "-s" ] ; then echo " OK with study"
437 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
438 else echo " OK"
439 fi
440 done
441 fi
442
443 # PCRE tests that are not JIT or Perl-compatible: API, errors, internals
444
445 if [ $do2 = yes ] ; then
446 echo $title2 "(not UTF-$bits)"
447 for opt in "" "-s" $jitopt; do
448 $sim $valgrind ${opt:+$vjs} ./pcretest -q $bmode $opt $testdata/testinput2 testtry
449 if [ $? = 0 ] ; then
450 $cf $testdata/testoutput2 testtry
451 if [ $? != 0 ] ; then exit 1; fi
452 else
453 echo " "
454 echo "** Test 2 requires a lot of stack. If it has crashed with a"
455 echo "** segmentation fault, it may be that you do not have enough"
456 echo "** stack available by default. Please see the 'pcrestack' man"
457 echo "** page for a discussion of PCRE's stack usage."
458 echo " "
459 exit 1
460 fi
461 if [ "$opt" = "-s" ] ; then echo " OK with study"
462 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
463 else echo " OK"
464 fi
465 done
466 fi
467
468 # Locale-specific tests, provided that either the "fr_FR" or the "french"
469 # locale is available. The former is the Unix-like standard; the latter is
470 # for Windows. Another possibility is "fr". Unfortunately, different versions
471 # of the French locale give different outputs for some items. This test passes
472 # if the output matches any one of the alternative output files.
473
474 if [ $do3 = yes ] ; then
475 locale -a | grep '^fr_FR$' >/dev/null
476 if [ $? -eq 0 ] ; then
477 locale=fr_FR
478 infile=$testdata/testinput3
479 outfile=$testdata/testoutput3
480 outfile2=$testdata/testoutput3A
481 outfile3=$testdata/testoutput3B
482 else
483 infile=test3input
484 outfile=test3output
485 outfile2=test3outputA
486 outfile3=test3outputB
487 locale -a | grep '^french$' >/dev/null
488 if [ $? -eq 0 ] ; then
489 locale=french
490 sed 's/fr_FR/french/' $testdata/testinput3 >test3input
491 sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
492 sed 's/fr_FR/french/' $testdata/testoutput3A >test3outputA
493 sed 's/fr_FR/french/' $testdata/testoutput3B >test3outputB
494 else
495 locale -a | grep '^fr$' >/dev/null
496 if [ $? -eq 0 ] ; then
497 locale=fr
498 sed 's/fr_FR/fr/' $testdata/intestinput3 >test3input
499 sed 's/fr_FR/fr/' $testdata/intestoutput3 >test3output
500 sed 's/fr_FR/fr/' $testdata/intestoutput3A >test3outputA
501 sed 's/fr_FR/fr/' $testdata/intestoutput3B >test3outputB
502 else
503 locale=
504 fi
505 fi
506 fi
507
508 if [ "$locale" != "" ] ; then
509 echo $title3 "(using '$locale' locale)"
510 for opt in "" "-s" $jitopt; do
511 $sim $valgrind ${opt:+$vjs} ./pcretest -q $bmode $opt $infile testtry
512 if [ $? = 0 ] ; then
513 if $cf $outfile testtry >teststdout || \
514 $cf $outfile2 testtry >teststdout || \
515 $cf $outfile3 testtry >teststdout
516 then
517 if [ "$opt" = "-s" ] ; then echo " OK with study"
518 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
519 else echo " OK"
520 fi
521 else
522 echo "** Locale test did not run successfully. The output did not match"
523 echo " $outfile, $outfile2 or $outfile3."
524 echo " This may mean that there is a problem with the locale settings rather"
525 echo " than a bug in PCRE."
526 exit 1
527 fi
528 else exit 1
529 fi
530 done
531 else
532 echo "Cannot test locale-specific features - none of the 'fr_FR', 'fr' or"
533 echo "'french' locales exist, or the \"locale\" command is not available"
534 echo "to check for them."
535 echo " "
536 fi
537 fi
538
539 # Additional tests for UTF support
540
541 if [ $do4 = yes ] ; then
542 echo ${title4A}-${bits}${title4B}
543 if [ $utf -eq 0 ] ; then
544 echo " Skipped because UTF-$bits support is not available"
545 else
546 for opt in "" "-s" $jitopt; do
547 $sim $valgrind ${opt:+$vjs} ./pcretest -q $bmode $opt $testdata/testinput4 testtry
548 if [ $? = 0 ] ; then
549 $cf $testdata/testoutput4 testtry
550 if [ $? != 0 ] ; then exit 1; fi
551 else exit 1
552 fi
553 if [ "$opt" = "-s" ] ; then echo " OK with study"
554 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
555 else echo " OK"
556 fi
557 done
558 fi
559 fi
560
561 if [ $do5 = yes ] ; then
562 echo ${title5}-${bits} support
563 if [ $utf -eq 0 ] ; then
564 echo " Skipped because UTF-$bits support is not available"
565 else
566 for opt in "" "-s" $jitopt; do
567 $sim $valgrind ${opt:+$vjs} ./pcretest -q $bmode $opt $testdata/testinput5 testtry
568 if [ $? = 0 ] ; then
569 $cf $testdata/testoutput5 testtry
570 if [ $? != 0 ] ; then exit 1; fi
571 else exit 1
572 fi
573 if [ "$opt" = "-s" ] ; then echo " OK with study"
574 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
575 else echo " OK"
576 fi
577 done
578 fi
579 fi
580
581 if [ $do6 = yes ] ; then
582 echo $title6
583 if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
584 echo " Skipped because Unicode property support is not available"
585 else
586 for opt in "" "-s" $jitopt; do
587 $sim $valgrind ${opt:+$vjs} ./pcretest -q $bmode $opt $testdata/testinput6 testtry
588 if [ $? = 0 ] ; then
589 $cf $testdata/testoutput6 testtry
590 if [ $? != 0 ] ; then exit 1; fi
591 else exit 1
592 fi
593 if [ "$opt" = "-s" ] ; then echo " OK with study"
594 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
595 else echo " OK"
596 fi
597 done
598 fi
599 fi
600
601 # Test non-Perl-compatible Unicode property support
602
603 if [ $do7 = yes ] ; then
604 echo $title7
605 if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
606 echo " Skipped because Unicode property support is not available"
607 else
608 for opt in "" "-s" $jitopt; do
609 $sim $valgrind ${opt:+$vjs} ./pcretest -q $bmode $opt $testdata/testinput7 testtry
610 if [ $? = 0 ] ; then
611 $cf $testdata/testoutput7 testtry
612 if [ $? != 0 ] ; then exit 1; fi
613 else exit 1
614 fi
615 if [ "$opt" = "-s" ] ; then echo " OK with study"
616 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
617 else echo " OK"
618 fi
619 done
620 fi
621 fi
622
623 # Tests for DFA matching support
624
625 if [ $do8 = yes ] ; then
626 echo $title8
627 for opt in "" "-s"; do
628 $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput8 testtry
629 if [ $? = 0 ] ; then
630 $cf $testdata/testoutput8 testtry
631 if [ $? != 0 ] ; then exit 1; fi
632 else exit 1
633 fi
634 if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi
635 done
636 fi
637
638 if [ $do9 = yes ] ; then
639 echo ${title9}-${bits}
640 if [ $utf -eq 0 ] ; then
641 echo " Skipped because UTF-$bits support is not available"
642 else
643 for opt in "" "-s"; do
644 $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput9 testtry
645 if [ $? = 0 ] ; then
646 $cf $testdata/testoutput9 testtry
647 if [ $? != 0 ] ; then exit 1; fi
648 else exit 1
649 fi
650 if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi
651 done
652 fi
653 fi
654
655 if [ $do10 = yes ] ; then
656 echo $title10
657 if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
658 echo " Skipped because Unicode property support is not available"
659 else
660 for opt in "" "-s"; do
661 $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput10 testtry
662 if [ $? = 0 ] ; then
663 $cf $testdata/testoutput10 testtry
664 if [ $? != 0 ] ; then exit 1; fi
665 else exit 1
666 fi
667 if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi
668 done
669 fi
670 fi
671
672 # Test of internal offsets and code sizes. This test is run only when there
673 # is Unicode property support and the link size is 2. The actual tests are
674 # mostly the same as in some of the above, but in this test we inspect some
675 # offsets and sizes that require a known link size. This is a doublecheck for
676 # the maintainer, just in case something changes unexpectely. The output from
677 # this test is not the same in 8-bit and 16-bit modes.
678
679 if [ $do11 = yes ] ; then
680 echo $title11
681 if [ $link_size -ne 2 ] ; then
682 echo " Skipped because link size is not 2"
683 elif [ $ucp -eq 0 ] ; then
684 echo " Skipped because Unicode property support is not available"
685 else
686 for opt in "" "-s"; do
687 $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput11 testtry
688 if [ $? = 0 ] ; then
689 $cf $testdata/testoutput11-$bits testtry
690 if [ $? != 0 ] ; then exit 1; fi
691 else exit 1
692 fi
693 if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi
694 done
695 fi
696 fi
697
698 # Test JIT-specific features when JIT is available
699
700 if [ $do12 = yes ] ; then
701 echo $title12
702 if [ $jit -eq 0 -o "$nojit" = "yes" ] ; then
703 echo " Skipped because JIT is not available or not usable"
704 else
705 $sim $valgrind $vjs ./pcretest -q $bmode $testdata/testinput12 testtry
706 if [ $? = 0 ] ; then
707 $cf $testdata/testoutput12 testtry
708 if [ $? != 0 ] ; then exit 1; fi
709 else exit 1
710 fi
711 echo " OK"
712 fi
713 fi
714
715 # Test JIT-specific features when JIT is not available
716
717 if [ $do13 = yes ] ; then
718 echo $title13
719 if [ $jit -ne 0 ] ; then
720 echo " Skipped because JIT is available"
721 else
722 $sim $valgrind ./pcretest -q $bmode $testdata/testinput13 testtry
723 if [ $? = 0 ] ; then
724 $cf $testdata/testoutput13 testtry
725 if [ $? != 0 ] ; then exit 1; fi
726 else exit 1
727 fi
728 echo " OK"
729 fi
730 fi
731
732 # Tests for 8-bit-specific features
733
734 if [ "$do14" = yes ] ; then
735 echo $title14
736 if [ "$bits" = "16" -o "$bits" = "32" ] ; then
737 echo " Skipped when running 16/32-bit tests"
738 else
739 cp -f $testdata/saved16 testsaved16
740 cp -f $testdata/saved32 testsaved32
741 for opt in "" "-s" $jitopt; do
742 $sim $valgrind ${opt:+$vjs} ./pcretest -q $bmode $opt $testdata/testinput14 testtry
743 if [ $? = 0 ] ; then
744 $cf $testdata/testoutput14 testtry
745 if [ $? != 0 ] ; then exit 1; fi
746 else exit 1
747 fi
748 if [ "$opt" = "-s" ] ; then echo " OK with study"
749 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
750 else echo " OK"
751 fi
752 done
753 fi
754 fi
755
756 # Tests for 8-bit-specific features (needs UTF-8 support)
757
758 if [ "$do15" = yes ] ; then
759 echo $title15
760 if [ "$bits" = "16" -o "$bits" = "32" ] ; then
761 echo " Skipped when running 16/32-bit tests"
762 elif [ $utf -eq 0 ] ; then
763 echo " Skipped because UTF-$bits support is not available"
764 else
765 for opt in "" "-s" $jitopt; do
766 $sim $valgrind ${opt:+$vjs} ./pcretest -q $bmode $opt $testdata/testinput15 testtry
767 if [ $? = 0 ] ; then
768 $cf $testdata/testoutput15 testtry
769 if [ $? != 0 ] ; then exit 1; fi
770 else exit 1
771 fi
772 if [ "$opt" = "-s" ] ; then echo " OK with study"
773 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
774 else echo " OK"
775 fi
776 done
777 fi
778 fi
779
780 # Tests for 8-bit-specific features (Unicode property support)
781
782 if [ $do16 = yes ] ; then
783 echo $title16
784 if [ "$bits" = "16" -o "$bits" = "32" ] ; then
785 echo " Skipped when running 16/32-bit tests"
786 elif [ $ucp -eq 0 ] ; then
787 echo " Skipped because Unicode property support is not available"
788 else
789 for opt in "" "-s" $jitopt; do
790 $sim $valgrind ${opt:+$vjs} ./pcretest -q $bmode $opt $testdata/testinput16 testtry
791 if [ $? = 0 ] ; then
792 $cf $testdata/testoutput16 testtry
793 if [ $? != 0 ] ; then exit 1; fi
794 else exit 1
795 fi
796 if [ "$opt" = "-s" ] ; then echo " OK with study"
797 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
798 else echo " OK"
799 fi
800 done
801 fi
802 fi
803
804 # Tests for 16/32-bit-specific features
805
806 if [ $do17 = yes ] ; then
807 echo $title17
808 if [ "$bits" = "8" ] ; then
809 echo " Skipped when running 8-bit tests"
810 else
811 for opt in "" "-s" $jitopt; do
812 $sim $valgrind ${opt:+$vjs} ./pcretest -q $bmode $opt $testdata/testinput17 testtry
813 if [ $? = 0 ] ; then
814 $cf $testdata/testoutput17 testtry
815 if [ $? != 0 ] ; then exit 1; fi
816 else exit 1
817 fi
818 if [ "$opt" = "-s" ] ; then echo " OK with study"
819 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
820 else echo " OK"
821 fi
822 done
823 fi
824 fi
825
826 # Tests for 16/32-bit-specific features (UTF-16/32 support)
827
828 if [ $do18 = yes ] ; then
829 echo $title18
830 if [ "$bits" = "8" ] ; then
831 echo " Skipped when running 8-bit tests"
832 elif [ $utf -eq 0 ] ; then
833 echo " Skipped because UTF-$bits support is not available"
834 else
835 for opt in "" "-s" $jitopt; do
836 $sim $valgrind ${opt:+$vjs} ./pcretest -q $bmode $opt $testdata/testinput18 testtry
837 if [ $? = 0 ] ; then
838 $cf $testdata/testoutput18-$bits testtry
839 if [ $? != 0 ] ; then exit 1; fi
840 else exit 1
841 fi
842 if [ "$opt" = "-s" ] ; then echo " OK with study"
843 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
844 else echo " OK"
845 fi
846 done
847 fi
848 fi
849
850 # Tests for 16/32-bit-specific features (Unicode property support)
851
852 if [ $do19 = yes ] ; then
853 echo $title19
854 if [ "$bits" = "8" ] ; then
855 echo " Skipped when running 8-bit tests"
856 elif [ $ucp -eq 0 ] ; then
857 echo " Skipped because Unicode property support is not available"
858 else
859 for opt in "" "-s" $jitopt; do
860 $sim $valgrind ${opt:+$vjs} ./pcretest -q $bmode $opt $testdata/testinput19 testtry
861 if [ $? = 0 ] ; then
862 $cf $testdata/testoutput19 testtry
863 if [ $? != 0 ] ; then exit 1; fi
864 else exit 1
865 fi
866 if [ "$opt" = "-s" ] ; then echo " OK with study"
867 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
868 else echo " OK"
869 fi
870 done
871 fi
872 fi
873
874 # Tests for 16/32-bit-specific features in DFA non-UTF-16/32 mode
875
876 if [ $do20 = yes ] ; then
877 echo $title20
878 if [ "$bits" = "8" ] ; then
879 echo " Skipped when running 8-bit tests"
880 else
881 for opt in "" "-s"; do
882 $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput20 testtry
883 if [ $? = 0 ] ; then
884 $cf $testdata/testoutput20 testtry
885 if [ $? != 0 ] ; then exit 1; fi
886 else exit 1
887 fi
888 if [ "$opt" = "-s" ] ; then echo " OK with study"
889 else echo " OK"
890 fi
891 done
892 fi
893 fi
894
895 # Tests for reloads with 16/32-bit library
896
897 if [ $do21 = yes ] ; then
898 echo $title21
899 if [ "$bits" = "8" ] ; then
900 echo " Skipped when running 8-bit tests"
901 elif [ $link_size -ne 2 ] ; then
902 echo " Skipped because link size is not 2"
903 else
904 cp -f $testdata/saved8 testsaved8
905 cp -f $testdata/saved16LE-1 testsaved16LE-1
906 cp -f $testdata/saved16BE-1 testsaved16BE-1
907 cp -f $testdata/saved32LE-1 testsaved32LE-1
908 cp -f $testdata/saved32BE-1 testsaved32BE-1
909 $sim $valgrind ./pcretest -q $bmode $testdata/testinput21 testtry
910 if [ $? = 0 ] ; then
911 $cf $testdata/testoutput21-$bits testtry
912 if [ $? != 0 ] ; then exit 1; fi
913 else exit 1
914 fi
915 echo " OK"
916 fi
917 fi
918
919 # Tests for reloads with 16/32-bit library (UTF-16 support)
920
921 if [ $do22 = yes ] ; then
922 echo $title22
923 if [ "$bits" = "8" ] ; then
924 echo " Skipped when running 8-bit tests"
925 elif [ $utf -eq 0 ] ; then
926 echo " Skipped because UTF-$bits support is not available"
927 elif [ $link_size -ne 2 ] ; then
928 echo " Skipped because link size is not 2"
929 else
930 cp -f $testdata/saved16LE-2 testsaved16LE-2
931 cp -f $testdata/saved16BE-2 testsaved16BE-2
932 cp -f $testdata/saved32LE-2 testsaved32LE-2
933 cp -f $testdata/saved32BE-2 testsaved32BE-2
934 $sim $valgrind ./pcretest -q $bmode $testdata/testinput22 testtry
935 if [ $? = 0 ] ; then
936 $cf $testdata/testoutput22-$bits testtry
937 if [ $? != 0 ] ; then exit 1; fi
938 else exit 1
939 fi
940 echo " OK"
941 fi
942 fi
943
944 if [ $do23 = yes ] ; then
945 echo $title23
946 if [ "$bits" = "8" -o "$bits" = "32" ] ; then
947 echo " Skipped when running 8/32-bit tests"
948 else
949 $sim $valgrind ./pcretest -q $bmode $testdata/testinput23 testtry
950 if [ $? = 0 ] ; then
951 $cf $testdata/testoutput23 testtry
952 if [ $? != 0 ] ; then exit 1; fi
953 else exit 1
954 fi
955 echo " OK"
956 fi
957 fi
958
959 if [ $do24 = yes ] ; then
960 echo $title24
961 if [ "$bits" = "8" -o "$bits" = "32" ] ; then
962 echo " Skipped when running 8/32-bit tests"
963 elif [ $utf -eq 0 ] ; then
964 echo " Skipped because UTF-$bits support is not available"
965 else
966 $sim $valgrind ./pcretest -q $bmode $testdata/testinput24 testtry
967 if [ $? = 0 ] ; then
968 $cf $testdata/testoutput24 testtry
969 if [ $? != 0 ] ; then exit 1; fi
970 else exit 1
971 fi
972 echo " OK"
973 fi
974 fi
975
976 if [ $do25 = yes ] ; then
977 echo $title25
978 if [ "$bits" = "8" -o "$bits" = "16" ] ; then
979 echo " Skipped when running 8/16-bit tests"
980 else
981 $sim $valgrind ./pcretest -q $bmode $testdata/testinput25 testtry
982 if [ $? = 0 ] ; then
983 $cf $testdata/testoutput25 testtry
984 if [ $? != 0 ] ; then exit 1; fi
985 else exit 1
986 fi
987 echo " OK"
988 fi
989 fi
990
991 if [ $do26 = yes ] ; then
992 echo $title26
993 if [ "$bits" = "8" -o "$bits" = "16" ] ; then
994 echo " Skipped when running 8/16-bit tests"
995 elif [ $utf -eq 0 ] ; then
996 echo " Skipped because UTF-$bits support is not available"
997 else
998 $sim $valgrind ./pcretest -q $bmode $testdata/testinput26 testtry
999 if [ $? = 0 ] ; then
1000 $cf $testdata/testoutput26 testtry
1001 if [ $? != 0 ] ; then exit 1; fi
1002 else exit 1
1003 fi
1004 echo " OK"
1005 fi
1006 fi
1007
1008 # End of loop for 8/16/32-bit tests
1009 done
1010
1011 # Clean up local working files
1012 rm -f test3input test3output test3outputA testNinput testsaved* teststderr teststdout testtry
1013
1014 # End

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.5