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