blob: 14d9f60f627b0730815a8ef260551e1fbafe9c0a [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)"
Janis Danisevskis8b979b22016-08-15 16:09:16 +010056title2="Test 2: API, errors, internals and non-Perl stuff"
Janis Danisevskis53e448c2016-03-31 13:35:25 +010057title3="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"
Janis Danisevskis8b979b22016-08-15 16:09:16 +010077title20="Test 20: Serialization and code copy tests"
Janis Danisevskis53e448c2016-03-31 13:35:25 +010078title21="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"
Elliott Hughes9bc971b2018-07-27 13:23:14 -070081title24="Test 24: Non-UTF pattern conversion tests"
82title25="Test 25: UTF pattern conversion tests"
83maxtest=25
Janis Danisevskis53e448c2016-03-31 13:35:25 +010084
85if [ $# -eq 1 -a "$1" = "list" ]; then
86 echo $title0
87 echo $title1
88 echo $title2 "(not UTF or UCP)"
89 echo $title3
90 echo $title4A $title4B
91 echo $title5A $title5B
92 echo $title6
93 echo $title7A $title7B
94 echo $title8
95 echo $title9
96 echo $title10
97 echo $title11
98 echo $title12
99 echo $title13
100 echo $title14
101 echo $title15
102 echo $title16
103 echo $title17
104 echo $title18
105 echo $title19
106 echo $title20
107 echo $title21
108 echo $title22
109 echo $title23
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700110 echo $title24
111 echo $title25
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100112 exit 0
113fi
114
115# Set up a suitable "diff" command for comparison. Some systems
116# have a diff that lacks a -u option. Try to deal with this.
117
118cf="diff"
119diff -u /dev/null /dev/null 2>/dev/null && cf="diff -u"
120
121# Find the test data
122
123if [ -n "$srcdir" -a -d "$srcdir" ] ; then
124 testdata="$srcdir/testdata"
125elif [ -d "./testdata" ] ; then
126 testdata=./testdata
127elif [ -d "../testdata" ] ; then
128 testdata=../testdata
129else
130 echo "Cannot find the testdata directory"
131 exit 1
132fi
133
134
135# ------ Function to check results of a test -------
136
137# This function is called with three parameters:
138#
139# $1 the value of $? after a call to pcre2test
140# $2 the suffix of the output file to compare with
141# $3 the $opt value (empty, -jit, or -dfa)
142#
143# Note: must define using name(), not "function name", for Solaris.
144
145checkresult()
146 {
147 if [ $1 -ne 0 ] ; then
148 echo "** pcre2test failed - check testtry"
149 exit 1
150 fi
151 case "$3" in
152 -jit) with=" with JIT";;
153 -dfa) with=" with DFA";;
154 *) with="";;
155 esac
156 $cf $testdata/testoutput$2 testtry
157 if [ $? != 0 ] ; then
158 echo ""
159 echo "** Test $2 failed$with"
160 exit 1
161 fi
162 echo " OK$with"
163 }
164
165
166# ------ Function to run and check a special pcre2test arguments test -------
167
168checkspecial()
169 {
170 $valgrind $vjs ./pcre2test $1 >>testtry
171 if [ $? -ne 0 ] ; then
172 echo "** pcre2test $1 failed - check testtry"
173 exit 1
174 fi
175 }
176
177
178# ------ Special EBCDIC Test -------
179
180if [ $# -eq 1 -a "$1" = "ebcdic" ]; then
181 $valgrind ./pcre2test -C ebcdic >/dev/null
182 ebcdic=$?
183 if [ $ebcdic -ne 1 ] ; then
184 echo "Cannot run EBCDIC tests: EBCDIC support not compiled"
185 exit 1
186 fi
187 for opt in "" "-dfa"; do
188 ./pcre2test -q $opt $testdata/testinputEBC >testtry
189 checkresult $? EBC "$opt"
190 done
191exit 0
192fi
193
194
195# ------ Normal Tests ------
196
197# Default values
198
199arg8=
200arg16=
201arg32=
202nojit=
203bigstack=
204sim=
205skip=
206valgrind=
207vjs=
208
209# This is in case the caller has set aliases (as I do - PH)
210unset cp ls mv rm
211
212# Process options and select which tests to run; for those that are explicitly
213# requested, check that the necessary optional facilities are available.
214
215do0=no
216do1=no
217do2=no
218do3=no
219do4=no
220do5=no
221do6=no
222do7=no
223do8=no
224do9=no
225do10=no
226do11=no
227do12=no
228do13=no
229do14=no
230do15=no
231do16=no
232do17=no
233do18=no
234do19=no
235do20=no
236do21=no
237do22=no
238do23=no
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700239do24=no
240do25=no
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100241
242while [ $# -gt 0 ] ; do
243 case $1 in
244 0) do0=yes;;
245 1) do1=yes;;
246 2) do2=yes;;
247 3) do3=yes;;
248 4) do4=yes;;
249 5) do5=yes;;
250 6) do6=yes;;
251 7) do7=yes;;
252 8) do8=yes;;
253 9) do9=yes;;
254 10) do10=yes;;
255 11) do11=yes;;
256 12) do12=yes;;
257 13) do13=yes;;
258 14) do14=yes;;
259 15) do15=yes;;
260 16) do16=yes;;
261 17) do17=yes;;
262 18) do18=yes;;
263 19) do19=yes;;
264 20) do20=yes;;
265 21) do21=yes;;
266 22) do22=yes;;
267 23) do23=yes;;
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700268 24) do24=yes;;
269 25) do25=yes;;
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100270 -8) arg8=yes;;
271 -16) arg16=yes;;
272 -32) arg32=yes;;
273 bigstack|-bigstack) bigstack=yes;;
274 nojit|-nojit) nojit=yes;;
275 sim|-sim) shift; sim=$1;;
Janis Danisevskis8b979b22016-08-15 16:09:16 +0100276 valgrind|-valgrind) valgrind="valgrind --tool=memcheck -q --smc-check=all-non-file";;
277 valgrind-log|-valgrind-log) valgrind="valgrind --tool=memcheck --num-callers=30 --leak-check=no --error-limit=no --smc-check=all-non-file --log-file=report.%p ";;
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100278 ~*)
279 if expr "$1" : '~[0-9][0-9]*$' >/dev/null; then
280 skip="$skip `expr "$1" : '~\([0-9]*\)*$'`"
281 else
282 echo "Unknown option or test selector '$1'"; exit 1
283 fi
284 ;;
285 *-*)
286 if expr "$1" : '[0-9][0-9]*-[0-9]*$' >/dev/null; then
287 tf=`expr "$1" : '\([0-9]*\)'`
288 tt=`expr "$1" : '.*-\([0-9]*\)'`
289 if [ "$tt" = "" ] ; then tt=$maxtest; fi
290 if expr \( "$tt" ">" "$maxtest" \) >/dev/null; then
291 echo "Invalid test range '$1'"; exit 1
292 fi
293 while expr "$tf" "<=" "$tt" >/dev/null; do
294 eval do${tf}=yes
295 tf=`expr $tf + 1`
296 done
297 else
298 echo "Invalid test range '$1'"; exit 1
299 fi
300 ;;
301 *) echo "Unknown option or test selector '$1'"; exit 1;;
302 esac
303 shift
304done
305
306# Find which optional facilities are available.
307
308$sim ./pcre2test -C linksize >/dev/null
309link_size=$?
310if [ $link_size -lt 2 ] ; then
311 echo "RunTest: Failed to find internal link size"
312 exit 1
313fi
314if [ $link_size -gt 4 ] ; then
315 echo "RunTest: Failed to find internal link size"
316 exit 1
317fi
318
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700319# If it is possible to set the system stack size and -bigstack was given,
320# set up a large stack.
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100321
Elliott Hughes0c26e192019-08-07 12:24:46 -0700322$sim ./pcre2test -S 64 /dev/null /dev/null
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700323if [ $? -eq 0 -a "$bigstack" != "" ] ; then
324 setstack="-S 64"
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100325else
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700326 setstack=""
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100327fi
328
329# All of 8-bit, 16-bit, and 32-bit character strings may be supported, but only
330# one need be.
331
332$sim ./pcre2test -C pcre2-8 >/dev/null
333support8=$?
334$sim ./pcre2test -C pcre2-16 >/dev/null
335support16=$?
336$sim ./pcre2test -C pcre2-32 >/dev/null
337support32=$?
338
339# \C may be disabled
340
341$sim ./pcre2test -C backslash-C >/dev/null
342supportBSC=$?
343
344# Initialize all bitsizes skipped
345
346test8=skip
347test16=skip
348test32=skip
349
350# If no bitsize arguments, select all that are available
351
352if [ "$arg8$arg16$arg32" = "" ] ; then
353 if [ $support8 -ne 0 ] ; then
354 test8=-8
355 fi
356 if [ $support16 -ne 0 ] ; then
357 test16=-16
358 fi
359 if [ $support32 -ne 0 ] ; then
360 test32=-32
361 fi
362
363# Otherwise, select requested bit sizes
364
365else
366 if [ "$arg8" = yes ] ; then
367 if [ $support8 -eq 0 ] ; then
368 echo "Cannot run 8-bit library tests: 8-bit library not compiled"
369 exit 1
370 fi
371 test8=-8
372 fi
373 if [ "$arg16" = yes ] ; then
374 if [ $support16 -eq 0 ] ; then
375 echo "Cannot run 16-bit library tests: 16-bit library not compiled"
376 exit 1
377 fi
378 test16=-16
379 fi
380 if [ "$arg32" = yes ] ; then
381 if [ $support32 -eq 0 ] ; then
382 echo "Cannot run 32-bit library tests: 32-bit library not compiled"
383 exit 1
384 fi
385 test32=-32
386 fi
387fi
388
389# UTF support is implied by Unicode support, and it always applies to all bit
390# sizes if both are supported; we can't have UTF-8 support without UTF-16 or
391# UTF-32 support.
392
393$sim ./pcre2test -C unicode >/dev/null
394utf=$?
395
396# When JIT is used with valgrind, we need to set up valgrind suppressions as
397# otherwise there are a lot of false positive valgrind reports when the
398# the hardware supports SSE2.
399
400jitopt=
401$sim ./pcre2test -C jit >/dev/null
402jit=$?
403if [ $jit -ne 0 -a "$nojit" != "yes" ] ; then
404 jitopt=-jit
405 if [ "$valgrind" != "" ] ; then
406 vjs="--suppressions=$testdata/valgrind-jit.supp"
407 fi
408fi
409
410# If no specific tests were requested, select all. Those that are not
411# relevant will be automatically skipped.
412
413if [ $do0 = no -a $do1 = no -a $do2 = no -a $do3 = no -a \
414 $do4 = no -a $do5 = no -a $do6 = no -a $do7 = no -a \
415 $do8 = no -a $do9 = no -a $do10 = no -a $do11 = no -a \
416 $do12 = no -a $do13 = no -a $do14 = no -a $do15 = no -a \
417 $do16 = no -a $do17 = no -a $do18 = no -a $do19 = no -a \
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700418 $do20 = no -a $do21 = no -a $do22 = no -a $do23 = no -a \
419 $do24 = no -a $do25 = no \
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100420 ]; then
421 do0=yes
422 do1=yes
423 do2=yes
424 do3=yes
425 do4=yes
426 do5=yes
427 do6=yes
428 do7=yes
429 do8=yes
430 do9=yes
431 do10=yes
432 do11=yes
433 do12=yes
434 do13=yes
435 do14=yes
436 do15=yes
437 do16=yes
438 do17=yes
439 do18=yes
440 do19=yes
441 do20=yes
442 do21=yes
443 do22=yes
444 do23=yes
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700445 do24=yes
446 do25=yes
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100447fi
448
449# Handle any explicit skips at this stage, so that an argument list may consist
450# only of explicit skips.
451
452for i in $skip; do eval do$i=no; done
453
454# Show which release and which test data
455
456echo ""
457echo PCRE2 C library tests using test data from $testdata
458$sim ./pcre2test /dev/null
459echo ""
460
461for bmode in "$test8" "$test16" "$test32"; do
462 case "$bmode" in
463 skip) continue;;
464 -16) if [ "$test8$test32" != "skipskip" ] ; then echo ""; fi
465 bits=16; echo "---- Testing 16-bit library ----"; echo "";;
466 -32) if [ "$test8$test16" != "skipskip" ] ; then echo ""; fi
467 bits=32; echo "---- Testing 32-bit library ----"; echo "";;
468 -8) bits=8; echo "---- Testing 8-bit library ----"; echo "";;
469 esac
470
471 # Test 0 is a special test. Its output is not checked, because it will
472 # be different on different hardware and with different configurations.
473 # Running this test just exercises the code.
474
475 if [ $do0 = yes ] ; then
476 echo $title0
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700477 echo '/abc/jit,memory,framesize' >testSinput
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100478 echo ' abc' >>testSinput
479 echo '' >testtry
480 checkspecial '-C'
481 checkspecial '--help'
482 checkspecial '-S 1 -t 10 testSinput'
483 echo " OK"
484 fi
485
486 # Primary non-UTF test, compatible with JIT and all versions of Perl >= 5.8
487
488 if [ $do1 = yes ] ; then
489 echo $title1
490 for opt in "" $jitopt; do
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700491 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput1 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100492 checkresult $? 1 "$opt"
493 done
494 fi
495
Elliott Hughes3435c422020-12-04 13:18:28 -0800496 # PCRE2 tests that are not Perl-compatible: API, errors, internals. We copy
497 # the testbtables file to the current directory for use by this test.
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100498
499 if [ $do2 = yes ] ; then
500 echo $title2 "(excluding UTF-$bits)"
Elliott Hughes3435c422020-12-04 13:18:28 -0800501 cp $testdata/testbtables .
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100502 for opt in "" $jitopt; do
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700503 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput2 testtry
Elliott Hughes3435c422020-12-04 13:18:28 -0800504 saverc=$?
505 if [ $saverc = 0 ] ; then
Elliott Hughes653c2102019-01-09 15:41:36 -0800506 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $bmode $opt -error -70,-62,-2,-1,0,100,101,191,200 >>testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100507 checkresult $? 2 "$opt"
Elliott Hughes3435c422020-12-04 13:18:28 -0800508 else
509 checkresult $saverc 2 "$opt"
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100510 fi
511 done
512 fi
513
514 # Locale-specific tests, provided that either the "fr_FR", "fr_CA", "french"
515 # or "fr" locale is available. The first two are Unix-like standards; the
516 # last two are for Windows. Unfortunately, different versions of the French
517 # locale give different outputs for some items. This test passes if the
518 # output matches any one of the alternative output files.
519
520 if [ $do3 = yes ] ; then
521 locale=
522
523 # In some environments locales that are listed by the "locale -a"
524 # command do not seem to work with setlocale(). Therefore, we do
525 # a preliminary test to see if pcre2test can set one before going
526 # on to use it.
527
528 for loc in 'fr_FR' 'french' 'fr' 'fr_CA'; do
529 locale -a | grep "^$loc\$" >/dev/null
530 if [ $? -eq 0 ] ; then
531 echo "/a/locale=$loc" | \
532 $sim $valgrind ./pcre2test -q $bmode | \
533 grep "Failed to set locale" >/dev/null
534 if [ $? -ne 0 ] ; then
535 locale=$loc
536 if [ "$locale" = "fr_FR" ] ; then
537 infile=$testdata/testinput3
538 outfile=$testdata/testoutput3
539 outfile2=$testdata/testoutput3A
540 outfile3=$testdata/testoutput3B
541 else
542 infile=test3input
543 outfile=test3output
544 outfile2=test3outputA
545 outfile3=test3outputB
546 sed "s/fr_FR/$loc/" $testdata/testinput3 >test3input
547 sed "s/fr_FR/$loc/" $testdata/testoutput3 >test3output
548 sed "s/fr_FR/$loc/" $testdata/testoutput3A >test3outputA
549 sed "s/fr_FR/$loc/" $testdata/testoutput3B >test3outputB
550 fi
551 break
552 fi
553 fi
554 done
555
556 if [ "$locale" != "" ] ; then
557 echo $title3 "(using '$locale' locale)"
558 for opt in "" $jitopt; do
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700559 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $infile testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100560 if [ $? = 0 ] ; then
561 case "$opt" in
562 -jit) with=" with JIT";;
563 *) with="";;
564 esac
565 if $cf $outfile testtry >teststdout || \
566 $cf $outfile2 testtry >teststdout || \
567 $cf $outfile3 testtry >teststdout
568 then
569 echo " OK$with"
570 else
571 echo "** Locale test did not run successfully$with. The output did not match"
572 echo " $outfile, $outfile2 or $outfile3."
573 echo " This may mean that there is a problem with the locale settings rather"
574 echo " than a bug in PCRE2."
575 exit 1
576 fi
577 else exit 1
578 fi
579 done
580 else
581 echo "Cannot test locale-specific features - none of the 'fr_FR', 'fr_CA',"
582 echo "'fr' or 'french' locales can be set, or the \"locale\" command is"
583 echo "not available to check for them."
584 echo " "
585 fi
586 fi
587
588 # Tests for UTF and Unicode property support
589
590 if [ $do4 = yes ] ; then
591 echo ${title4A}-${bits}${title4B}
592 if [ $utf -eq 0 ] ; then
593 echo " Skipped because UTF-$bits support is not available"
594 else
595 for opt in "" $jitopt; do
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700596 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput4 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100597 checkresult $? 4 "$opt"
598 done
599 fi
600 fi
601
602 if [ $do5 = yes ] ; then
603 echo ${title5A}-${bits}$title5B
604 if [ $utf -eq 0 ] ; then
605 echo " Skipped because UTF-$bits support is not available"
606 else
607 for opt in "" $jitopt; do
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700608 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput5 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100609 checkresult $? 5 "$opt"
610 done
611 fi
612 fi
613
614 # Tests for DFA matching support
615
616 if [ $do6 = yes ] ; then
617 echo $title6
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700618 $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput6 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100619 checkresult $? 6 ""
620 fi
621
622 if [ $do7 = yes ] ; then
623 echo ${title7A}-${bits}$title7B
624 if [ $utf -eq 0 ] ; then
625 echo " Skipped because UTF-$bits support is not available"
626 else
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700627 $sim $valgrind ./pcre2test -q $setstack $bmode $opt $testdata/testinput7 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100628 checkresult $? 7 ""
629 fi
630 fi
631
632 # Test of internal offsets and code sizes. This test is run only when there
633 # is UTF/UCP support. The actual tests are mostly the same as in some of the
634 # above, but in this test we inspect some offsets and sizes. This is a
635 # doublecheck for the maintainer, just in case something changes unexpectely.
636 # The output from this test is different in 8-bit, 16-bit, and 32-bit modes
637 # and for different link sizes, so there are different output files for each
638 # mode and link size.
639
640 if [ $do8 = yes ] ; then
641 echo $title8
642 if [ $utf -eq 0 ] ; then
643 echo " Skipped because UTF-$bits support is not available"
644 else
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700645 $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput8 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100646 checkresult $? 8-$bits-$link_size ""
647 fi
648 fi
649
650 # Tests for 8-bit-specific features
651
652 if [ "$do9" = yes ] ; then
653 echo $title9
654 if [ "$bits" = "16" -o "$bits" = "32" ] ; then
655 echo " Skipped when running 16/32-bit tests"
656 else
657 for opt in "" $jitopt; do
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700658 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput9 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100659 checkresult $? 9 "$opt"
660 done
661 fi
662 fi
663
664 # Tests for UTF-8 and UCP 8-bit-specific features
665
666 if [ "$do10" = yes ] ; then
667 echo $title10
668 if [ "$bits" = "16" -o "$bits" = "32" ] ; then
669 echo " Skipped when running 16/32-bit tests"
670 elif [ $utf -eq 0 ] ; then
671 echo " Skipped because UTF-$bits support is not available"
672 else
673 for opt in "" $jitopt; do
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700674 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput10 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100675 checkresult $? 10 "$opt"
676 done
677 fi
678 fi
679
680 # Tests for 16-bit and 32-bit features. Output is different for the two widths.
681
682 if [ $do11 = yes ] ; then
683 echo $title11
684 if [ "$bits" = "8" ] ; then
685 echo " Skipped when running 8-bit tests"
686 else
687 for opt in "" $jitopt; do
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700688 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput11 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100689 checkresult $? 11-$bits "$opt"
690 done
691 fi
692 fi
693
694 # Tests for 16-bit and 32-bit features with UTF-16/32 and UCP support. Output
695 # is different for the two widths.
696
697 if [ $do12 = yes ] ; then
698 echo $title12
699 if [ "$bits" = "8" ] ; then
700 echo " Skipped when running 8-bit tests"
701 elif [ $utf -eq 0 ] ; then
702 echo " Skipped because UTF-$bits support is not available"
703 else
704 for opt in "" $jitopt; do
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700705 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput12 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100706 checkresult $? 12-$bits "$opt"
707 done
708 fi
709 fi
710
711 # Tests for 16/32-bit-specific features in DFA non-UTF modes
712
713 if [ $do13 = yes ] ; then
714 echo $title13
715 if [ "$bits" = "8" ] ; then
716 echo " Skipped when running 8-bit tests"
717 else
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700718 $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput13 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100719 checkresult $? 13 ""
720 fi
721 fi
722
723 # Tests for DFA UTF and UCP features. Output is different for the different widths.
724
725 if [ $do14 = yes ] ; then
726 echo $title14
727 if [ $utf -eq 0 ] ; then
728 echo " Skipped because UTF-$bits support is not available"
729 else
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700730 $sim $valgrind ./pcre2test -q $setstack $bmode $opt $testdata/testinput14 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100731 checkresult $? 14-$bits ""
732 fi
733 fi
734
735 # Test non-JIT match and recursion limits
736
737 if [ $do15 = yes ] ; then
738 echo $title15
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700739 $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput15 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100740 checkresult $? 15 ""
741 fi
742
743 # Test JIT-specific features when JIT is not available
744
745 if [ $do16 = yes ] ; then
746 echo $title16
747 if [ $jit -ne 0 ] ; then
748 echo " Skipped because JIT is available"
749 else
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700750 $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput16 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100751 checkresult $? 16 ""
752 fi
753 fi
754
755 # Test JIT-specific features when JIT is available
756
757 if [ $do17 = yes ] ; then
758 echo $title17
759 if [ $jit -eq 0 -o "$nojit" = "yes" ] ; then
760 echo " Skipped because JIT is not available or nojit was specified"
761 else
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700762 $sim $valgrind $vjs ./pcre2test -q $setstack $bmode $testdata/testinput17 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100763 checkresult $? 17 ""
764 fi
765 fi
766
767 # Tests for the POSIX interface without UTF/UCP (8-bit only)
768
769 if [ $do18 = yes ] ; then
770 echo $title18
771 if [ "$bits" = "16" -o "$bits" = "32" ] ; then
772 echo " Skipped when running 16/32-bit tests"
773 else
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700774 $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput18 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100775 checkresult $? 18 ""
776 fi
777 fi
778
779 # Tests for the POSIX interface with UTF/UCP (8-bit only)
780
781 if [ $do19 = yes ] ; then
782 echo $title19
783 if [ "$bits" = "16" -o "$bits" = "32" ] ; then
784 echo " Skipped when running 16/32-bit tests"
785 elif [ $utf -eq 0 ] ; then
786 echo " Skipped because UTF-$bits support is not available"
787 else
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700788 $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput19 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100789 checkresult $? 19 ""
790 fi
791 fi
792
793 # Serialization tests
794
795 if [ $do20 = yes ] ; then
796 echo $title20
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700797 $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput20 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100798 checkresult $? 20 ""
799 fi
800
801 # \C tests without UTF - DFA matching is supported
802
803 if [ "$do21" = yes ] ; then
804 echo $title21
805 if [ $supportBSC -eq 0 ] ; then
806 echo " Skipped because \C is disabled"
807 else
808 for opt in "" $jitopt -dfa; do
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700809 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput21 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100810 checkresult $? 21 "$opt"
811 done
812 fi
813 fi
814
815 # \C tests with UTF - DFA matching is not supported for \C in UTF mode
816
817 if [ "$do22" = yes ] ; then
818 echo $title22
819 if [ $supportBSC -eq 0 ] ; then
820 echo " Skipped because \C is disabled"
821 elif [ $utf -eq 0 ] ; then
822 echo " Skipped because UTF-$bits support is not available"
823 else
824 for opt in "" $jitopt; do
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700825 $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput22 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100826 checkresult $? 22-$bits "$opt"
827 done
828 fi
829 fi
830
831 # Test when \C is disabled
832
833 if [ "$do23" = yes ] ; then
834 echo $title23
835 if [ $supportBSC -ne 0 ] ; then
836 echo " Skipped because \C is not disabled"
837 else
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700838 $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput23 testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100839 checkresult $? 23 ""
840 fi
841 fi
842
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700843 # Non-UTF pattern conversion tests
844
845 if [ "$do24" = yes ] ; then
846 echo $title24
847 $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput24 testtry
848 checkresult $? 24 ""
849 fi
850
Elliott Hughes653c2102019-01-09 15:41:36 -0800851 # UTF pattern conversion tests
Elliott Hughes9bc971b2018-07-27 13:23:14 -0700852
853 if [ "$do25" = yes ] ; then
854 echo $title25
855 if [ $utf -eq 0 ] ; then
856 echo " Skipped because UTF-$bits support is not available"
857 else
858 $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput25 testtry
859 checkresult $? 25 ""
860 fi
861 fi
862
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100863# End of loop for 8/16/32-bit tests
864done
865
866# Clean up local working files
Elliott Hughes3435c422020-12-04 13:18:28 -0800867rm -f testbtables testSinput test3input testsaved1 testsaved2 test3output test3outputA test3outputB teststdout teststderr testtry
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100868
869# End