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