| 1 |
#! /bin/sh |
#! /bin/sh |
| 2 |
|
|
| 3 |
# Run the PCRE tests using the pcretest program. All tests are now run both |
# Run the PCRE tests using the pcretest program. The appropriate tests are |
| 4 |
# with and without -s, to ensure that everything is tested with and without |
# selected, depending on which build-time options were used. |
| 5 |
# studying. However, there are some tests that produce different output after |
|
| 6 |
# studying, typically when we are tracing the actual matching process (for |
# All tests are now run both with and without -s, to ensure that everything is |
| 7 |
# example, using auto-callouts). In these few cases, the tests are duplicated |
# tested with and without studying. However, there are some tests that produce |
| 8 |
# in the files, one with /S to force studying always, and one with /SS to force |
# different output after studying, typically when we are tracing the actual |
| 9 |
# *not* studying always. The use of -s doesn't then make any difference to |
# matching process (for example, using auto-callouts). In these few cases, the |
| 10 |
# their output. There is also one test which compiles invalid UTF-8 with the |
# tests are duplicated in the files, one with /S to force studying always, and |
| 11 |
# UTF-8 check turned off for which studying is disabled with /SS. |
# one with /SS to force *not* studying always. The use of -s doesn't then make |
| 12 |
|
# any difference to their output. There is also one test which compiles invalid |
| 13 |
|
# UTF-8 with the UTF-8 check turned off; for this, studying must also be |
| 14 |
|
# disabled with /SS. |
| 15 |
|
|
| 16 |
|
# When JIT support is available, all the tests are also run with -s+ to test |
| 17 |
|
# (again, almost) everything with studying and the JIT option. There are also |
| 18 |
|
# two tests for JIT-specific features, one to be run when JIT support is |
| 19 |
|
# available, and one when it is not. |
| 20 |
|
|
| 21 |
valgrind= |
valgrind= |
| 22 |
|
|
| 70 |
do11=no |
do11=no |
| 71 |
do12=no |
do12=no |
| 72 |
do13=no |
do13=no |
| 73 |
|
do14=no |
| 74 |
|
do15=no |
| 75 |
|
|
| 76 |
while [ $# -gt 0 ] ; do |
while [ $# -gt 0 ] ; do |
| 77 |
case $1 in |
case $1 in |
| 88 |
11) do11=yes;; |
11) do11=yes;; |
| 89 |
12) do12=yes;; |
12) do12=yes;; |
| 90 |
13) do13=yes;; |
13) do13=yes;; |
| 91 |
|
14) do14=yes;; |
| 92 |
|
15) do15=yes;; |
| 93 |
valgrind) valgrind="valgrind -q --smc-check=all";; |
valgrind) valgrind="valgrind -q --smc-check=all";; |
| 94 |
*) echo "Unknown test number $1"; exit 1;; |
*) echo "Unknown test number $1"; exit 1;; |
| 95 |
esac |
esac |
| 141 |
fi |
fi |
| 142 |
fi |
fi |
| 143 |
|
|
| 144 |
# If no specific tests were requested, select all that are relevant. |
if [ $jit -eq 0 ] ; then |
| 145 |
|
if [ $do14 = "yes" ] ; then |
| 146 |
|
echo "Can't run test 14 because JIT support is not configured" |
| 147 |
|
exit 1 |
| 148 |
|
fi |
| 149 |
|
else |
| 150 |
|
if [ $do15 = "yes" ] ; then |
| 151 |
|
echo "Can't run test 15 because JIT support is configured" |
| 152 |
|
exit 1 |
| 153 |
|
fi |
| 154 |
|
fi |
| 155 |
|
|
| 156 |
|
# If no specific tests were requested, select all. Those that are not |
| 157 |
|
# relevant will be skipped. |
| 158 |
|
|
| 159 |
if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \ |
if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \ |
| 160 |
$do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \ |
$do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \ |
| 161 |
$do9 = no -a $do10 = no -a $do11 = no -a $do12 = no -a \ |
$do9 = no -a $do10 = no -a $do11 = no -a $do12 = no -a \ |
| 162 |
$do13 = no ] ; then |
$do13 = no -a $do14 = no -a $do15 = no ] ; then |
| 163 |
do1=yes |
do1=yes |
| 164 |
do2=yes |
do2=yes |
| 165 |
do3=yes |
do3=yes |
| 166 |
if [ $utf8 -ne 0 ] ; then do4=yes; fi |
do4=yes |
| 167 |
if [ $utf8 -ne 0 ] ; then do5=yes; fi |
do5=yes |
| 168 |
if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do6=yes; fi |
do6=yes |
| 169 |
do7=yes |
do7=yes |
| 170 |
if [ $utf8 -ne 0 ] ; then do8=yes; fi |
do8=yes |
| 171 |
if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi |
do9=yes |
| 172 |
if [ $link_size -eq 2 -a $ucp -ne 0 ] ; then do10=yes; fi |
do10=yes |
| 173 |
do11=yes |
do11=yes |
| 174 |
if [ $utf8 -ne 0 ] ; then do12=yes; fi |
do12=yes |
| 175 |
if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do13=yes; fi |
do13=yes |
| 176 |
|
do14=yes |
| 177 |
|
do15=yes |
| 178 |
fi |
fi |
| 179 |
|
|
| 180 |
# Show which release |
# Show which release |
| 194 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 195 |
else exit 1 |
else exit 1 |
| 196 |
fi |
fi |
| 197 |
if [ "$opt" = "-s" ] ; then echo "OK with study" |
if [ "$opt" = "-s" ] ; then echo " OK with study" |
| 198 |
elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study" |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study" |
| 199 |
else echo "OK" |
else echo " OK" |
| 200 |
fi |
fi |
| 201 |
done |
done |
| 202 |
fi |
fi |
| 219 |
echo " " |
echo " " |
| 220 |
exit 1 |
exit 1 |
| 221 |
fi |
fi |
| 222 |
if [ "$opt" = "-s" ] ; then echo "OK with study" |
if [ "$opt" = "-s" ] ; then echo " OK with study" |
| 223 |
elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study" |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study" |
| 224 |
else echo "OK" |
else echo " OK" |
| 225 |
fi |
fi |
| 226 |
done |
done |
| 227 |
fi |
fi |
| 262 |
echo "settings rather than a bug in PCRE." |
echo "settings rather than a bug in PCRE." |
| 263 |
break; |
break; |
| 264 |
else |
else |
| 265 |
if [ "$opt" = "-s" ] ; then echo "OK with study" |
if [ "$opt" = "-s" ] ; then echo " OK with study" |
| 266 |
elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study" |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study" |
| 267 |
else echo "OK" |
else echo " OK" |
| 268 |
fi |
fi |
| 269 |
fi |
fi |
| 270 |
else exit 1 |
else exit 1 |
| 282 |
|
|
| 283 |
if [ $do4 = yes ] ; then |
if [ $do4 = yes ] ; then |
| 284 |
echo "Test 4: UTF-8 support (Compatible with Perl >= 5.8)" |
echo "Test 4: UTF-8 support (Compatible with Perl >= 5.8)" |
| 285 |
for opt in "" "-s" $jitopt; do |
if [ $utf8 -eq 0 ] ; then |
| 286 |
$valgrind ./pcretest -q $opt $testdata/testinput4 testtry |
echo " Skipped because UTF-8 support is not available" |
| 287 |
if [ $? = 0 ] ; then |
else |
| 288 |
$cf $testdata/testoutput4 testtry |
for opt in "" "-s" $jitopt; do |
| 289 |
if [ $? != 0 ] ; then exit 1; fi |
$valgrind ./pcretest -q $opt $testdata/testinput4 testtry |
| 290 |
else exit 1 |
if [ $? = 0 ] ; then |
| 291 |
fi |
$cf $testdata/testoutput4 testtry |
| 292 |
if [ "$opt" = "-s" ] ; then echo "OK with study" |
if [ $? != 0 ] ; then exit 1; fi |
| 293 |
elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study" |
else exit 1 |
| 294 |
else echo "OK" |
fi |
| 295 |
fi |
if [ "$opt" = "-s" ] ; then echo " OK with study" |
| 296 |
done |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study" |
| 297 |
|
else echo " OK" |
| 298 |
|
fi |
| 299 |
|
done |
| 300 |
|
fi |
| 301 |
fi |
fi |
| 302 |
|
|
| 303 |
if [ $do5 = yes ] ; then |
if [ $do5 = yes ] ; then |
| 304 |
echo "Test 5: API, internals, and non-Perl stuff for UTF-8 support" |
echo "Test 5: API, internals, and non-Perl stuff for UTF-8 support" |
| 305 |
for opt in "" "-s" $jitopt; do |
if [ $utf8 -eq 0 ] ; then |
| 306 |
$valgrind ./pcretest -q $opt $testdata/testinput5 testtry |
echo " Skipped because UTF-8 support is not available" |
| 307 |
if [ $? = 0 ] ; then |
else |
| 308 |
$cf $testdata/testoutput5 testtry |
for opt in "" "-s" $jitopt; do |
| 309 |
if [ $? != 0 ] ; then exit 1; fi |
$valgrind ./pcretest -q $opt $testdata/testinput5 testtry |
| 310 |
else exit 1 |
if [ $? = 0 ] ; then |
| 311 |
fi |
$cf $testdata/testoutput5 testtry |
| 312 |
if [ "$opt" = "-s" ] ; then echo "OK with study" |
if [ $? != 0 ] ; then exit 1; fi |
| 313 |
elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study" |
else exit 1 |
| 314 |
else echo "OK" |
fi |
| 315 |
fi |
if [ "$opt" = "-s" ] ; then echo " OK with study" |
| 316 |
done |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study" |
| 317 |
|
else echo " OK" |
| 318 |
|
fi |
| 319 |
|
done |
| 320 |
|
fi |
| 321 |
fi |
fi |
| 322 |
|
|
| 323 |
if [ $do6 = yes ] ; then |
if [ $do6 = yes ] ; then |
| 324 |
echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)" |
echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)" |
| 325 |
for opt in "" "-s" $jitopt; do |
if [ $utf8 -eq 0 -o $ucp -eq 0 ] ; then |
| 326 |
$valgrind ./pcretest -q $opt $testdata/testinput6 testtry |
echo " Skipped because Unicode property support is not available" |
| 327 |
if [ $? = 0 ] ; then |
else |
| 328 |
$cf $testdata/testoutput6 testtry |
for opt in "" "-s" $jitopt; do |
| 329 |
if [ $? != 0 ] ; then exit 1; fi |
$valgrind ./pcretest -q $opt $testdata/testinput6 testtry |
| 330 |
else exit 1 |
if [ $? = 0 ] ; then |
| 331 |
fi |
$cf $testdata/testoutput6 testtry |
| 332 |
if [ "$opt" = "-s" ] ; then echo "OK with study" |
if [ $? != 0 ] ; then exit 1; fi |
| 333 |
elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study" |
else exit 1 |
| 334 |
else echo "OK" |
fi |
| 335 |
fi |
if [ "$opt" = "-s" ] ; then echo " OK with study" |
| 336 |
done |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study" |
| 337 |
|
else echo " OK" |
| 338 |
|
fi |
| 339 |
|
done |
| 340 |
|
fi |
| 341 |
fi |
fi |
| 342 |
|
|
| 343 |
# Tests for DFA matching support |
# Tests for DFA matching support |
| 351 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 352 |
else exit 1 |
else exit 1 |
| 353 |
fi |
fi |
| 354 |
if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi |
if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi |
| 355 |
done |
done |
| 356 |
fi |
fi |
| 357 |
|
|
| 358 |
if [ $do8 = yes ] ; then |
if [ $do8 = yes ] ; then |
| 359 |
echo "Test 8: DFA matching with UTF-8" |
echo "Test 8: DFA matching with UTF-8" |
| 360 |
for opt in "" "-s"; do |
if [ $utf8 -eq 0 ] ; then |
| 361 |
$valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry |
echo " Skipped because UTF-8 support is not available" |
| 362 |
if [ $? = 0 ] ; then |
else |
| 363 |
$cf $testdata/testoutput8 testtry |
for opt in "" "-s"; do |
| 364 |
if [ $? != 0 ] ; then exit 1; fi |
$valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry |
| 365 |
else exit 1 |
if [ $? = 0 ] ; then |
| 366 |
fi |
$cf $testdata/testoutput8 testtry |
| 367 |
if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 368 |
done |
else exit 1 |
| 369 |
|
fi |
| 370 |
|
if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi |
| 371 |
|
done |
| 372 |
|
fi |
| 373 |
fi |
fi |
| 374 |
|
|
| 375 |
if [ $do9 = yes ] ; then |
if [ $do9 = yes ] ; then |
| 376 |
echo "Test 9: DFA matching with Unicode properties" |
echo "Test 9: DFA matching with Unicode properties" |
| 377 |
for opt in "" "-s"; do |
if [ $utf8 -eq 0 -o $ucp -eq 0 ] ; then |
| 378 |
$valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry |
echo " Skipped because Unicode property support is not available" |
| 379 |
if [ $? = 0 ] ; then |
else |
| 380 |
$cf $testdata/testoutput9 testtry |
for opt in "" "-s"; do |
| 381 |
if [ $? != 0 ] ; then exit 1; fi |
$valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry |
| 382 |
else exit 1 |
if [ $? = 0 ] ; then |
| 383 |
fi |
$cf $testdata/testoutput9 testtry |
| 384 |
if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 385 |
done |
else exit 1 |
| 386 |
|
fi |
| 387 |
|
if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi |
| 388 |
|
done |
| 389 |
|
fi |
| 390 |
fi |
fi |
| 391 |
|
|
| 392 |
# Test of internal offsets and code sizes. This test is run only when there |
# Test of internal offsets and code sizes. This test is run only when there |
| 397 |
|
|
| 398 |
if [ $do10 = yes ] ; then |
if [ $do10 = yes ] ; then |
| 399 |
echo "Test 10: Internal offsets and code size tests" |
echo "Test 10: Internal offsets and code size tests" |
| 400 |
for opt in "" "-s"; do |
if [ $link_size -ne 2 ] ; then |
| 401 |
$valgrind ./pcretest -q $opt $testdata/testinput10 testtry |
echo " Skipped because link size is not 2" |
| 402 |
if [ $? = 0 ] ; then |
elif [ $ucp -eq 0 ] ; then |
| 403 |
$cf $testdata/testoutput10 testtry |
echo " Skipped because Unicode property support is not available" |
| 404 |
if [ $? != 0 ] ; then exit 1; fi |
else |
| 405 |
else exit 1 |
for opt in "" "-s"; do |
| 406 |
fi |
$valgrind ./pcretest -q $opt $testdata/testinput10 testtry |
| 407 |
if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi |
if [ $? = 0 ] ; then |
| 408 |
done |
$cf $testdata/testoutput10 testtry |
| 409 |
|
if [ $? != 0 ] ; then exit 1; fi |
| 410 |
|
else exit 1 |
| 411 |
|
fi |
| 412 |
|
if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi |
| 413 |
|
done |
| 414 |
|
fi |
| 415 |
fi |
fi |
| 416 |
|
|
| 417 |
# Test of Perl >= 5.10 features without UTF8 support |
# Test of Perl >= 5.10 features without UTF8 support |
| 425 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 426 |
else exit 1 |
else exit 1 |
| 427 |
fi |
fi |
| 428 |
if [ "$opt" = "-s" ] ; then echo "OK with study" |
if [ "$opt" = "-s" ] ; then echo " OK with study" |
| 429 |
elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study" |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study" |
| 430 |
else echo "OK" |
else echo " OK" |
| 431 |
fi |
fi |
| 432 |
done |
done |
| 433 |
fi |
fi |
| 436 |
|
|
| 437 |
if [ $do12 = yes ] ; then |
if [ $do12 = yes ] ; then |
| 438 |
echo "Test 12: Features from Perl >= 5.10 with UTF8 support" |
echo "Test 12: Features from Perl >= 5.10 with UTF8 support" |
| 439 |
for opt in "" "-s" $jitopt; do |
if [ $utf8 -eq 0 ] ; then |
| 440 |
$valgrind ./pcretest -q $opt $testdata/testinput12 testtry |
echo " Skipped because UTF-8 support is not available" |
| 441 |
if [ $? = 0 ] ; then |
else |
| 442 |
$cf $testdata/testoutput12 testtry |
for opt in "" "-s" $jitopt; do |
| 443 |
if [ $? != 0 ] ; then exit 1; fi |
$valgrind ./pcretest -q $opt $testdata/testinput12 testtry |
| 444 |
else exit 1 |
if [ $? = 0 ] ; then |
| 445 |
fi |
$cf $testdata/testoutput12 testtry |
| 446 |
if [ "$opt" = "-s" ] ; then echo "OK with study" |
if [ $? != 0 ] ; then exit 1; fi |
| 447 |
elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study" |
else exit 1 |
| 448 |
else echo "OK" |
fi |
| 449 |
fi |
if [ "$opt" = "-s" ] ; then echo " OK with study" |
| 450 |
done |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study" |
| 451 |
|
else echo " OK" |
| 452 |
|
fi |
| 453 |
|
done |
| 454 |
|
fi |
| 455 |
fi |
fi |
| 456 |
|
|
| 457 |
# Test non-Perl-compatible Unicode property support |
# Test non-Perl-compatible Unicode property support |
| 458 |
|
|
| 459 |
if [ $do13 = yes ] ; then |
if [ $do13 = yes ] ; then |
| 460 |
echo "Test 13: API, internals, and non-Perl stuff for Unicode property support" |
echo "Test 13: API, internals, and non-Perl stuff for Unicode property support" |
| 461 |
for opt in "" "-s" $jitopt; do |
if [ $utf8 -eq 0 -o $ucp -eq 0 ] ; then |
| 462 |
$valgrind ./pcretest -q $opt $testdata/testinput13 testtry |
echo " Skipped because Unicode property support is not available" |
| 463 |
|
else |
| 464 |
|
for opt in "" "-s" $jitopt; do |
| 465 |
|
$valgrind ./pcretest -q $opt $testdata/testinput13 testtry |
| 466 |
|
if [ $? = 0 ] ; then |
| 467 |
|
$cf $testdata/testoutput13 testtry |
| 468 |
|
if [ $? != 0 ] ; then exit 1; fi |
| 469 |
|
else exit 1 |
| 470 |
|
fi |
| 471 |
|
if [ "$opt" = "-s" ] ; then echo " OK with study" |
| 472 |
|
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study" |
| 473 |
|
else echo " OK" |
| 474 |
|
fi |
| 475 |
|
done |
| 476 |
|
fi |
| 477 |
|
fi |
| 478 |
|
|
| 479 |
|
# Test JIT-specific features when JIT is available |
| 480 |
|
|
| 481 |
|
if [ $do14 = yes ] ; then |
| 482 |
|
echo "Test 14: JIT-specific features (JIT available)" |
| 483 |
|
if [ $jit -eq 0 ] ; then |
| 484 |
|
echo " Skipped because JIT is not available" |
| 485 |
|
else |
| 486 |
|
$valgrind ./pcretest -q $testdata/testinput14 testtry |
| 487 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
| 488 |
$cf $testdata/testoutput13 testtry |
$cf $testdata/testoutput14 testtry |
| 489 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 490 |
else exit 1 |
else exit 1 |
| 491 |
fi |
fi |
| 492 |
if [ "$opt" = "-s" ] ; then echo "OK with study" |
echo " OK" |
| 493 |
elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study" |
fi |
| 494 |
else echo "OK" |
fi |
| 495 |
|
|
| 496 |
|
# Test JIT-specific features when JIT is not available |
| 497 |
|
|
| 498 |
|
if [ $do15 = yes ] ; then |
| 499 |
|
echo "Test 15: JIT-specific features (JIT not available)" |
| 500 |
|
if [ $jit -ne 0 ] ; then |
| 501 |
|
echo " Skipped because JIT is available" |
| 502 |
|
else |
| 503 |
|
$valgrind ./pcretest -q $testdata/testinput15 testtry |
| 504 |
|
if [ $? = 0 ] ; then |
| 505 |
|
$cf $testdata/testoutput15 testtry |
| 506 |
|
if [ $? != 0 ] ; then exit 1; fi |
| 507 |
|
else exit 1 |
| 508 |
fi |
fi |
| 509 |
done |
echo " OK" |
| 510 |
|
fi |
| 511 |
fi |
fi |
| 512 |
|
|
| 513 |
# End |
# End |