|
45 | 45 | # very much more stack than normal. In environments where the stack can be |
46 | 46 | # set at runtime, -bigstack sets a gigantic stack. |
47 | 47 | # |
48 | | -# There are two special cases where only one argument is allowed: |
49 | | -# |
50 | | -# If the first and only argument is "ebcdic", the script runs the special |
51 | | -# EBCDIC test that can be useful for checking certain EBCDIC features, even |
52 | | -# when run in an ASCII environment. PCRE2 must be built with EBCDIC support for |
53 | | -# this test to be run. |
54 | | -# |
55 | | -# If the script is obeyed as "RunTest list", a list of available tests is |
56 | | -# output, but none of them are run. |
| 48 | +# Special cases where only one argument is allowed: |
| 49 | +# - If the script is invoked as "RunTest list", a list of available tests is |
| 50 | +# output, but none of them are run. |
57 | 51 | ############################################################################### |
58 | 52 |
|
59 | 53 | # Define test titles in variables so that they can be output as a list. Some |
@@ -92,6 +86,7 @@ title26="Test 26: Unicode property tests (compatible with Perl >= 5.38)" |
92 | 86 | title27="Test 27: Auto-generated unicode property tests" |
93 | 87 | maxtest=27 |
94 | 88 | titleheap="Test 'heap': Environment-specific heap tests" |
| 89 | +titleEBC="Test 'ebcdic': EBCDIC-specific tests" |
95 | 90 |
|
96 | 91 | if [ $# -eq 1 -a "$1" = "list" ]; then |
97 | 92 | echo $title0 |
@@ -124,6 +119,7 @@ if [ $# -eq 1 -a "$1" = "list" ]; then |
124 | 119 | echo $title27 |
125 | 120 | echo "" |
126 | 121 | echo $titleheap |
| 122 | + echo $titleEBC |
127 | 123 | echo "" |
128 | 124 | echo "Numbered tests are automatically run if nothing selected." |
129 | 125 | echo "Named tests must be explicitly selected." |
@@ -357,6 +353,12 @@ support32=$? |
357 | 353 | $sim $pcre2test -C backslash-C >/dev/null |
358 | 354 | supportBSC=$? |
359 | 355 |
|
| 356 | +# Check if compiled in EBCDIC mode, and whether we have EBCDIC I/O |
| 357 | +$sim $pcre2test -C ebcdic >/dev/null |
| 358 | +ebcdic=$? |
| 359 | +$sim $pcre2test -C ebcdic-io >/dev/null |
| 360 | +ebcdic_io=$? |
| 361 | + |
360 | 362 | # Initialize all bitsizes skipped |
361 | 363 |
|
362 | 364 | test8=skip |
@@ -435,34 +437,38 @@ if [ $do0 = no -a $do1 = no -a $do2 = no -a $do3 = no -a \ |
435 | 437 | $do24 = no -a $do25 = no -a $do26 = no -a $do27 = no -a \ |
436 | 438 | $doheap = no -a $doebcdic = no \ |
437 | 439 | ]; then |
438 | | - do0=yes |
439 | | - do1=yes |
440 | | - do2=yes |
441 | | - do3=yes |
442 | | - do4=yes |
443 | | - do5=yes |
444 | | - do6=yes |
445 | | - do7=yes |
446 | | - do8=yes |
447 | | - do9=yes |
448 | | - do10=yes |
449 | | - do11=yes |
450 | | - do12=yes |
451 | | - do13=yes |
452 | | - do14=yes |
453 | | - do15=yes |
454 | | - do16=yes |
455 | | - do17=yes |
456 | | - do18=yes |
457 | | - do19=yes |
458 | | - do20=yes |
459 | | - do21=yes |
460 | | - do22=yes |
461 | | - do23=yes |
462 | | - do24=yes |
463 | | - do25=yes |
464 | | - do26=yes |
465 | | - do27=yes |
| 440 | + if [ $ebcdic -eq 0 ] ; then |
| 441 | + do0=yes |
| 442 | + do1=yes |
| 443 | + do2=yes |
| 444 | + do3=yes |
| 445 | + do4=yes |
| 446 | + do5=yes |
| 447 | + do6=yes |
| 448 | + do7=yes |
| 449 | + do8=yes |
| 450 | + do9=yes |
| 451 | + do10=yes |
| 452 | + do11=yes |
| 453 | + do12=yes |
| 454 | + do13=yes |
| 455 | + do14=yes |
| 456 | + do15=yes |
| 457 | + do16=yes |
| 458 | + do17=yes |
| 459 | + do18=yes |
| 460 | + do19=yes |
| 461 | + do20=yes |
| 462 | + do21=yes |
| 463 | + do22=yes |
| 464 | + do23=yes |
| 465 | + do24=yes |
| 466 | + do25=yes |
| 467 | + do26=yes |
| 468 | + do27=yes |
| 469 | + else |
| 470 | + doebcdic=yes |
| 471 | + fi |
466 | 472 | fi |
467 | 473 |
|
468 | 474 | # Handle any explicit skips at this stage, so that an argument list may consist |
@@ -921,24 +927,44 @@ for bmode in "$test8" "$test16" "$test32"; do |
921 | 927 | checkresult $? heap-$bits "" |
922 | 928 | fi |
923 | 929 |
|
924 | | -# End of loop for 8/16/32-bit tests |
925 | | -done |
926 | | - |
927 | | - |
928 | | -# ------ Special EBCDIC Test ------- |
| 930 | + # Special EBCDIC tests |
929 | 931 |
|
930 | | -if [ $doebcdic = yes ] ; then |
931 | | - $sim $valgrind $pcre2test -C ebcdic >/dev/null |
932 | | - ebcdic=$? |
933 | | - if [ $ebcdic -ne 1 ] ; then |
934 | | - echo "Cannot run EBCDIC tests: EBCDIC support not compiled" |
935 | | - exit 1 |
| 932 | + if [ $doebcdic = yes ] ; then |
| 933 | + echo $titleEBC |
| 934 | + if [ $ebcdic -ne 1 ] ; then |
| 935 | + echo "Cannot run EBCDIC tests: EBCDIC support not compiled" |
| 936 | + exit 1 |
| 937 | + fi |
| 938 | + if [ $ebcdic_io -eq 0 ] ; then |
| 939 | + # Our testdata files are in ASCII, and the pcre2test program is using |
| 940 | + # ASCII input: all easy. |
| 941 | + for opt in "" "-dfa"; do |
| 942 | + $sim $valgrind $pcre2test -q $setstack $bmode $opt $testdata/testinputEBC >testtry |
| 943 | + checkresult $? EBC "$opt" |
| 944 | + done |
| 945 | + else |
| 946 | + echo "Cannot run EBCDIC tests:" |
| 947 | + echo " Ironically we do not support running these tests on an actual" |
| 948 | + echo " EBCDIC system. The testdata files shipped with PCRE2 are in ASCII." |
| 949 | + echo " You may be able to run the tests manually if you know which" |
| 950 | + echo " EBCDIC codepage you used when compiling PCRE2, and then convert" |
| 951 | + echo " the testdata to match. For example, if the C compiler used to build" |
| 952 | + echo " PCRE2 was using IBM-1047:" |
| 953 | + echo "" |
| 954 | + echo " iconv -f ISO8859-1 -t IBM-1047 <testdata/testinputEBC >testinputEBC-native" |
| 955 | + echo " pcre2test -q -$bmode testinputEBC-native >testoutputEBC-native" |
| 956 | + echo " [ $? -eq 0 ] || echo 'pcre2test failed'" |
| 957 | + echo " iconv -f IBM-1047 -t ISO8859-1 <testoutputEBC-native >testoutputEBC-ascii" |
| 958 | + echo " $cf testdata/testoutputEBC testoutputEBC-ascii" |
| 959 | + echo "" |
| 960 | + echo "This is speculative. The PCRE2 maintainers do not have access to an" |
| 961 | + echo "EBCDIC system to test this. Please report back if you try it." |
| 962 | + exit 1 |
| 963 | + fi |
936 | 964 | fi |
937 | | - for opt in "" "-dfa"; do |
938 | | - $sim $valgrind $pcre2test -q $opt $testdata/testinputEBC >testtry |
939 | | - checkresult $? EBC "$opt" |
940 | | - done |
941 | | -fi |
| 965 | + |
| 966 | +# End of loop for 8/16/32-bit tests |
| 967 | +done |
942 | 968 |
|
943 | 969 |
|
944 | 970 | # Clean up local working files |
|
0 commit comments