blob: 36dc638edd7c689313299e4e90da363018f0b4b5 [file] [log] [blame]
Janis Danisevskis53e448c2016-03-31 13:35:25 +01001#! /bin/sh
2
3###############################################################################
4# Run the PCRE2 tests using the pcre2test program. The appropriate tests are
5# selected, depending on which build-time options were used.
6#
7# When JIT support is available, all appropriate tests are run with and without
8# JIT, unless "-nojit" is given on the command line. There are also two tests
9# for JIT-specific features, one to be run when JIT support is available
10# (unless "-nojit" is specified), and one when it is not.
11#
12# Whichever of the 8-, 16- and 32-bit libraries exist are tested. It is also
13# possible to select which to test by giving "-8", "-16" or "-32" on the
14# command line.
15#
16# As well as "-nojit", "-8", "-16", and "-32", arguments for this script are
17# individual test numbers, ranges of tests such as 3-6 or 3- (meaning 3 to the
18# end), or a number preceded by ~ to exclude a test. For example, "3-15 ~10"
19# runs tests 3 to 15, excluding test 10, and just "~10" runs all the tests
20# except test 10. Whatever order the arguments are in, the tests are always run
21# in numerical order.
22#
23# Inappropriate tests are automatically skipped (with a comment to say so). For
24# example, if JIT support is not compiled, test 16 is skipped, whereas if JIT
25# support is compiled, test 15 is skipped.
26#
27# Other arguments can be one of the words "-valgrind", "-valgrind-log", or
28# "-sim" followed by an argument to run cross-compiled executables under a
29# simulator, for example:
30#
31# RunTest 3 -sim "qemu-arm -s 8388608"
32#
33# For backwards compatibility, -nojit, -valgrind, -valgrind-log, and -sim may
34# be given without the leading "-" character.
35#
36# When PCRE2 is compiled by clang with -fsanitize arguments, some tests need
37# very much more stack than normal. In environments where the stack can be
38# set at runtime, -bigstack sets a gigantic stack.
39#
40# There are two special cases where only one argument is allowed:
41#
42# If the first and only argument is "ebcdic", the script runs the special
43# EBCDIC test that can be useful for checking certain EBCDIC features, even
44# when run in an ASCII environment. PCRE2 must be built with EBCDIC support for
45# this test to be run.
46#
47# If the script is obeyed as "RunTest list", a list of available tests is
48# output, but none of them are run.
49###############################################################################
50
51# Define test titles in variables so that they can be output as a list. Some
52# of them are modified (e.g. with -8 or -16) when used in the actual tests.
53
54title0="Test 0: Unchecked pcre2test argument tests (to improve coverage)"
55title1="Test 1: Main non-UTF, non-UCP functionality (compatible with Perl >= 5.10)"
56title2="Test 2: API, errors, internals, and non-Perl stuff"
57title3="Test 3: Locale-specific features"
58title4A="Test 4: UTF"
59title4B=" and Unicode property support (compatible with Perl >= 5.10)"
60title5A="Test 5: API, internals, and non-Perl stuff for UTF"
61title5B=" and UCP support"
62title6="Test 6: DFA matching main non-UTF, non-UCP functionality"
63title7A="Test 7: DFA matching with UTF"
64title7B=" and Unicode property support"
65title8="Test 8: Internal offsets and code size tests"
66title9="Test 9: Specials for the basic 8-bit library"
67title10="Test 10: Specials for the 8-bit library with UTF-8 and UCP support"
68title11="Test 11: Specials for the basic 16-bit and 32-bit libraries"
69title12="Test 12: Specials for the 16-bit and 32-bit libraries UTF and UCP support"
70title13="Test 13: DFA specials for the basic 16-bit and 32-bit libraries"
71title14="Test 14: DFA specials for UTF and UCP support"
72title15="Test 15: Non-JIT limits and other non-JIT tests"
73title16="Test 16: JIT-specific features when JIT is not available"
74title17="Test 17: JIT-specific features when JIT is available"
75title18="Test 18: Tests of the POSIX interface, excluding UTF/UCP"
76title19="Test 19: Tests of the POSIX interface with UTF/UCP"
77title20="Test 20: Serialization tests"
78title21="Test 21: \C tests without UTF (supported for DFA matching)"
79title22="Test 22: \C tests with UTF (not supported for DFA matching)"
80title23="Test 23: \C disabled test"
81maxtest=23
82
83if [ $# -eq 1 -a "$1" = "list" ]; then
84 echo $title0
85 echo $title1
86 echo $title2 "(not UTF or UCP)"
87 echo $title3
88 echo $title4A $title4B
89 echo $title5A $title5B
90 echo $title6
91 echo $title7A $title7B
92 echo $title8
93 echo $title9
94 echo $title10
95 echo $title11
96 echo $title12
97 echo $title13
98 echo $title14
99 echo $title15
100 echo $title16
101 echo $title17
102 echo $title18
103 echo $title19
104 echo $title20
105 echo $title21
106 echo $title22
107 echo $title23
108 exit 0
109fi
110
111# Set up a suitable "diff" command for comparison. Some systems
112# have a diff that lacks a -u option. Try to deal with this.
113
114cf="diff"
115diff -u /dev/null /dev/null 2>/dev/null && cf="diff -u"
116
117# Find the test data
118
119if [ -n "$srcdir" -a -d "$srcdir" ] ; then
120 testdata="$srcdir/testdata"
121elif [ -d "./testdata" ] ; then
122 testdata=./testdata
123elif [ -d "../testdata" ] ; then
124 testdata=../testdata
125else
126 echo "Cannot find the testdata directory"
127 exit 1
128fi
129
130
131# ------ Function to check results of a test -------
132
133# This function is called with three parameters:
134#
135# $1 the value of $? after a call to pcre2test
136# $2 the suffix of the output file to compare with
137# $3 the $opt value (empty, -jit, or -dfa)
138#
139# Note: must define using name(), not "function name", for Solaris.
140
141checkresult()
142 {
143 if [ $1 -ne 0 ] ; then
144 echo "** pcre2test failed - check testtry"
145 exit 1
146 fi
147 case "$3" in
148 -jit) with=" with JIT";;
149 -dfa) with=" with DFA";;
150 *) with="";;
151 esac
152 $cf $testdata/testoutput$2 testtry
153 if [ $? != 0 ] ; then
154 echo ""
155 echo "** Test $2 failed$with"
156 exit 1
157 fi
158 echo " OK$with"
159 }
160
161
162# ------ Function to run and check a special pcre2test arguments test -------
163
164checkspecial()
165 {
166 $valgrind $vjs ./pcre2test $1 >>testtry
167 if [ $? -ne 0 ] ; then
168 echo "** pcre2test $1 failed - check testtry"
169 exit 1
170 fi
171 }
172
173
174# ------ Special EBCDIC Test -------
175
176if [ $# -eq 1 -a "$1" = "ebcdic" ]; then
177 $valgrind ./pcre2test -C ebcdic >/dev/null
178 ebcdic=$?
179 if [ $ebcdic -ne 1 ] ; then
180 echo "Cannot run EBCDIC tests: EBCDIC support not compiled"
181 exit 1
182 fi
183 for opt in "" "-dfa"; do
184 ./pcre2test -q $opt $testdata/testinputEBC >testtry
185 checkresult $? EBC "$opt"
186 done
187exit 0
188fi
189
190
191# ------ Normal Tests ------
192
193# Default values
194
195arg8=
196arg16=
197arg32=
198nojit=
199bigstack=
200sim=
201skip=
202valgrind=
203vjs=
204
205# This is in case the caller has set aliases (as I do - PH)
206unset cp ls mv rm
207
208# Process options and select which tests to run; for those that are explicitly
209# requested, check that the necessary optional facilities are available.
210
211do0=no
212do1=no
213do2=no
214do3=no
215do4=no
216do5=no
217do6=no
218do7=no
219do8=no
220do9=no
221do10=no
222do11=no
223do12=no
224do13=no
225do14=no
226do15=no
227do16=no
228do17=no
229do18=no
230do19=no
231do20=no
232do21=no
233do22=no
234do23=no
235
236while [ $# -gt 0 ] ; do
237 case $1 in
238 0) do0=yes;;
239 1) do1=yes;;
240 2) do2=yes;;
241 3) do3=yes;;
242 4) do4=yes;;
243 5) do5=yes;;
244 6) do6=yes;;
245 7) do7=yes;;
246 8) do8=yes;;
247 9) do9=yes;;
248 10) do10=yes;;
249 11) do11=yes;;
250 12) do12=yes;;
251 13) do13=yes;;
252 14) do14=yes;;
253 15) do15=yes;;
254 16) do16=yes;;
255 17) do17=yes;;
256 18) do18=yes;;
257 19) do19=yes;;
258 20) do20=yes;;
259 21) do21=yes;;
260 22) do22=yes;;
261 23) do23=yes;;
262 -8) arg8=yes;;
263 -16) arg16=yes;;
264 -32) arg32=yes;;
265 bigstack|-bigstack) bigstack=yes;;
266 nojit|-nojit) nojit=yes;;
267 sim|-sim) shift; sim=$1;;
268 valgrind|-valgrind) valgrind="valgrind --tool=memcheck -q --smc-check=all";;
269 valgrind-log|-valgrind-log) valgrind="valgrind --tool=memcheck --num-callers=30 --leak-check=no --error-limit=no --smc-check=all --log-file=report.%p ";;
270 ~*)
271 if expr "$1" : '~[0-9][0-9]*$' >/dev/null; then
272 skip="$skip `expr "$1" : '~\([0-9]*\)*$'`"
273 else
274 echo "Unknown option or test selector '$1'"; exit 1
275 fi
276 ;;
277 *-*)
278 if expr "$1" : '[0-9][0-9]*-[0-9]*$' >/dev/null; then
279 tf=`expr "$1" : '\([0-9]*\)'`
280 tt=`expr "$1" : '.*-\([0-9]*\)'`
281 if [ "$tt" = "" ] ; then tt=$maxtest; fi
282 if expr \( "$tt" ">" "$maxtest" \) >/dev/null; then
283 echo "Invalid test range '$1'"; exit 1
284 fi
285 while expr "$tf" "<=" "$tt" >/dev/null; do
286 eval do${tf}=yes
287 tf=`expr $tf + 1`
288 done
289 else
290 echo "Invalid test range '$1'"; exit 1
291 fi
292 ;;
293 *) echo "Unknown option or test selector '$1'"; exit 1;;
294 esac
295 shift
296done
297
298# Find which optional facilities are available.
299
300$sim ./pcre2test -C linksize >/dev/null
301link_size=$?
302if [ $link_size -lt 2 ] ; then
303 echo "RunTest: Failed to find internal link size"
304 exit 1
305fi
306if [ $link_size -gt 4 ] ; then
307 echo "RunTest: Failed to find internal link size"
308 exit 1
309fi
310
311# If it is possible to set the system stack size, arrange to set a value for
312# test 2, which needs more than the even the Linux default when PCRE2 has been
313# compiled by gcc with -fsanitize=address. When the compiler is clang, sanitize
314# options require an even bigger stack for test 2, and an increased stack for
315# some of the other tests.
316
317$sim ./pcre2test -S 1 /dev/null /dev/null
318if [ $? -eq 0 ] ; then
319 if [ "$bigstack" = "" ] ; then
320 test2stack="-S 16"
321 defaultstack=""
322 else
323 test2stack="-S 1024"
324 defaultstack="-S 64"
325 fi
326else
327 test2stack=""
328 defaultstack=""
329fi
330
331# All of 8-bit, 16-bit, and 32-bit character strings may be supported, but only
332# one need be.
333
334$sim ./pcre2test -C pcre2-8 >/dev/null
335support8=$?
336$sim ./pcre2test -C pcre2-16 >/dev/null
337support16=$?
338$sim ./pcre2test -C pcre2-32 >/dev/null
339support32=$?
340
341# \C may be disabled
342
343$sim ./pcre2test -C backslash-C >/dev/null
344supportBSC=$?
345
346# Initialize all bitsizes skipped
347
348test8=skip
349test16=skip
350test32=skip
351
352# If no bitsize arguments, select all that are available
353
354if [ "$arg8$arg16$arg32" = "" ] ; then
355 if [ $support8 -ne 0 ] ; then
356 test8=-8
357 fi
358 if [ $support16 -ne 0 ] ; then
359 test16=-16
360 fi
361 if [ $support32 -ne 0 ] ; then
362 test32=-32
363 fi
364
365# Otherwise, select requested bit sizes
366
367else
368 if [ "$arg8" = yes ] ; then
369 if [ $support8 -eq 0 ] ; then
370 echo "Cannot run 8-bit library tests: 8-bit library not compiled"
371 exit 1
372 fi
373 test8=-8
374 fi
375 if [ "$arg16" = yes ] ; then
376 if [ $support16 -eq 0 ] ; then
377 echo "Cannot run 16-bit library tests: 16-bit library not compiled"
378 exit 1
379 fi
380 test16=-16
381 fi
382 if [ "$arg32" = yes ] ; then
383 if [ $support32 -eq 0 ] ; then
384 echo "Cannot run 32-bit library tests: 32-bit library not compiled"
385 exit 1
386 fi
387 test32=-32
388 fi
389fi
390
391# UTF support is implied by Unicode support, and it always applies to all bit
392# sizes if both are supported; we can't have UTF-8 support without UTF-16 or
393# UTF-32 support.
394
395$sim ./pcre2test -C unicode >/dev/null
396utf=$?
397
398# When JIT is used with valgrind, we need to set up valgrind suppressions as
399# otherwise there are a lot of false positive valgrind reports when the
400# the hardware supports SSE2.
401
402jitopt=
403$sim ./pcre2test -C jit >/dev/null
404jit=$?
405if [ $jit -ne 0 -a "$nojit" != "yes" ] ; then
406 jitopt=-jit
407 if [ "$valgrind" != "" ] ; then
408 vjs="--suppressions=$testdata/valgrind-jit.supp"
409 fi
410fi
411
412# If no specific tests were requested, select all. Those that are not
413# relevant will be automatically skipped.
414
415if [ $do0 = no -a $do1 = no -a $do2 = no -a $do3 = no -a \
416 $do4 = no -a $do5 = no -a $do6 = no -a $do7 = no -a \
417 $do8 = no -a $do9 = no -a $do10 = no -a $do11 = no -a \
418 $do12 = no -a $do13 = no -a $do14 = no -a $do15 = no -a \
419 $do16 = no -a $do17 = no -a $do18 = no -a $do19 = no -a \
420 $do20 = no -a $do21 = no -a $do22 = no -a $do23 = no \
421 ]; then
422 do0=yes
423 do1=yes
424 do2=yes
425 do3=yes
426 do4=yes
427 do5=yes
428 do6=yes
429 do7=yes
430 do8=yes
431 do9=yes
432 do10=yes
433 do11=yes
434 do12=yes
435 do13=yes
436 do14=yes
437 do15=yes
438 do16=yes
439 do17=yes
440 do18=yes
441 do19=yes
442 do20=yes
443 do21=yes
444 do22=yes
445 do23=yes
446fi
447
448# Handle any explicit skips at this stage, so that an argument list may consist
449# only of explicit skips.
450
451for i in $skip; do eval do$i=no; done
452
453# Show which release and which test data
454
455echo ""
456echo PCRE2 C library tests using test data from $testdata
457$sim ./pcre2test /dev/null
458echo ""
459
460for bmode in "$test8" "$test16" "$test32"; do
461 case "$bmode" in
462 skip) continue;;
463 -16) if [ "$test8$test32" != "skipskip" ] ; then echo ""; fi
464 bits=16; echo "---- Testing 16-bit library ----"; echo "";;
465 -32) if [ "$test8$test16" != "skipskip" ] ; then echo ""; fi
466 bits=32; echo "---- Testing 32-bit library ----"; echo "";;
467 -8) bits=8; echo "---- Testing 8-bit library ----"; echo "";;
468 esac
469
470 # Test 0 is a special test. Its output is not checked, because it will
471 # be different on different hardware and with different configurations.
472 # Running this test just exercises the code.
473
474 if [ $do0 = yes ] ; then
475 echo $title0
476 echo '/abc/jit,memory' >testSinput
477 echo ' abc' >>testSinput
478 echo '' >testtry
479 checkspecial '-C'
480 checkspecial '--help'
481 checkspecial '-S 1 -t 10 testSinput'
482 echo " OK"
483 fi
484
485 # Primary non-UTF test, compatible with JIT and all versions of Perl >= 5.8
486
487 if [ $do1 = yes ] ; then
488 echo $title1
489 for opt in "" $jitopt; do
490 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput1 testtry
491 checkresult $? 1 "$opt"
492 done
493 fi
494
495 # PCRE2 tests that are not Perl-compatible: API, errors, internals
496
497 if [ $do2 = yes ] ; then
498 echo $title2 "(excluding UTF-$bits)"
499 for opt in "" $jitopt; do
500 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $test2stack $bmode $opt $testdata/testinput2 testtry
501 if [ $? = 0 ] ; then
502 checkresult $? 2 "$opt"
503 else
504 echo " "
505 echo "** Test 2 requires a lot of stack. If it has crashed with a"
506 echo "** segmentation fault, it may be that you do not have enough"
507 echo "** stack available by default. Please see the 'pcre2stack' man"
508 echo "** page for a discussion of PCRE2's stack usage."
509 echo " "
510 exit 1
511 fi
512 done
513 fi
514
515 # Locale-specific tests, provided that either the "fr_FR", "fr_CA", "french"
516 # or "fr" locale is available. The first two are Unix-like standards; the
517 # last two are for Windows. Unfortunately, different versions of the French
518 # locale give different outputs for some items. This test passes if the
519 # output matches any one of the alternative output files.
520
521 if [ $do3 = yes ] ; then
522 locale=
523
524 # In some environments locales that are listed by the "locale -a"
525 # command do not seem to work with setlocale(). Therefore, we do
526 # a preliminary test to see if pcre2test can set one before going
527 # on to use it.
528
529 for loc in 'fr_FR' 'french' 'fr' 'fr_CA'; do
530 locale -a | grep "^$loc\$" >/dev/null
531 if [ $? -eq 0 ] ; then
532 echo "/a/locale=$loc" | \
533 $sim $valgrind ./pcre2test -q $bmode | \
534 grep "Failed to set locale" >/dev/null
535 if [ $? -ne 0 ] ; then
536 locale=$loc
537 if [ "$locale" = "fr_FR" ] ; then
538 infile=$testdata/testinput3
539 outfile=$testdata/testoutput3
540 outfile2=$testdata/testoutput3A
541 outfile3=$testdata/testoutput3B
542 else
543 infile=test3input
544 outfile=test3output
545 outfile2=test3outputA
546 outfile3=test3outputB
547 sed "s/fr_FR/$loc/" $testdata/testinput3 >test3input
548 sed "s/fr_FR/$loc/" $testdata/testoutput3 >test3output
549 sed "s/fr_FR/$loc/" $testdata/testoutput3A >test3outputA
550 sed "s/fr_FR/$loc/" $testdata/testoutput3B >test3outputB
551 fi
552 break
553 fi
554 fi
555 done
556
557 if [ "$locale" != "" ] ; then
558 echo $title3 "(using '$locale' locale)"
559 for opt in "" $jitopt; do
560 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $infile testtry
561 if [ $? = 0 ] ; then
562 case "$opt" in
563 -jit) with=" with JIT";;
564 *) with="";;
565 esac
566 if $cf $outfile testtry >teststdout || \
567 $cf $outfile2 testtry >teststdout || \
568 $cf $outfile3 testtry >teststdout
569 then
570 echo " OK$with"
571 else
572 echo "** Locale test did not run successfully$with. The output did not match"
573 echo " $outfile, $outfile2 or $outfile3."
574 echo " This may mean that there is a problem with the locale settings rather"
575 echo " than a bug in PCRE2."
576 exit 1
577 fi
578 else exit 1
579 fi
580 done
581 else
582 echo "Cannot test locale-specific features - none of the 'fr_FR', 'fr_CA',"
583 echo "'fr' or 'french' locales can be set, or the \"locale\" command is"
584 echo "not available to check for them."
585 echo " "
586 fi
587 fi
588
589 # Tests for UTF and Unicode property support
590
591 if [ $do4 = yes ] ; then
592 echo ${title4A}-${bits}${title4B}
593 if [ $utf -eq 0 ] ; then
594 echo " Skipped because UTF-$bits support is not available"
595 else
596 for opt in "" $jitopt; do
597 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput4 testtry
598 checkresult $? 4 "$opt"
599 done
600 fi
601 fi
602
603 if [ $do5 = yes ] ; then
604 echo ${title5A}-${bits}$title5B
605 if [ $utf -eq 0 ] ; then
606 echo " Skipped because UTF-$bits support is not available"
607 else
608 for opt in "" $jitopt; do
609 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput5 testtry
610 checkresult $? 5 "$opt"
611 done
612 fi
613 fi
614
615 # Tests for DFA matching support
616
617 if [ $do6 = yes ] ; then
618 echo $title6
619 $sim $valgrind ./pcre2test -q $defaultstack $bmode $testdata/testinput6 testtry
620 checkresult $? 6 ""
621 fi
622
623 if [ $do7 = yes ] ; then
624 echo ${title7A}-${bits}$title7B
625 if [ $utf -eq 0 ] ; then
626 echo " Skipped because UTF-$bits support is not available"
627 else
628 $sim $valgrind ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput7 testtry
629 checkresult $? 7 ""
630 fi
631 fi
632
633 # Test of internal offsets and code sizes. This test is run only when there
634 # is UTF/UCP support. The actual tests are mostly the same as in some of the
635 # above, but in this test we inspect some offsets and sizes. This is a
636 # doublecheck for the maintainer, just in case something changes unexpectely.
637 # The output from this test is different in 8-bit, 16-bit, and 32-bit modes
638 # and for different link sizes, so there are different output files for each
639 # mode and link size.
640
641 if [ $do8 = yes ] ; then
642 echo $title8
643 if [ $utf -eq 0 ] ; then
644 echo " Skipped because UTF-$bits support is not available"
645 else
646 $sim $valgrind ./pcre2test -q $defaultstack $bmode $testdata/testinput8 testtry
647 checkresult $? 8-$bits-$link_size ""
648 fi
649 fi
650
651 # Tests for 8-bit-specific features
652
653 if [ "$do9" = yes ] ; then
654 echo $title9
655 if [ "$bits" = "16" -o "$bits" = "32" ] ; then
656 echo " Skipped when running 16/32-bit tests"
657 else
658 for opt in "" $jitopt; do
659 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput9 testtry
660 checkresult $? 9 "$opt"
661 done
662 fi
663 fi
664
665 # Tests for UTF-8 and UCP 8-bit-specific features
666
667 if [ "$do10" = yes ] ; then
668 echo $title10
669 if [ "$bits" = "16" -o "$bits" = "32" ] ; then
670 echo " Skipped when running 16/32-bit tests"
671 elif [ $utf -eq 0 ] ; then
672 echo " Skipped because UTF-$bits support is not available"
673 else
674 for opt in "" $jitopt; do
675 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput10 testtry
676 checkresult $? 10 "$opt"
677 done
678 fi
679 fi
680
681 # Tests for 16-bit and 32-bit features. Output is different for the two widths.
682
683 if [ $do11 = yes ] ; then
684 echo $title11
685 if [ "$bits" = "8" ] ; then
686 echo " Skipped when running 8-bit tests"
687 else
688 for opt in "" $jitopt; do
689 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput11 testtry
690 checkresult $? 11-$bits "$opt"
691 done
692 fi
693 fi
694
695 # Tests for 16-bit and 32-bit features with UTF-16/32 and UCP support. Output
696 # is different for the two widths.
697
698 if [ $do12 = yes ] ; then
699 echo $title12
700 if [ "$bits" = "8" ] ; then
701 echo " Skipped when running 8-bit tests"
702 elif [ $utf -eq 0 ] ; then
703 echo " Skipped because UTF-$bits support is not available"
704 else
705 for opt in "" $jitopt; do
706 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput12 testtry
707 checkresult $? 12-$bits "$opt"
708 done
709 fi
710 fi
711
712 # Tests for 16/32-bit-specific features in DFA non-UTF modes
713
714 if [ $do13 = yes ] ; then
715 echo $title13
716 if [ "$bits" = "8" ] ; then
717 echo " Skipped when running 8-bit tests"
718 else
719 $sim $valgrind ./pcre2test -q $defaultstack $bmode $testdata/testinput13 testtry
720 checkresult $? 13 ""
721 fi
722 fi
723
724 # Tests for DFA UTF and UCP features. Output is different for the different widths.
725
726 if [ $do14 = yes ] ; then
727 echo $title14
728 if [ $utf -eq 0 ] ; then
729 echo " Skipped because UTF-$bits support is not available"
730 else
731 $sim $valgrind ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput14 testtry
732 checkresult $? 14-$bits ""
733 fi
734 fi
735
736 # Test non-JIT match and recursion limits
737
738 if [ $do15 = yes ] ; then
739 echo $title15
740 $sim $valgrind ./pcre2test -q $defaultstack $bmode $testdata/testinput15 testtry
741 checkresult $? 15 ""
742 fi
743
744 # Test JIT-specific features when JIT is not available
745
746 if [ $do16 = yes ] ; then
747 echo $title16
748 if [ $jit -ne 0 ] ; then
749 echo " Skipped because JIT is available"
750 else
751 $sim $valgrind ./pcre2test -q $defaultstack $bmode $testdata/testinput16 testtry
752 checkresult $? 16 ""
753 fi
754 fi
755
756 # Test JIT-specific features when JIT is available
757
758 if [ $do17 = yes ] ; then
759 echo $title17
760 if [ $jit -eq 0 -o "$nojit" = "yes" ] ; then
761 echo " Skipped because JIT is not available or nojit was specified"
762 else
763 $sim $valgrind $vjs ./pcre2test -q $defaultstack $bmode $testdata/testinput17 testtry
764 checkresult $? 17 ""
765 fi
766 fi
767
768 # Tests for the POSIX interface without UTF/UCP (8-bit only)
769
770 if [ $do18 = yes ] ; then
771 echo $title18
772 if [ "$bits" = "16" -o "$bits" = "32" ] ; then
773 echo " Skipped when running 16/32-bit tests"
774 else
775 $sim $valgrind ./pcre2test -q $defaultstack $bmode $testdata/testinput18 testtry
776 checkresult $? 18 ""
777 fi
778 fi
779
780 # Tests for the POSIX interface with UTF/UCP (8-bit only)
781
782 if [ $do19 = yes ] ; then
783 echo $title19
784 if [ "$bits" = "16" -o "$bits" = "32" ] ; then
785 echo " Skipped when running 16/32-bit tests"
786 elif [ $utf -eq 0 ] ; then
787 echo " Skipped because UTF-$bits support is not available"
788 else
789 $sim $valgrind ./pcre2test -q $defaultstack $bmode $testdata/testinput19 testtry
790 checkresult $? 19 ""
791 fi
792 fi
793
794 # Serialization tests
795
796 if [ $do20 = yes ] ; then
797 echo $title20
798 $sim $valgrind ./pcre2test -q $defaultstack $bmode $testdata/testinput20 testtry
799 checkresult $? 20 ""
800 fi
801
802 # \C tests without UTF - DFA matching is supported
803
804 if [ "$do21" = yes ] ; then
805 echo $title21
806 if [ $supportBSC -eq 0 ] ; then
807 echo " Skipped because \C is disabled"
808 else
809 for opt in "" $jitopt -dfa; do
810 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput21 testtry
811 checkresult $? 21 "$opt"
812 done
813 fi
814 fi
815
816 # \C tests with UTF - DFA matching is not supported for \C in UTF mode
817
818 if [ "$do22" = yes ] ; then
819 echo $title22
820 if [ $supportBSC -eq 0 ] ; then
821 echo " Skipped because \C is disabled"
822 elif [ $utf -eq 0 ] ; then
823 echo " Skipped because UTF-$bits support is not available"
824 else
825 for opt in "" $jitopt; do
826 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput22 testtry
827 checkresult $? 22-$bits "$opt"
828 done
829 fi
830 fi
831
832 # Test when \C is disabled
833
834 if [ "$do23" = yes ] ; then
835 echo $title23
836 if [ $supportBSC -ne 0 ] ; then
837 echo " Skipped because \C is not disabled"
838 else
839 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput23 testtry
840 checkresult $? 23 ""
841 fi
842 fi
843
844# End of loop for 8/16/32-bit tests
845done
846
847# Clean up local working files
848rm -f testSinput test3input testsaved1 testsaved2 test3output test3outputA test3outputB teststdout teststderr testtry
849
850# End