| 1 |
#! /bin/sh
|
| 2 |
|
| 3 |
# Run the PCRE tests using the pcretest program. The appropriate tests are
|
| 4 |
# selected, depending on which build-time options were used.
|
| 5 |
|
| 6 |
# All tests are now run both with and without -s, to ensure that everything is
|
| 7 |
# tested with and without studying. However, there are some tests that produce
|
| 8 |
# different output after studying, typically when we are tracing the actual
|
| 9 |
# matching process (for example, using auto-callouts). In these few cases, the
|
| 10 |
# tests are duplicated in the files, one with /S to force studying always, and
|
| 11 |
# 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 |
# Whichever of the 8-bit and 16-bit libraries exist are tested. It is also
|
| 22 |
# possible to select which to test by the arguments -8 or -16.
|
| 23 |
|
| 24 |
# Other arguments for this script can be individual test numbers, or the word
|
| 25 |
# "valgrind", or "sim" followed by an argument to run cross-compiled
|
| 26 |
# executables under a simulator, for example:
|
| 27 |
#
|
| 28 |
# RunTest 3 sim "qemu-arm -s 8388608"
|
| 29 |
|
| 30 |
valgrind=
|
| 31 |
sim=
|
| 32 |
arg8=
|
| 33 |
arg16=
|
| 34 |
|
| 35 |
# Select which tests to run; for those that are explicitly requested, check
|
| 36 |
# that the necessary optional facilities are available.
|
| 37 |
|
| 38 |
do1=no
|
| 39 |
do2=no
|
| 40 |
do3=no
|
| 41 |
do4=no
|
| 42 |
do5=no
|
| 43 |
do6=no
|
| 44 |
do7=no
|
| 45 |
do8=no
|
| 46 |
do9=no
|
| 47 |
do10=no
|
| 48 |
do11=no
|
| 49 |
do12=no
|
| 50 |
do13=no
|
| 51 |
do14=no
|
| 52 |
do15=no
|
| 53 |
do16=no
|
| 54 |
do17=no
|
| 55 |
do18=no
|
| 56 |
do19=no
|
| 57 |
do20=no
|
| 58 |
|
| 59 |
while [ $# -gt 0 ] ; do
|
| 60 |
case $1 in
|
| 61 |
1) do1=yes;;
|
| 62 |
2) do2=yes;;
|
| 63 |
3) do3=yes;;
|
| 64 |
4) do4=yes;;
|
| 65 |
5) do5=yes;;
|
| 66 |
6) do6=yes;;
|
| 67 |
7) do7=yes;;
|
| 68 |
8) do8=yes;;
|
| 69 |
9) do9=yes;;
|
| 70 |
10) do10=yes;;
|
| 71 |
11) do11=yes;;
|
| 72 |
12) do12=yes;;
|
| 73 |
13) do13=yes;;
|
| 74 |
14) do14=yes;;
|
| 75 |
15) do15=yes;;
|
| 76 |
16) do16=yes;;
|
| 77 |
17) do17=yes;;
|
| 78 |
18) do18=yes;;
|
| 79 |
19) do19=yes;;
|
| 80 |
20) do20=yes;;
|
| 81 |
-8) arg8=yes;;
|
| 82 |
-16) arg16=yes;;
|
| 83 |
valgrind) valgrind="valgrind -q --smc-check=all";;
|
| 84 |
sim) shift; sim=$1;;
|
| 85 |
*) echo "Unknown test number $1"; exit 1;;
|
| 86 |
esac
|
| 87 |
shift
|
| 88 |
done
|
| 89 |
|
| 90 |
# Set up a suitable "diff" command for comparison. Some systems
|
| 91 |
# have a diff that lacks a -u option. Try to deal with this.
|
| 92 |
|
| 93 |
if diff -u /dev/null /dev/null; then cf="diff -u"; else cf="diff"; fi
|
| 94 |
|
| 95 |
# Find the test data
|
| 96 |
|
| 97 |
if [ -n "$srcdir" -a -d "$srcdir" ] ; then
|
| 98 |
testdata="$srcdir/testdata"
|
| 99 |
elif [ -d "./testdata" ] ; then
|
| 100 |
testdata=./testdata
|
| 101 |
elif [ -d "../testdata" ] ; then
|
| 102 |
testdata=../testdata
|
| 103 |
else
|
| 104 |
echo "Cannot find the testdata directory"
|
| 105 |
exit 1
|
| 106 |
fi
|
| 107 |
|
| 108 |
# Find which optional facilities are available. In some Windows environments
|
| 109 |
# the output of pcretest -C has CRLF at the end of each line, but the shell
|
| 110 |
# strips only linefeeds from the output of a `backquoted` command. Hence the
|
| 111 |
# alternative patterns.
|
| 112 |
|
| 113 |
$sim ./pcretest -C linksize >/dev/null
|
| 114 |
link_size=$?
|
| 115 |
if [ $link_size -lt 2 ] ; then
|
| 116 |
echo "Failed to find internal link size"
|
| 117 |
exit 1
|
| 118 |
fi
|
| 119 |
if [ $link_size -gt 4 ] ; then
|
| 120 |
echo "Failed to find internal link size"
|
| 121 |
exit 1
|
| 122 |
fi
|
| 123 |
|
| 124 |
# Both 8-bit and 16-bit character strings may be supported, but only one
|
| 125 |
# need be.
|
| 126 |
|
| 127 |
$sim ./pcretest -C pcre8 >/dev/null
|
| 128 |
support8=$?
|
| 129 |
$sim ./pcretest -C pcre16 >/dev/null
|
| 130 |
support16=$?
|
| 131 |
if [ $(( $support8 + $support16 )) -eq 2 ] ; then
|
| 132 |
test8=
|
| 133 |
test16=-16
|
| 134 |
if [ "$arg8" = yes -a "$arg16" != yes ] ; then
|
| 135 |
test16=skip
|
| 136 |
fi
|
| 137 |
if [ "$arg16" = yes -a "$arg8" != yes ] ; then
|
| 138 |
test8=skip
|
| 139 |
fi
|
| 140 |
else
|
| 141 |
if [ $support8 -ne 0 ] ; then
|
| 142 |
if [ "$arg16" = yes ] ; then
|
| 143 |
echo "Cannot run 16-bit library tests: 16-bit library not compiled"
|
| 144 |
exit 1
|
| 145 |
fi
|
| 146 |
test8=
|
| 147 |
test16=skip
|
| 148 |
else
|
| 149 |
if [ "$arg8" = yes ] ; then
|
| 150 |
echo "Cannot run 8-bit library tests: 8-bit library not compiled"
|
| 151 |
exit 1
|
| 152 |
fi
|
| 153 |
test8=skip
|
| 154 |
test16=-16
|
| 155 |
fi
|
| 156 |
fi
|
| 157 |
|
| 158 |
# UTF support always applies to both bit sizes if both are supported; we can't
|
| 159 |
# have UTF-8 support without UTF-16 support (for example).
|
| 160 |
|
| 161 |
$sim ./pcretest -C utf >/dev/null
|
| 162 |
utf=$?
|
| 163 |
|
| 164 |
$sim ./pcretest -C ucp >/dev/null
|
| 165 |
ucp=$?
|
| 166 |
|
| 167 |
jitopt=
|
| 168 |
$sim ./pcretest -C jit >/dev/null
|
| 169 |
jit=$?
|
| 170 |
if [ $jit -ne 0 ] ; then
|
| 171 |
jitopt=-s+
|
| 172 |
fi
|
| 173 |
|
| 174 |
if [ $utf -eq 0 ] ; then
|
| 175 |
if [ $do4 = yes ] ; then
|
| 176 |
echo "Can't run test 4 because UTF support is not configured"
|
| 177 |
exit 1
|
| 178 |
fi
|
| 179 |
if [ $do5 = yes ] ; then
|
| 180 |
echo "Can't run test 5 because UTF support is not configured"
|
| 181 |
exit 1
|
| 182 |
fi
|
| 183 |
if [ $do9 = yes ] ; then
|
| 184 |
echo "Can't run test 8 because UTF support is not configured"
|
| 185 |
exit 1
|
| 186 |
fi
|
| 187 |
if [ $do15 = yes ] ; then
|
| 188 |
echo "Can't run test 15 because UTF support is not configured"
|
| 189 |
exit 1
|
| 190 |
fi
|
| 191 |
if [ $do18 = yes ] ; then
|
| 192 |
echo "Can't run test 18 because UTF support is not configured"
|
| 193 |
fi
|
| 194 |
fi
|
| 195 |
|
| 196 |
if [ $ucp -eq 0 ] ; then
|
| 197 |
if [ $do6 = yes ] ; then
|
| 198 |
echo "Can't run test 6 because Unicode property support is not configured"
|
| 199 |
exit 1
|
| 200 |
fi
|
| 201 |
if [ $do7 = yes ] ; then
|
| 202 |
echo "Can't run test 7 because Unicode property support is not configured"
|
| 203 |
exit 1
|
| 204 |
fi
|
| 205 |
if [ $do10 = yes ] ; then
|
| 206 |
echo "Can't run test 10 because Unicode property support is not configured"
|
| 207 |
exit 1
|
| 208 |
fi
|
| 209 |
if [ $do16 = yes ] ; then
|
| 210 |
echo "Can't run test 16 because Unicode property support is not configured"
|
| 211 |
exit 1
|
| 212 |
fi
|
| 213 |
if [ $do19 = yes ] ; then
|
| 214 |
echo "Can't run test 19 because Unicode property support is not configured"
|
| 215 |
exit 1
|
| 216 |
fi
|
| 217 |
fi
|
| 218 |
|
| 219 |
if [ $link_size -ne 2 ] ; then
|
| 220 |
if [ $do11 = yes ] ; then
|
| 221 |
echo "Can't run test 11 because the link size ($link_size) is not 2"
|
| 222 |
exit 1
|
| 223 |
fi
|
| 224 |
fi
|
| 225 |
|
| 226 |
if [ $jit -eq 0 ] ; then
|
| 227 |
if [ $do12 = "yes" ] ; then
|
| 228 |
echo "Can't run test 12 because JIT support is not configured"
|
| 229 |
exit 1
|
| 230 |
fi
|
| 231 |
else
|
| 232 |
if [ $do13 = "yes" ] ; then
|
| 233 |
echo "Can't run test 13 because JIT support is configured"
|
| 234 |
exit 1
|
| 235 |
fi
|
| 236 |
fi
|
| 237 |
|
| 238 |
# If no specific tests were requested, select all. Those that are not
|
| 239 |
# relevant will be skipped.
|
| 240 |
|
| 241 |
if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \
|
| 242 |
$do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
|
| 243 |
$do9 = no -a $do10 = no -a $do11 = no -a $do12 = no -a \
|
| 244 |
$do13 = no -a $do14 = no -a $do15 = no -a $do16 = no -a \
|
| 245 |
$do17 = no -a $do18 = no -a $do19 = no -a $do20 = no ] ; then
|
| 246 |
do1=yes
|
| 247 |
do2=yes
|
| 248 |
do3=yes
|
| 249 |
do4=yes
|
| 250 |
do5=yes
|
| 251 |
do6=yes
|
| 252 |
do7=yes
|
| 253 |
do8=yes
|
| 254 |
do9=yes
|
| 255 |
do10=yes
|
| 256 |
do11=yes
|
| 257 |
do12=yes
|
| 258 |
do13=yes
|
| 259 |
do14=yes
|
| 260 |
do15=yes
|
| 261 |
do16=yes
|
| 262 |
do17=yes
|
| 263 |
do18=yes
|
| 264 |
do19=yes
|
| 265 |
do20=yes
|
| 266 |
fi
|
| 267 |
|
| 268 |
# Show which release and which test data
|
| 269 |
|
| 270 |
echo ""
|
| 271 |
echo PCRE C library tests using test data from $testdata
|
| 272 |
$sim ./pcretest /dev/null
|
| 273 |
|
| 274 |
for bmode in "$test8" "$test16"; do
|
| 275 |
case "$bmode" in
|
| 276 |
skip) continue;;
|
| 277 |
-16) if [ "$test8" != "skip" ] ; then echo ""; fi
|
| 278 |
bits=16; echo "---- Testing 16-bit library ----"; echo "";;
|
| 279 |
*) bits=8; echo "---- Testing 8-bit library ----"; echo "";;
|
| 280 |
esac
|
| 281 |
|
| 282 |
# Primary test, compatible with JIT and all versions of Perl >= 5.8
|
| 283 |
|
| 284 |
if [ $do1 = yes ] ; then
|
| 285 |
echo "Test 1: main functionality (Compatible with Perl >= 5.10)"
|
| 286 |
for opt in "" "-s" $jitopt; do
|
| 287 |
$sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput1 testtry
|
| 288 |
if [ $? = 0 ] ; then
|
| 289 |
$cf $testdata/testoutput1 testtry
|
| 290 |
if [ $? != 0 ] ; then exit 1; fi
|
| 291 |
else exit 1
|
| 292 |
fi
|
| 293 |
if [ "$opt" = "-s" ] ; then echo " OK with study"
|
| 294 |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
|
| 295 |
else echo " OK"
|
| 296 |
fi
|
| 297 |
done
|
| 298 |
fi
|
| 299 |
|
| 300 |
# PCRE tests that are not JIT or Perl-compatible: API, errors, internals
|
| 301 |
|
| 302 |
if [ $do2 = yes ] ; then
|
| 303 |
echo "Test 2: API, errors, internals, and non-Perl stuff (not UTF-$bits)"
|
| 304 |
for opt in "" "-s" $jitopt; do
|
| 305 |
$sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput2 testtry
|
| 306 |
if [ $? = 0 ] ; then
|
| 307 |
$cf $testdata/testoutput2 testtry
|
| 308 |
if [ $? != 0 ] ; then exit 1; fi
|
| 309 |
else
|
| 310 |
echo " "
|
| 311 |
echo "** Test 2 requires a lot of stack. If it has crashed with a"
|
| 312 |
echo "** segmentation fault, it may be that you do not have enough"
|
| 313 |
echo "** stack available by default. Please see the 'pcrestack' man"
|
| 314 |
echo "** page for a discussion of PCRE's stack usage."
|
| 315 |
echo " "
|
| 316 |
exit 1
|
| 317 |
fi
|
| 318 |
if [ "$opt" = "-s" ] ; then echo " OK with study"
|
| 319 |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
|
| 320 |
else echo " OK"
|
| 321 |
fi
|
| 322 |
done
|
| 323 |
fi
|
| 324 |
|
| 325 |
# Locale-specific tests, provided that either the "fr_FR" or the "french"
|
| 326 |
# locale is available. The former is the Unix-like standard; the latter is
|
| 327 |
# for Windows. Another possibility is "fr", which needs to be run against
|
| 328 |
# the Windows-specific input and output files.
|
| 329 |
|
| 330 |
if [ $do3 = yes ] ; then
|
| 331 |
locale -a | grep '^fr_FR$' >/dev/null
|
| 332 |
if [ $? -eq 0 ] ; then
|
| 333 |
locale=fr_FR
|
| 334 |
infile=$testdata/testinput3
|
| 335 |
outfile=$testdata/testoutput3
|
| 336 |
else
|
| 337 |
infile=test3input
|
| 338 |
outfile=test3output
|
| 339 |
locale -a | grep '^french$' >/dev/null
|
| 340 |
if [ $? -eq 0 ] ; then
|
| 341 |
locale=french
|
| 342 |
sed 's/fr_FR/french/' $testdata/testinput3 >test3input
|
| 343 |
sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
|
| 344 |
else
|
| 345 |
locale -a | grep '^fr$' >/dev/null
|
| 346 |
if [ $? -eq 0 ] ; then
|
| 347 |
locale=fr
|
| 348 |
sed 's/fr_FR/fr/' $testdata/wintestinput3 >test3input
|
| 349 |
sed 's/fr_FR/fr/' $testdata/wintestoutput3 >test3output
|
| 350 |
else
|
| 351 |
locale=
|
| 352 |
fi
|
| 353 |
fi
|
| 354 |
fi
|
| 355 |
|
| 356 |
if [ "$locale" != "" ] ; then
|
| 357 |
echo "Test 3: locale-specific features (using '$locale' locale)"
|
| 358 |
for opt in "" "-s" $jitopt; do
|
| 359 |
$sim $valgrind ./pcretest -q $bmode $opt $infile testtry
|
| 360 |
if [ $? = 0 ] ; then
|
| 361 |
$cf $outfile testtry
|
| 362 |
if [ $? != 0 ] ; then
|
| 363 |
echo " "
|
| 364 |
echo "Locale test did not run entirely successfully."
|
| 365 |
echo "This usually means that there is a problem with the locale"
|
| 366 |
echo "settings rather than a bug in PCRE."
|
| 367 |
break;
|
| 368 |
else
|
| 369 |
if [ "$opt" = "-s" ] ; then echo " OK with study"
|
| 370 |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
|
| 371 |
else echo " OK"
|
| 372 |
fi
|
| 373 |
fi
|
| 374 |
else exit 1
|
| 375 |
fi
|
| 376 |
done
|
| 377 |
else
|
| 378 |
echo "Cannot test locale-specific features - none of the 'fr_FR', 'fr' or"
|
| 379 |
echo "'french' locales exist, or the \"locale\" command is not available"
|
| 380 |
echo "to check for them."
|
| 381 |
echo " "
|
| 382 |
fi
|
| 383 |
fi
|
| 384 |
|
| 385 |
# Additional tests for UTF support
|
| 386 |
|
| 387 |
if [ $do4 = yes ] ; then
|
| 388 |
echo "Test 4: UTF-$bits support (Compatible with Perl >= 5.10)"
|
| 389 |
if [ $utf -eq 0 ] ; then
|
| 390 |
echo " Skipped because UTF-$bits support is not available"
|
| 391 |
else
|
| 392 |
for opt in "" "-s" $jitopt; do
|
| 393 |
$sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput4 testtry
|
| 394 |
if [ $? = 0 ] ; then
|
| 395 |
$cf $testdata/testoutput4 testtry
|
| 396 |
if [ $? != 0 ] ; then exit 1; fi
|
| 397 |
else exit 1
|
| 398 |
fi
|
| 399 |
if [ "$opt" = "-s" ] ; then echo " OK with study"
|
| 400 |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
|
| 401 |
else echo " OK"
|
| 402 |
fi
|
| 403 |
done
|
| 404 |
fi
|
| 405 |
fi
|
| 406 |
|
| 407 |
if [ $do5 = yes ] ; then
|
| 408 |
echo "Test 5: API, internals, and non-Perl stuff for UTF-$bits support"
|
| 409 |
if [ $utf -eq 0 ] ; then
|
| 410 |
echo " Skipped because UTF-$bits support is not available"
|
| 411 |
else
|
| 412 |
for opt in "" "-s" $jitopt; do
|
| 413 |
$sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput5 testtry
|
| 414 |
if [ $? = 0 ] ; then
|
| 415 |
$cf $testdata/testoutput5 testtry
|
| 416 |
if [ $? != 0 ] ; then exit 1; fi
|
| 417 |
else exit 1
|
| 418 |
fi
|
| 419 |
if [ "$opt" = "-s" ] ; then echo " OK with study"
|
| 420 |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
|
| 421 |
else echo " OK"
|
| 422 |
fi
|
| 423 |
done
|
| 424 |
fi
|
| 425 |
fi
|
| 426 |
|
| 427 |
if [ $do6 = yes ] ; then
|
| 428 |
echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)"
|
| 429 |
if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
|
| 430 |
echo " Skipped because Unicode property support is not available"
|
| 431 |
else
|
| 432 |
for opt in "" "-s" $jitopt; do
|
| 433 |
$sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput6 testtry
|
| 434 |
if [ $? = 0 ] ; then
|
| 435 |
$cf $testdata/testoutput6 testtry
|
| 436 |
if [ $? != 0 ] ; then exit 1; fi
|
| 437 |
else exit 1
|
| 438 |
fi
|
| 439 |
if [ "$opt" = "-s" ] ; then echo " OK with study"
|
| 440 |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
|
| 441 |
else echo " OK"
|
| 442 |
fi
|
| 443 |
done
|
| 444 |
fi
|
| 445 |
fi
|
| 446 |
|
| 447 |
# Test non-Perl-compatible Unicode property support
|
| 448 |
|
| 449 |
if [ $do7 = yes ] ; then
|
| 450 |
echo "Test 7: API, internals, and non-Perl stuff for Unicode property support"
|
| 451 |
if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
|
| 452 |
echo " Skipped because Unicode property support is not available"
|
| 453 |
else
|
| 454 |
for opt in "" "-s" $jitopt; do
|
| 455 |
$sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput7 testtry
|
| 456 |
if [ $? = 0 ] ; then
|
| 457 |
$cf $testdata/testoutput7 testtry
|
| 458 |
if [ $? != 0 ] ; then exit 1; fi
|
| 459 |
else exit 1
|
| 460 |
fi
|
| 461 |
if [ "$opt" = "-s" ] ; then echo " OK with study"
|
| 462 |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
|
| 463 |
else echo " OK"
|
| 464 |
fi
|
| 465 |
done
|
| 466 |
fi
|
| 467 |
fi
|
| 468 |
|
| 469 |
# Tests for DFA matching support
|
| 470 |
|
| 471 |
if [ $do8 = yes ] ; then
|
| 472 |
echo "Test 8: DFA matching main functionality"
|
| 473 |
for opt in "" "-s"; do
|
| 474 |
$sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput8 testtry
|
| 475 |
if [ $? = 0 ] ; then
|
| 476 |
$cf $testdata/testoutput8 testtry
|
| 477 |
if [ $? != 0 ] ; then exit 1; fi
|
| 478 |
else exit 1
|
| 479 |
fi
|
| 480 |
if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi
|
| 481 |
done
|
| 482 |
fi
|
| 483 |
|
| 484 |
if [ $do9 = yes ] ; then
|
| 485 |
echo "Test 9: DFA matching with UTF-$bits"
|
| 486 |
if [ $utf -eq 0 ] ; then
|
| 487 |
echo " Skipped because UTF-$bits support is not available"
|
| 488 |
else
|
| 489 |
for opt in "" "-s"; do
|
| 490 |
$sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput9 testtry
|
| 491 |
if [ $? = 0 ] ; then
|
| 492 |
$cf $testdata/testoutput9 testtry
|
| 493 |
if [ $? != 0 ] ; then exit 1; fi
|
| 494 |
else exit 1
|
| 495 |
fi
|
| 496 |
if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi
|
| 497 |
done
|
| 498 |
fi
|
| 499 |
fi
|
| 500 |
|
| 501 |
if [ $do10 = yes ] ; then
|
| 502 |
echo "Test 10: DFA matching with Unicode properties"
|
| 503 |
if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
|
| 504 |
echo " Skipped because Unicode property support is not available"
|
| 505 |
else
|
| 506 |
for opt in "" "-s"; do
|
| 507 |
$sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput10 testtry
|
| 508 |
if [ $? = 0 ] ; then
|
| 509 |
$cf $testdata/testoutput10 testtry
|
| 510 |
if [ $? != 0 ] ; then exit 1; fi
|
| 511 |
else exit 1
|
| 512 |
fi
|
| 513 |
if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi
|
| 514 |
done
|
| 515 |
fi
|
| 516 |
fi
|
| 517 |
|
| 518 |
# Test of internal offsets and code sizes. This test is run only when there
|
| 519 |
# is Unicode property support and the link size is 2. The actual tests are
|
| 520 |
# mostly the same as in some of the above, but in this test we inspect some
|
| 521 |
# offsets and sizes that require a known link size. This is a doublecheck for
|
| 522 |
# the maintainer, just in case something changes unexpectely. The output from
|
| 523 |
# this test is not the same in 8-bit and 16-bit modes.
|
| 524 |
|
| 525 |
if [ $do11 = yes ] ; then
|
| 526 |
echo "Test 11: Internal offsets and code size tests"
|
| 527 |
if [ $link_size -ne 2 ] ; then
|
| 528 |
echo " Skipped because link size is not 2"
|
| 529 |
elif [ $ucp -eq 0 ] ; then
|
| 530 |
echo " Skipped because Unicode property support is not available"
|
| 531 |
else
|
| 532 |
for opt in "" "-s"; do
|
| 533 |
$sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput11 testtry
|
| 534 |
if [ $? = 0 ] ; then
|
| 535 |
$cf $testdata/testoutput11-$bits testtry
|
| 536 |
if [ $? != 0 ] ; then exit 1; fi
|
| 537 |
else exit 1
|
| 538 |
fi
|
| 539 |
if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi
|
| 540 |
done
|
| 541 |
fi
|
| 542 |
fi
|
| 543 |
|
| 544 |
# Test JIT-specific features when JIT is available
|
| 545 |
|
| 546 |
if [ $do12 = yes ] ; then
|
| 547 |
echo "Test 12: JIT-specific features (JIT available)"
|
| 548 |
if [ $jit -eq 0 ] ; then
|
| 549 |
echo " Skipped because JIT is not available or not usable"
|
| 550 |
else
|
| 551 |
$sim $valgrind ./pcretest -q $bmode $testdata/testinput12 testtry
|
| 552 |
if [ $? = 0 ] ; then
|
| 553 |
$cf $testdata/testoutput12 testtry
|
| 554 |
if [ $? != 0 ] ; then exit 1; fi
|
| 555 |
else exit 1
|
| 556 |
fi
|
| 557 |
echo " OK"
|
| 558 |
fi
|
| 559 |
fi
|
| 560 |
|
| 561 |
# Test JIT-specific features when JIT is not available
|
| 562 |
|
| 563 |
if [ $do13 = yes ] ; then
|
| 564 |
echo "Test 13: JIT-specific features (JIT not available)"
|
| 565 |
if [ $jit -ne 0 ] ; then
|
| 566 |
echo " Skipped because JIT is available"
|
| 567 |
else
|
| 568 |
$sim $valgrind ./pcretest -q $bmode $testdata/testinput13 testtry
|
| 569 |
if [ $? = 0 ] ; then
|
| 570 |
$cf $testdata/testoutput13 testtry
|
| 571 |
if [ $? != 0 ] ; then exit 1; fi
|
| 572 |
else exit 1
|
| 573 |
fi
|
| 574 |
echo " OK"
|
| 575 |
fi
|
| 576 |
fi
|
| 577 |
|
| 578 |
# Tests for 8-bit-specific features
|
| 579 |
|
| 580 |
if [ "$do14" = yes ] ; then
|
| 581 |
echo "Test 14: specials for the basic 8-bit library"
|
| 582 |
if [ "$bits" = "16" ] ; then
|
| 583 |
echo " Skipped when running 16-bit tests"
|
| 584 |
elif [ $utf -eq 0 ] ; then
|
| 585 |
echo " Skipped because UTF-$bits support is not available"
|
| 586 |
else
|
| 587 |
for opt in "" "-s" $jitopt; do
|
| 588 |
$sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput14 testtry
|
| 589 |
if [ $? = 0 ] ; then
|
| 590 |
$cf $testdata/testoutput14 testtry
|
| 591 |
if [ $? != 0 ] ; then exit 1; fi
|
| 592 |
else exit 1
|
| 593 |
fi
|
| 594 |
if [ "$opt" = "-s" ] ; then echo " OK with study"
|
| 595 |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
|
| 596 |
else echo " OK"
|
| 597 |
fi
|
| 598 |
done
|
| 599 |
fi
|
| 600 |
fi
|
| 601 |
|
| 602 |
# Tests for 8-bit-specific features (needs UTF-8 support)
|
| 603 |
|
| 604 |
if [ "$do15" = yes ] ; then
|
| 605 |
echo "Test 15: specials for the 8-bit library with UTF-8 support"
|
| 606 |
if [ "$bits" = "16" ] ; then
|
| 607 |
echo " Skipped when running 16-bit tests"
|
| 608 |
elif [ $utf -eq 0 ] ; then
|
| 609 |
echo " Skipped because UTF-$bits support is not available"
|
| 610 |
else
|
| 611 |
for opt in "" "-s" $jitopt; do
|
| 612 |
$sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput15 testtry
|
| 613 |
if [ $? = 0 ] ; then
|
| 614 |
$cf $testdata/testoutput15 testtry
|
| 615 |
if [ $? != 0 ] ; then exit 1; fi
|
| 616 |
else exit 1
|
| 617 |
fi
|
| 618 |
if [ "$opt" = "-s" ] ; then echo " OK with study"
|
| 619 |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
|
| 620 |
else echo " OK"
|
| 621 |
fi
|
| 622 |
done
|
| 623 |
fi
|
| 624 |
fi
|
| 625 |
|
| 626 |
# Tests for 8-bit-specific features (Unicode property support)
|
| 627 |
|
| 628 |
if [ $do16 = yes ] ; then
|
| 629 |
echo "Test 16: specials for the 8-bit library with Unicode propery support"
|
| 630 |
if [ "$bits" = "16" ] ; then
|
| 631 |
echo " Skipped when running 16-bit tests"
|
| 632 |
elif [ $ucp -eq 0 ] ; then
|
| 633 |
echo " Skipped because Unicode property support is not available"
|
| 634 |
else
|
| 635 |
for opt in "" "-s" $jitopt; do
|
| 636 |
$sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput16 testtry
|
| 637 |
if [ $? = 0 ] ; then
|
| 638 |
$cf $testdata/testoutput16 testtry
|
| 639 |
if [ $? != 0 ] ; then exit 1; fi
|
| 640 |
else exit 1
|
| 641 |
fi
|
| 642 |
if [ "$opt" = "-s" ] ; then echo " OK with study"
|
| 643 |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
|
| 644 |
else echo " OK"
|
| 645 |
fi
|
| 646 |
done
|
| 647 |
fi
|
| 648 |
fi
|
| 649 |
|
| 650 |
# Tests for 16-bit-specific features
|
| 651 |
|
| 652 |
if [ $do17 = yes ] ; then
|
| 653 |
echo "Test 17: specials for the basic 16-bit library"
|
| 654 |
if [ "$bits" = "8" ] ; then
|
| 655 |
echo " Skipped when running 8-bit tests"
|
| 656 |
else
|
| 657 |
for opt in "" "-s" $jitopt; do
|
| 658 |
$sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput17 testtry
|
| 659 |
if [ $? = 0 ] ; then
|
| 660 |
$cf $testdata/testoutput17 testtry
|
| 661 |
if [ $? != 0 ] ; then exit 1; fi
|
| 662 |
else exit 1
|
| 663 |
fi
|
| 664 |
if [ "$opt" = "-s" ] ; then echo " OK with study"
|
| 665 |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
|
| 666 |
else echo " OK"
|
| 667 |
fi
|
| 668 |
done
|
| 669 |
fi
|
| 670 |
fi
|
| 671 |
|
| 672 |
# Tests for 16-bit-specific features (UTF-16 support)
|
| 673 |
|
| 674 |
if [ $do18 = yes ] ; then
|
| 675 |
echo "Test 18: specials for the 16-bit library with UTF-16 support"
|
| 676 |
if [ "$bits" = "8" ] ; then
|
| 677 |
echo " Skipped when running 8-bit tests"
|
| 678 |
elif [ $utf -eq 0 ] ; then
|
| 679 |
echo " Skipped because UTF-$bits support is not available"
|
| 680 |
else
|
| 681 |
for opt in "" "-s" $jitopt; do
|
| 682 |
$sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput18 testtry
|
| 683 |
if [ $? = 0 ] ; then
|
| 684 |
$cf $testdata/testoutput18 testtry
|
| 685 |
if [ $? != 0 ] ; then exit 1; fi
|
| 686 |
else exit 1
|
| 687 |
fi
|
| 688 |
if [ "$opt" = "-s" ] ; then echo " OK with study"
|
| 689 |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
|
| 690 |
else echo " OK"
|
| 691 |
fi
|
| 692 |
done
|
| 693 |
fi
|
| 694 |
fi
|
| 695 |
|
| 696 |
# Tests for 16-bit-specific features (Unicode property support)
|
| 697 |
|
| 698 |
if [ $do19 = yes ] ; then
|
| 699 |
echo "Test 19: specials for the 16-bit library with Unicode propery support"
|
| 700 |
if [ "$bits" = "8" ] ; then
|
| 701 |
echo " Skipped when running 8-bit tests"
|
| 702 |
elif [ $ucp -eq 0 ] ; then
|
| 703 |
echo " Skipped because Unicode property support is not available"
|
| 704 |
else
|
| 705 |
for opt in "" "-s" $jitopt; do
|
| 706 |
$sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput19 testtry
|
| 707 |
if [ $? = 0 ] ; then
|
| 708 |
$cf $testdata/testoutput19 testtry
|
| 709 |
if [ $? != 0 ] ; then exit 1; fi
|
| 710 |
else exit 1
|
| 711 |
fi
|
| 712 |
if [ "$opt" = "-s" ] ; then echo " OK with study"
|
| 713 |
elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
|
| 714 |
else echo " OK"
|
| 715 |
fi
|
| 716 |
done
|
| 717 |
fi
|
| 718 |
fi
|
| 719 |
|
| 720 |
# Tests for 16-bit-specific features in DFA non-UTF-16 mode
|
| 721 |
|
| 722 |
if [ $do20 = yes ] ; then
|
| 723 |
echo "Test 20: DFA specials for the basic 16-bit library"
|
| 724 |
if [ "$bits" = "8" ] ; then
|
| 725 |
echo " Skipped when running 8-bit tests"
|
| 726 |
else
|
| 727 |
for opt in "" "-s"; do
|
| 728 |
$sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput20 testtry
|
| 729 |
if [ $? = 0 ] ; then
|
| 730 |
$cf $testdata/testoutput20 testtry
|
| 731 |
if [ $? != 0 ] ; then exit 1; fi
|
| 732 |
else exit 1
|
| 733 |
fi
|
| 734 |
if [ "$opt" = "-s" ] ; then echo " OK with study"
|
| 735 |
else echo " OK"
|
| 736 |
fi
|
| 737 |
done
|
| 738 |
fi
|
| 739 |
fi
|
| 740 |
|
| 741 |
# End of loop for 8-bit/16-bit tests
|
| 742 |
done
|
| 743 |
|
| 744 |
# End
|