switch4g: completely re-writen
[tomato.git] / release / src / router / pcre / RunTest
blob67cfbf07cf9de8feba3e0905f4c6b5ad2198a6f9
1 #! /bin/sh
3 ###############################################################################
4 # Run the PCRE tests using the pcretest program. The appropriate tests are
5 # selected, depending on which build-time options were used.
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.
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.
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.
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.
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.
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.
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:
47 # RunTest 3 sim "qemu-arm -s 8388608"
49 # There are two special cases where only one argument is allowed:
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.
55 # If the script is obeyed as "RunTest list", a list of available tests is
56 # output, but none of them are run.
57 ###############################################################################
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.
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"
90 maxtest=26
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
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.
125 cf="diff"
126 diff -u /dev/null /dev/null 2>/dev/null && cf="diff -u"
128 # Find the test data
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
142 # ------ Special EBCDIC Test -------
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
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
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"
164 done
166 exit 0
170 # ------ Normal Tests ------
172 # Default values
174 arg8=
175 arg16=
176 arg32=
177 nojit=
178 sim=
179 skip=
180 valgrind=
182 # This is in case the caller has set aliases (as I do - PH)
183 unset cp ls mv rm
185 # Process options and select which tests to run; for those that are explicitly
186 # requested, check that the necessary optional facilities are available.
188 do1=no
189 do2=no
190 do3=no
191 do4=no
192 do5=no
193 do6=no
194 do7=no
195 do8=no
196 do9=no
197 do10=no
198 do11=no
199 do12=no
200 do13=no
201 do14=no
202 do15=no
203 do16=no
204 do17=no
205 do18=no
206 do19=no
207 do20=no
208 do21=no
209 do22=no
210 do23=no
211 do24=no
212 do25=no
213 do26=no
215 while [ $# -gt 0 ] ; do
216 case $1 in
217 1) do1=yes;;
218 2) do2=yes;;
219 3) do3=yes;;
220 4) do4=yes;;
221 5) do5=yes;;
222 6) do6=yes;;
223 7) do7=yes;;
224 8) do8=yes;;
225 9) do9=yes;;
226 10) do10=yes;;
227 11) do11=yes;;
228 12) do12=yes;;
229 13) do13=yes;;
230 14) do14=yes;;
231 15) do15=yes;;
232 16) do16=yes;;
233 17) do17=yes;;
234 18) do18=yes;;
235 19) do19=yes;;
236 20) do20=yes;;
237 21) do21=yes;;
238 22) do22=yes;;
239 23) do23=yes;;
240 24) do24=yes;;
241 25) do25=yes;;
242 26) do26=yes;;
243 -8) arg8=yes;;
244 -16) arg16=yes;;
245 -32) arg32=yes;;
246 nojit) nojit=yes;;
247 sim) shift; sim=$1;;
248 valgrind) valgrind="valgrind --tool=memcheck -q --smc-check=all";;
249 valgrind-log) valgrind="valgrind --tool=memcheck --num-callers=30 --leak-check=no --error-limit=no --smc-check=all --log-file=report.%p ";;
251 if expr "$1" : '~[0-9][0-9]*$' >/dev/null; then
252 skip="$skip `expr "$1" : '~\([0-9]*\)*$'`"
253 else
254 echo "Unknown option or test selector '$1'"; exit 1
257 *-*)
258 if expr "$1" : '[0-9][0-9]*-[0-9]*$' >/dev/null; then
259 tf=`expr "$1" : '\([0-9]*\)'`
260 tt=`expr "$1" : '.*-\([0-9]*\)'`
261 if [ "$tt" = "" ] ; then tt=$maxtest; fi
262 if expr \( "$tf" "<" 1 \) \| \( "$tt" ">" "$maxtest" \) >/dev/null; then
263 echo "Invalid test range '$1'"; exit 1
265 while expr "$tf" "<=" "$tt" >/dev/null; do
266 eval do${tf}=yes
267 tf=`expr $tf + 1`
268 done
269 else
270 echo "Invalid test range '$1'"; exit 1
273 *) echo "Unknown option or test selector '$1'"; exit 1;;
274 esac
275 shift
276 done
278 # Find which optional facilities are available.
280 $sim ./pcretest -C linksize >/dev/null
281 link_size=$?
282 if [ $link_size -lt 2 ] ; then
283 echo "Failed to find internal link size"
284 exit 1
286 if [ $link_size -gt 4 ] ; then
287 echo "Failed to find internal link size"
288 exit 1
291 # All of 8-bit, 16-bit, and 32-bit character strings may be supported, but only
292 # one need be.
294 $sim ./pcretest -C pcre8 >/dev/null
295 support8=$?
296 $sim ./pcretest -C pcre16 >/dev/null
297 support16=$?
298 $sim ./pcretest -C pcre32 >/dev/null
299 support32=$?
301 # Initialize all bitsizes skipped
303 test8=skip
304 test16=skip
305 test32=skip
307 # If no bitsize arguments, select all that are available
309 if [ "$arg8$arg16$arg32" = "" ] ; then
310 if [ $support8 -ne 0 ] ; then
311 test8=
313 if [ $support16 -ne 0 ] ; then
314 test16=-16
316 if [ $support32 -ne 0 ] ; then
317 test32=-32
320 # Select requested bit sizes
322 else
323 if [ "$arg8" = yes ] ; then
324 if [ $support8 -eq 0 ] ; then
325 echo "Cannot run 8-bit library tests: 8-bit library not compiled"
326 exit 1
328 test8=
330 if [ "$arg16" = yes ] ; then
331 if [ $support16 -eq 0 ] ; then
332 echo "Cannot run 16-bit library tests: 16-bit library not compiled"
333 exit 1
335 test16=-16
337 if [ "$arg32" = yes ] ; then
338 if [ $support32 -eq 0 ] ; then
339 echo "Cannot run 32-bit library tests: 32-bit library not compiled"
340 exit 1
342 test32=-32
346 # UTF support always applies to all bit sizes if both are supported; we can't
347 # have UTF-8 support without UTF-16 support (for example).
349 $sim ./pcretest -C utf >/dev/null
350 utf=$?
352 $sim ./pcretest -C ucp >/dev/null
353 ucp=$?
355 jitopt=
356 $sim ./pcretest -C jit >/dev/null
357 jit=$?
358 if [ $jit -ne 0 -a "$nojit" != "yes" ] ; then
359 jitopt=-s+
362 # If no specific tests were requested, select all. Those that are not
363 # relevant will be automatically skipped.
365 if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \
366 $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
367 $do9 = no -a $do10 = no -a $do11 = no -a $do12 = no -a \
368 $do13 = no -a $do14 = no -a $do15 = no -a $do16 = no -a \
369 $do17 = no -a $do18 = no -a $do19 = no -a $do20 = no -a \
370 $do21 = no -a $do22 = no -a $do23 = no -a $do24 = no -a \
371 $do25 = no -a $do26 = no ] ; then
372 do1=yes
373 do2=yes
374 do3=yes
375 do4=yes
376 do5=yes
377 do6=yes
378 do7=yes
379 do8=yes
380 do9=yes
381 do10=yes
382 do11=yes
383 do12=yes
384 do13=yes
385 do14=yes
386 do15=yes
387 do16=yes
388 do17=yes
389 do18=yes
390 do19=yes
391 do20=yes
392 do21=yes
393 do22=yes
394 do23=yes
395 do24=yes
396 do25=yes
397 do26=yes
400 # Handle any explicit skips at this stage, so that an argument list may consist
401 # only of explicit skips.
403 for i in $skip; do eval do$i=no; done
405 # Show which release and which test data
407 echo ""
408 echo PCRE C library tests using test data from $testdata
409 $sim ./pcretest /dev/null
411 for bmode in "$test8" "$test16" "$test32"; do
412 case "$bmode" in
413 skip) continue;;
414 -16) if [ "$test8$test32" != "skipskip" ] ; then echo ""; fi
415 bits=16; echo "---- Testing 16-bit library ----"; echo "";;
416 -32) if [ "$test8$test16" != "skipskip" ] ; then echo ""; fi
417 bits=32; echo "---- Testing 32-bit library ----"; echo "";;
418 *) bits=8; echo "---- Testing 8-bit library ----"; echo "";;
419 esac
421 # Primary test, compatible with JIT and all versions of Perl >= 5.8
423 if [ $do1 = yes ] ; then
424 echo $title1
425 for opt in "" "-s" $jitopt; do
426 $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput1 testtry
427 if [ $? = 0 ] ; then
428 $cf $testdata/testoutput1 testtry
429 if [ $? != 0 ] ; then exit 1; fi
430 else exit 1
432 if [ "$opt" = "-s" ] ; then echo " OK with study"
433 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
434 else echo " OK"
436 done
439 # PCRE tests that are not JIT or Perl-compatible: API, errors, internals
441 if [ $do2 = yes ] ; then
442 echo $title2 "(not UTF-$bits)"
443 for opt in "" "-s" $jitopt; do
444 $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput2 testtry
445 if [ $? = 0 ] ; then
446 $cf $testdata/testoutput2 testtry
447 if [ $? != 0 ] ; then exit 1; fi
448 else
449 echo " "
450 echo "** Test 2 requires a lot of stack. If it has crashed with a"
451 echo "** segmentation fault, it may be that you do not have enough"
452 echo "** stack available by default. Please see the 'pcrestack' man"
453 echo "** page for a discussion of PCRE's stack usage."
454 echo " "
455 exit 1
457 if [ "$opt" = "-s" ] ; then echo " OK with study"
458 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
459 else echo " OK"
461 done
464 # Locale-specific tests, provided that either the "fr_FR" or the "french"
465 # locale is available. The former is the Unix-like standard; the latter is
466 # for Windows. Another possibility is "fr". Unfortunately, different versions
467 # of the French locale give different outputs for some items. This test passes
468 # if the output matches any one of the alternative output files.
470 if [ $do3 = yes ] ; then
471 locale -a | grep '^fr_FR$' >/dev/null
472 if [ $? -eq 0 ] ; then
473 locale=fr_FR
474 infile=$testdata/testinput3
475 outfile=$testdata/testoutput3
476 outfile2=$testdata/testoutput3A
477 outfile3=$testdata/testoutput3B
478 else
479 infile=test3input
480 outfile=test3output
481 outfile2=test3outputA
482 outfile3=test3outputB
483 locale -a | grep '^french$' >/dev/null
484 if [ $? -eq 0 ] ; then
485 locale=french
486 sed 's/fr_FR/french/' $testdata/testinput3 >test3input
487 sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
488 sed 's/fr_FR/french/' $testdata/testoutput3A >test3outputA
489 sed 's/fr_FR/french/' $testdata/testoutput3B >test3outputB
490 else
491 locale -a | grep '^fr$' >/dev/null
492 if [ $? -eq 0 ] ; then
493 locale=fr
494 sed 's/fr_FR/fr/' $testdata/intestinput3 >test3input
495 sed 's/fr_FR/fr/' $testdata/intestoutput3 >test3output
496 sed 's/fr_FR/fr/' $testdata/intestoutput3A >test3outputA
497 sed 's/fr_FR/fr/' $testdata/intestoutput3B >test3outputB
498 else
499 locale=
504 if [ "$locale" != "" ] ; then
505 echo $title3 "(using '$locale' locale)"
506 for opt in "" "-s" $jitopt; do
507 $sim $valgrind ./pcretest -q $bmode $opt $infile testtry
508 if [ $? = 0 ] ; then
509 if $cf $outfile testtry >teststdout || \
510 $cf $outfile2 testtry >teststdout || \
511 $cf $outfile3 testtry >teststdout
512 then
513 if [ "$opt" = "-s" ] ; then echo " OK with study"
514 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
515 else echo " OK"
517 else
518 echo "** Locale test did not run successfully. The output did not match"
519 echo " $outfile, $outfile2 or $outfile3."
520 echo " This may mean that there is a problem with the locale settings rather"
521 echo " than a bug in PCRE."
522 exit 1
524 else exit 1
526 done
527 else
528 echo "Cannot test locale-specific features - none of the 'fr_FR', 'fr' or"
529 echo "'french' locales exist, or the \"locale\" command is not available"
530 echo "to check for them."
531 echo " "
535 # Additional tests for UTF support
537 if [ $do4 = yes ] ; then
538 echo ${title4A}-${bits}${title4B}
539 if [ $utf -eq 0 ] ; then
540 echo " Skipped because UTF-$bits support is not available"
541 else
542 for opt in "" "-s" $jitopt; do
543 $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput4 testtry
544 if [ $? = 0 ] ; then
545 $cf $testdata/testoutput4 testtry
546 if [ $? != 0 ] ; then exit 1; fi
547 else exit 1
549 if [ "$opt" = "-s" ] ; then echo " OK with study"
550 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
551 else echo " OK"
553 done
557 if [ $do5 = yes ] ; then
558 echo ${title5}-${bits} support
559 if [ $utf -eq 0 ] ; then
560 echo " Skipped because UTF-$bits support is not available"
561 else
562 for opt in "" "-s" $jitopt; do
563 $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput5 testtry
564 if [ $? = 0 ] ; then
565 $cf $testdata/testoutput5 testtry
566 if [ $? != 0 ] ; then exit 1; fi
567 else exit 1
569 if [ "$opt" = "-s" ] ; then echo " OK with study"
570 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
571 else echo " OK"
573 done
577 if [ $do6 = yes ] ; then
578 echo $title6
579 if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
580 echo " Skipped because Unicode property support is not available"
581 else
582 for opt in "" "-s" $jitopt; do
583 $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput6 testtry
584 if [ $? = 0 ] ; then
585 $cf $testdata/testoutput6 testtry
586 if [ $? != 0 ] ; then exit 1; fi
587 else exit 1
589 if [ "$opt" = "-s" ] ; then echo " OK with study"
590 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
591 else echo " OK"
593 done
597 # Test non-Perl-compatible Unicode property support
599 if [ $do7 = yes ] ; then
600 echo $title7
601 if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
602 echo " Skipped because Unicode property support is not available"
603 else
604 for opt in "" "-s" $jitopt; do
605 $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput7 testtry
606 if [ $? = 0 ] ; then
607 $cf $testdata/testoutput7 testtry
608 if [ $? != 0 ] ; then exit 1; fi
609 else exit 1
611 if [ "$opt" = "-s" ] ; then echo " OK with study"
612 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
613 else echo " OK"
615 done
619 # Tests for DFA matching support
621 if [ $do8 = yes ] ; then
622 echo $title8
623 for opt in "" "-s"; do
624 $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput8 testtry
625 if [ $? = 0 ] ; then
626 $cf $testdata/testoutput8 testtry
627 if [ $? != 0 ] ; then exit 1; fi
628 else exit 1
630 if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi
631 done
634 if [ $do9 = yes ] ; then
635 echo ${title9}-${bits}
636 if [ $utf -eq 0 ] ; then
637 echo " Skipped because UTF-$bits support is not available"
638 else
639 for opt in "" "-s"; do
640 $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput9 testtry
641 if [ $? = 0 ] ; then
642 $cf $testdata/testoutput9 testtry
643 if [ $? != 0 ] ; then exit 1; fi
644 else exit 1
646 if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi
647 done
651 if [ $do10 = yes ] ; then
652 echo $title10
653 if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
654 echo " Skipped because Unicode property support is not available"
655 else
656 for opt in "" "-s"; do
657 $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput10 testtry
658 if [ $? = 0 ] ; then
659 $cf $testdata/testoutput10 testtry
660 if [ $? != 0 ] ; then exit 1; fi
661 else exit 1
663 if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi
664 done
668 # Test of internal offsets and code sizes. This test is run only when there
669 # is Unicode property support and the link size is 2. The actual tests are
670 # mostly the same as in some of the above, but in this test we inspect some
671 # offsets and sizes that require a known link size. This is a doublecheck for
672 # the maintainer, just in case something changes unexpectely. The output from
673 # this test is not the same in 8-bit and 16-bit modes.
675 if [ $do11 = yes ] ; then
676 echo $title11
677 if [ $link_size -ne 2 ] ; then
678 echo " Skipped because link size is not 2"
679 elif [ $ucp -eq 0 ] ; then
680 echo " Skipped because Unicode property support is not available"
681 else
682 for opt in "" "-s"; do
683 $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput11 testtry
684 if [ $? = 0 ] ; then
685 $cf $testdata/testoutput11-$bits testtry
686 if [ $? != 0 ] ; then exit 1; fi
687 else exit 1
689 if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi
690 done
694 # Test JIT-specific features when JIT is available
696 if [ $do12 = yes ] ; then
697 echo $title12
698 if [ $jit -eq 0 -o "$nojit" = "yes" ] ; then
699 echo " Skipped because JIT is not available or not usable"
700 else
701 $sim $valgrind ./pcretest -q $bmode $testdata/testinput12 testtry
702 if [ $? = 0 ] ; then
703 $cf $testdata/testoutput12 testtry
704 if [ $? != 0 ] ; then exit 1; fi
705 else exit 1
707 echo " OK"
711 # Test JIT-specific features when JIT is not available
713 if [ $do13 = yes ] ; then
714 echo $title13
715 if [ $jit -ne 0 ] ; then
716 echo " Skipped because JIT is available"
717 else
718 $sim $valgrind ./pcretest -q $bmode $testdata/testinput13 testtry
719 if [ $? = 0 ] ; then
720 $cf $testdata/testoutput13 testtry
721 if [ $? != 0 ] ; then exit 1; fi
722 else exit 1
724 echo " OK"
728 # Tests for 8-bit-specific features
730 if [ "$do14" = yes ] ; then
731 echo $title14
732 if [ "$bits" = "16" -o "$bits" = "32" ] ; then
733 echo " Skipped when running 16/32-bit tests"
734 else
735 cp -f $testdata/saved16 testsaved16
736 cp -f $testdata/saved32 testsaved32
737 for opt in "" "-s" $jitopt; do
738 $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput14 testtry
739 if [ $? = 0 ] ; then
740 $cf $testdata/testoutput14 testtry
741 if [ $? != 0 ] ; then exit 1; fi
742 else exit 1
744 if [ "$opt" = "-s" ] ; then echo " OK with study"
745 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
746 else echo " OK"
748 done
752 # Tests for 8-bit-specific features (needs UTF-8 support)
754 if [ "$do15" = yes ] ; then
755 echo $title15
756 if [ "$bits" = "16" -o "$bits" = "32" ] ; then
757 echo " Skipped when running 16/32-bit tests"
758 elif [ $utf -eq 0 ] ; then
759 echo " Skipped because UTF-$bits support is not available"
760 else
761 for opt in "" "-s" $jitopt; do
762 $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput15 testtry
763 if [ $? = 0 ] ; then
764 $cf $testdata/testoutput15 testtry
765 if [ $? != 0 ] ; then exit 1; fi
766 else exit 1
768 if [ "$opt" = "-s" ] ; then echo " OK with study"
769 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
770 else echo " OK"
772 done
776 # Tests for 8-bit-specific features (Unicode property support)
778 if [ $do16 = yes ] ; then
779 echo $title16
780 if [ "$bits" = "16" -o "$bits" = "32" ] ; then
781 echo " Skipped when running 16/32-bit tests"
782 elif [ $ucp -eq 0 ] ; then
783 echo " Skipped because Unicode property support is not available"
784 else
785 for opt in "" "-s" $jitopt; do
786 $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput16 testtry
787 if [ $? = 0 ] ; then
788 $cf $testdata/testoutput16 testtry
789 if [ $? != 0 ] ; then exit 1; fi
790 else exit 1
792 if [ "$opt" = "-s" ] ; then echo " OK with study"
793 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
794 else echo " OK"
796 done
800 # Tests for 16/32-bit-specific features
802 if [ $do17 = yes ] ; then
803 echo $title17
804 if [ "$bits" = "8" ] ; then
805 echo " Skipped when running 8-bit tests"
806 else
807 for opt in "" "-s" $jitopt; do
808 $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput17 testtry
809 if [ $? = 0 ] ; then
810 $cf $testdata/testoutput17 testtry
811 if [ $? != 0 ] ; then exit 1; fi
812 else exit 1
814 if [ "$opt" = "-s" ] ; then echo " OK with study"
815 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
816 else echo " OK"
818 done
822 # Tests for 16/32-bit-specific features (UTF-16/32 support)
824 if [ $do18 = yes ] ; then
825 echo $title18
826 if [ "$bits" = "8" ] ; then
827 echo " Skipped when running 8-bit tests"
828 elif [ $utf -eq 0 ] ; then
829 echo " Skipped because UTF-$bits support is not available"
830 else
831 for opt in "" "-s" $jitopt; do
832 $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput18 testtry
833 if [ $? = 0 ] ; then
834 $cf $testdata/testoutput18-$bits testtry
835 if [ $? != 0 ] ; then exit 1; fi
836 else exit 1
838 if [ "$opt" = "-s" ] ; then echo " OK with study"
839 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
840 else echo " OK"
842 done
846 # Tests for 16/32-bit-specific features (Unicode property support)
848 if [ $do19 = yes ] ; then
849 echo $title19
850 if [ "$bits" = "8" ] ; then
851 echo " Skipped when running 8-bit tests"
852 elif [ $ucp -eq 0 ] ; then
853 echo " Skipped because Unicode property support is not available"
854 else
855 for opt in "" "-s" $jitopt; do
856 $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput19 testtry
857 if [ $? = 0 ] ; then
858 $cf $testdata/testoutput19 testtry
859 if [ $? != 0 ] ; then exit 1; fi
860 else exit 1
862 if [ "$opt" = "-s" ] ; then echo " OK with study"
863 elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
864 else echo " OK"
866 done
870 # Tests for 16/32-bit-specific features in DFA non-UTF-16/32 mode
872 if [ $do20 = yes ] ; then
873 echo $title20
874 if [ "$bits" = "8" ] ; then
875 echo " Skipped when running 8-bit tests"
876 else
877 for opt in "" "-s"; do
878 $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput20 testtry
879 if [ $? = 0 ] ; then
880 $cf $testdata/testoutput20 testtry
881 if [ $? != 0 ] ; then exit 1; fi
882 else exit 1
884 if [ "$opt" = "-s" ] ; then echo " OK with study"
885 else echo " OK"
887 done
891 # Tests for reloads with 16/32-bit library
893 if [ $do21 = yes ] ; then
894 echo $title21
895 if [ "$bits" = "8" ] ; then
896 echo " Skipped when running 8-bit tests"
897 elif [ $link_size -ne 2 ] ; then
898 echo " Skipped because link size is not 2"
899 else
900 cp -f $testdata/saved8 testsaved8
901 cp -f $testdata/saved16LE-1 testsaved16LE-1
902 cp -f $testdata/saved16BE-1 testsaved16BE-1
903 cp -f $testdata/saved32LE-1 testsaved32LE-1
904 cp -f $testdata/saved32BE-1 testsaved32BE-1
905 $sim $valgrind ./pcretest -q $bmode $testdata/testinput21 testtry
906 if [ $? = 0 ] ; then
907 $cf $testdata/testoutput21-$bits testtry
908 if [ $? != 0 ] ; then exit 1; fi
909 else exit 1
911 echo " OK"
915 # Tests for reloads with 16/32-bit library (UTF-16 support)
917 if [ $do22 = yes ] ; then
918 echo $title22
919 if [ "$bits" = "8" ] ; then
920 echo " Skipped when running 8-bit tests"
921 elif [ $utf -eq 0 ] ; then
922 echo " Skipped because UTF-$bits support is not available"
923 elif [ $link_size -ne 2 ] ; then
924 echo " Skipped because link size is not 2"
925 else
926 cp -f $testdata/saved16LE-2 testsaved16LE-2
927 cp -f $testdata/saved16BE-2 testsaved16BE-2
928 cp -f $testdata/saved32LE-2 testsaved32LE-2
929 cp -f $testdata/saved32BE-2 testsaved32BE-2
930 $sim $valgrind ./pcretest -q $bmode $testdata/testinput22 testtry
931 if [ $? = 0 ] ; then
932 $cf $testdata/testoutput22-$bits testtry
933 if [ $? != 0 ] ; then exit 1; fi
934 else exit 1
936 echo " OK"
940 if [ $do23 = yes ] ; then
941 echo $title23
942 if [ "$bits" = "8" -o "$bits" = "32" ] ; then
943 echo " Skipped when running 8/32-bit tests"
944 else
945 $sim $valgrind ./pcretest -q $bmode $testdata/testinput23 testtry
946 if [ $? = 0 ] ; then
947 $cf $testdata/testoutput23 testtry
948 if [ $? != 0 ] ; then exit 1; fi
949 else exit 1
951 echo " OK"
955 if [ $do24 = yes ] ; then
956 echo $title24
957 if [ "$bits" = "8" -o "$bits" = "32" ] ; then
958 echo " Skipped when running 8/32-bit tests"
959 elif [ $utf -eq 0 ] ; then
960 echo " Skipped because UTF-$bits support is not available"
961 else
962 $sim $valgrind ./pcretest -q $bmode $testdata/testinput24 testtry
963 if [ $? = 0 ] ; then
964 $cf $testdata/testoutput24 testtry
965 if [ $? != 0 ] ; then exit 1; fi
966 else exit 1
968 echo " OK"
972 if [ $do25 = yes ] ; then
973 echo $title25
974 if [ "$bits" = "8" -o "$bits" = "16" ] ; then
975 echo " Skipped when running 8/16-bit tests"
976 else
977 $sim $valgrind ./pcretest -q $bmode $testdata/testinput25 testtry
978 if [ $? = 0 ] ; then
979 $cf $testdata/testoutput25 testtry
980 if [ $? != 0 ] ; then exit 1; fi
981 else exit 1
983 echo " OK"
987 if [ $do26 = yes ] ; then
988 echo $title26
989 if [ "$bits" = "8" -o "$bits" = "16" ] ; then
990 echo " Skipped when running 8/16-bit tests"
991 elif [ $utf -eq 0 ] ; then
992 echo " Skipped because UTF-$bits support is not available"
993 else
994 $sim $valgrind ./pcretest -q $bmode $testdata/testinput26 testtry
995 if [ $? = 0 ] ; then
996 $cf $testdata/testoutput26 testtry
997 if [ $? != 0 ] ; then exit 1; fi
998 else exit 1
1000 echo " OK"
1004 # End of loop for 8/16/32-bit tests
1005 done
1007 # Clean up local working files
1008 rm -f test3input test3output test3outputA testNinput testsaved* teststderr teststdout testtry
1010 # End