| 1 |
#! /bin/sh |
#! /bin/sh |
| 2 |
|
|
| 3 |
# Run PCRE tests. |
# Run the PCRE tests using the pcretest program. All tests are now run both |
| 4 |
|
# with and without -s, to ensure that everything is tested with and without |
| 5 |
|
# studying. However, there are some tests that produce different output after |
| 6 |
|
# studying, typically when we are tracing the actual matching process (for |
| 7 |
|
# example, using auto-callouts). In these few cases, the tests are duplicated |
| 8 |
|
# in the files, one with /S to force studying always, and one with /SS to force |
| 9 |
|
# *not* studying always. The use of -s doesn't then make any difference to |
| 10 |
|
# their output. There is also one test which compiles invalid UTF-8 with the |
| 11 |
|
# UTF-8 check turned off for which studying is disabled with /SS. |
| 12 |
|
|
| 13 |
valgrind= |
valgrind= |
| 14 |
|
|
| 145 |
|
|
| 146 |
if [ $do1 = yes ] ; then |
if [ $do1 = yes ] ; then |
| 147 |
echo "Test 1: main functionality (Compatible with Perl >= 5.8)" |
echo "Test 1: main functionality (Compatible with Perl >= 5.8)" |
| 148 |
$valgrind ./pcretest -q $testdata/testinput1 testtry |
for opt in "" "-s"; do |
| 149 |
if [ $? = 0 ] ; then |
$valgrind ./pcretest -q $opt $testdata/testinput1 testtry |
| 150 |
$cf $testdata/testoutput1 testtry |
if [ $? = 0 ] ; then |
| 151 |
if [ $? != 0 ] ; then exit 1; fi |
$cf $testdata/testoutput1 testtry |
| 152 |
else exit 1 |
if [ $? != 0 ] ; then exit 1; fi |
| 153 |
fi |
else exit 1 |
| 154 |
echo "OK" |
fi |
| 155 |
|
if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi |
| 156 |
|
done |
| 157 |
fi |
fi |
| 158 |
|
|
| 159 |
# PCRE tests that are not Perl-compatible - API, errors, internals |
# PCRE tests that are not Perl-compatible - API, errors, internals |
| 160 |
|
|
| 161 |
if [ $do2 = yes ] ; then |
if [ $do2 = yes ] ; then |
| 162 |
echo "Test 2: API, errors, internals, and non-Perl stuff" |
echo "Test 2: API, errors, internals, and non-Perl stuff" |
| 163 |
$valgrind ./pcretest -q $testdata/testinput2 testtry |
for opt in "" "-s"; do |
| 164 |
if [ $? = 0 ] ; then |
$valgrind ./pcretest -q $opt $testdata/testinput2 testtry |
| 165 |
$cf $testdata/testoutput2 testtry |
if [ $? = 0 ] ; then |
| 166 |
if [ $? != 0 ] ; then exit 1; fi |
$cf $testdata/testoutput2 testtry |
| 167 |
else |
if [ $? != 0 ] ; then exit 1; fi |
| 168 |
echo " " |
else |
| 169 |
echo "** Test 2 requires a lot of stack. If it has crashed with a" |
echo " " |
| 170 |
echo "** segmentation fault, it may be that you do not have enough" |
echo "** Test 2 requires a lot of stack. If it has crashed with a" |
| 171 |
echo "** stack available by default. Please see the 'pcrestack' man" |
echo "** segmentation fault, it may be that you do not have enough" |
| 172 |
echo "** page for a discussion of PCRE's stack usage." |
echo "** stack available by default. Please see the 'pcrestack' man" |
| 173 |
echo " " |
echo "** page for a discussion of PCRE's stack usage." |
| 174 |
exit 1 |
echo " " |
| 175 |
fi |
exit 1 |
| 176 |
echo "OK" |
fi |
| 177 |
|
if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi |
| 178 |
|
done |
| 179 |
fi |
fi |
| 180 |
|
|
| 181 |
# Locale-specific tests, provided that either the "fr_FR" or the "french" |
# Locale-specific tests, provided that either the "fr_FR" or the "french" |
| 203 |
|
|
| 204 |
if [ "$locale" != "" ] ; then |
if [ "$locale" != "" ] ; then |
| 205 |
echo "Test 3: locale-specific features (using '$locale' locale)" |
echo "Test 3: locale-specific features (using '$locale' locale)" |
| 206 |
$valgrind ./pcretest -q $infile testtry |
for opt in "" "-s"; do |
| 207 |
if [ $? = 0 ] ; then |
$valgrind ./pcretest -q $opt $infile testtry |
| 208 |
$cf $outfile testtry |
if [ $? = 0 ] ; then |
| 209 |
if [ $? != 0 ] ; then |
$cf $outfile testtry |
| 210 |
echo " " |
if [ $? != 0 ] ; then |
| 211 |
echo "Locale test did not run entirely successfully." |
echo " " |
| 212 |
echo "This usually means that there is a problem with the locale" |
echo "Locale test did not run entirely successfully." |
| 213 |
echo "settings rather than a bug in PCRE." |
echo "This usually means that there is a problem with the locale" |
| 214 |
else |
echo "settings rather than a bug in PCRE." |
| 215 |
echo "OK" |
break; |
| 216 |
|
else |
| 217 |
|
if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi |
| 218 |
|
fi |
| 219 |
|
else exit 1 |
| 220 |
fi |
fi |
| 221 |
else exit 1 |
done |
|
fi |
|
| 222 |
else |
else |
| 223 |
echo "Cannot test locale-specific features - neither the 'fr_FR' nor the" |
echo "Cannot test locale-specific features - neither the 'fr_FR' nor the" |
| 224 |
echo "'french' locale exists, or the \"locale\" command is not available" |
echo "'french' locale exists, or the \"locale\" command is not available" |
| 231 |
|
|
| 232 |
if [ $do4 = yes ] ; then |
if [ $do4 = yes ] ; then |
| 233 |
echo "Test 4: UTF-8 support (Compatible with Perl >= 5.8)" |
echo "Test 4: UTF-8 support (Compatible with Perl >= 5.8)" |
| 234 |
$valgrind ./pcretest -q $testdata/testinput4 testtry |
for opt in "" "-s"; do |
| 235 |
if [ $? = 0 ] ; then |
$valgrind ./pcretest -q $opt $testdata/testinput4 testtry |
| 236 |
$cf $testdata/testoutput4 testtry |
if [ $? = 0 ] ; then |
| 237 |
if [ $? != 0 ] ; then exit 1; fi |
$cf $testdata/testoutput4 testtry |
| 238 |
else exit 1 |
if [ $? != 0 ] ; then exit 1; fi |
| 239 |
fi |
else exit 1 |
| 240 |
echo "OK" |
fi |
| 241 |
|
if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi |
| 242 |
|
done |
| 243 |
fi |
fi |
| 244 |
|
|
| 245 |
if [ $do5 = yes ] ; then |
if [ $do5 = yes ] ; then |
| 246 |
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" |
| 247 |
$valgrind ./pcretest -q $testdata/testinput5 testtry |
for opt in "" "-s"; do |
| 248 |
if [ $? = 0 ] ; then |
$valgrind ./pcretest -q $opt $testdata/testinput5 testtry |
| 249 |
$cf $testdata/testoutput5 testtry |
if [ $? = 0 ] ; then |
| 250 |
if [ $? != 0 ] ; then exit 1; fi |
$cf $testdata/testoutput5 testtry |
| 251 |
else exit 1 |
if [ $? != 0 ] ; then exit 1; fi |
| 252 |
fi |
else exit 1 |
| 253 |
echo "OK" |
fi |
| 254 |
|
if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi |
| 255 |
|
done |
| 256 |
fi |
fi |
| 257 |
|
|
| 258 |
if [ $do6 = yes ] ; then |
if [ $do6 = yes ] ; then |
| 259 |
echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)" |
echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)" |
| 260 |
$valgrind ./pcretest -q $testdata/testinput6 testtry |
for opt in "" "-s"; do |
| 261 |
if [ $? = 0 ] ; then |
$valgrind ./pcretest -q $opt $testdata/testinput6 testtry |
| 262 |
$cf $testdata/testoutput6 testtry |
if [ $? = 0 ] ; then |
| 263 |
if [ $? != 0 ] ; then exit 1; fi |
$cf $testdata/testoutput6 testtry |
| 264 |
else exit 1 |
if [ $? != 0 ] ; then exit 1; fi |
| 265 |
fi |
else exit 1 |
| 266 |
echo "OK" |
fi |
| 267 |
|
if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi |
| 268 |
|
done |
| 269 |
fi |
fi |
| 270 |
|
|
| 271 |
# Tests for DFA matching support |
# Tests for DFA matching support |
| 272 |
|
|
| 273 |
if [ $do7 = yes ] ; then |
if [ $do7 = yes ] ; then |
| 274 |
echo "Test 7: DFA matching" |
echo "Test 7: DFA matching" |
| 275 |
$valgrind ./pcretest -q -dfa $testdata/testinput7 testtry |
for opt in "" "-s"; do |
| 276 |
if [ $? = 0 ] ; then |
$valgrind ./pcretest -q $opt -dfa $testdata/testinput7 testtry |
| 277 |
$cf $testdata/testoutput7 testtry |
if [ $? = 0 ] ; then |
| 278 |
if [ $? != 0 ] ; then exit 1; fi |
$cf $testdata/testoutput7 testtry |
| 279 |
else exit 1 |
if [ $? != 0 ] ; then exit 1; fi |
| 280 |
fi |
else exit 1 |
| 281 |
echo "OK" |
fi |
| 282 |
|
if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi |
| 283 |
|
done |
| 284 |
fi |
fi |
| 285 |
|
|
| 286 |
if [ $do8 = yes ] ; then |
if [ $do8 = yes ] ; then |
| 287 |
echo "Test 8: DFA matching with UTF-8" |
echo "Test 8: DFA matching with UTF-8" |
| 288 |
$valgrind ./pcretest -q -dfa $testdata/testinput8 testtry |
for opt in "" "-s"; do |
| 289 |
if [ $? = 0 ] ; then |
$valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry |
| 290 |
$cf $testdata/testoutput8 testtry |
if [ $? = 0 ] ; then |
| 291 |
if [ $? != 0 ] ; then exit 1; fi |
$cf $testdata/testoutput8 testtry |
| 292 |
else exit 1 |
if [ $? != 0 ] ; then exit 1; fi |
| 293 |
fi |
else exit 1 |
| 294 |
echo "OK" |
fi |
| 295 |
|
if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi |
| 296 |
|
done |
| 297 |
fi |
fi |
| 298 |
|
|
| 299 |
if [ $do9 = yes ] ; then |
if [ $do9 = yes ] ; then |
| 300 |
echo "Test 9: DFA matching with Unicode properties" |
echo "Test 9: DFA matching with Unicode properties" |
| 301 |
$valgrind ./pcretest -q -dfa $testdata/testinput9 testtry |
for opt in "" "-s"; do |
| 302 |
if [ $? = 0 ] ; then |
$valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry |
| 303 |
$cf $testdata/testoutput9 testtry |
if [ $? = 0 ] ; then |
| 304 |
if [ $? != 0 ] ; then exit 1; fi |
$cf $testdata/testoutput9 testtry |
| 305 |
else exit 1 |
if [ $? != 0 ] ; then exit 1; fi |
| 306 |
fi |
else exit 1 |
| 307 |
echo "OK" |
fi |
| 308 |
|
if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi |
| 309 |
|
done |
| 310 |
fi |
fi |
| 311 |
|
|
| 312 |
# 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 |
| 317 |
|
|
| 318 |
if [ $do10 = yes ] ; then |
if [ $do10 = yes ] ; then |
| 319 |
echo "Test 10: Internal offsets and code size tests" |
echo "Test 10: Internal offsets and code size tests" |
| 320 |
$valgrind ./pcretest -q $testdata/testinput10 testtry |
for opt in "" "-s"; do |
| 321 |
if [ $? = 0 ] ; then |
$valgrind ./pcretest -q $opt $testdata/testinput10 testtry |
| 322 |
$cf $testdata/testoutput10 testtry |
if [ $? = 0 ] ; then |
| 323 |
if [ $? != 0 ] ; then exit 1; fi |
$cf $testdata/testoutput10 testtry |
| 324 |
else exit 1 |
if [ $? != 0 ] ; then exit 1; fi |
| 325 |
fi |
else exit 1 |
| 326 |
echo "OK" |
fi |
| 327 |
|
if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi |
| 328 |
|
done |
| 329 |
fi |
fi |
| 330 |
|
|
| 331 |
# Test of Perl >= 5.10 features |
# Test of Perl >= 5.10 features |
| 332 |
|
|
| 333 |
if [ $do11 = yes ] ; then |
if [ $do11 = yes ] ; then |
| 334 |
echo "Test 11: Features from Perl >= 5.10" |
echo "Test 11: Features from Perl >= 5.10" |
| 335 |
$valgrind ./pcretest -q $testdata/testinput11 testtry |
for opt in "" "-s"; do |
| 336 |
if [ $? = 0 ] ; then |
$valgrind ./pcretest -q $opt $testdata/testinput11 testtry |
| 337 |
$cf $testdata/testoutput11 testtry |
if [ $? = 0 ] ; then |
| 338 |
if [ $? != 0 ] ; then exit 1; fi |
$cf $testdata/testoutput11 testtry |
| 339 |
else exit 1 |
if [ $? != 0 ] ; then exit 1; fi |
| 340 |
fi |
else exit 1 |
| 341 |
echo "OK" |
fi |
| 342 |
|
if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi |
| 343 |
|
done |
| 344 |
fi |
fi |
| 345 |
|
|
| 346 |
# Test non-Perl-compatible Unicode property support |
# Test non-Perl-compatible Unicode property support |
| 347 |
|
|
| 348 |
if [ $do12 = yes ] ; then |
if [ $do12 = yes ] ; then |
| 349 |
echo "Test 12: API, internals, and non-Perl stuff for Unicode property support" |
echo "Test 12: API, internals, and non-Perl stuff for Unicode property support" |
| 350 |
$valgrind ./pcretest -q $testdata/testinput12 testtry |
for opt in "" "-s"; do |
| 351 |
if [ $? = 0 ] ; then |
$valgrind ./pcretest -q $opt $testdata/testinput12 testtry |
| 352 |
$cf $testdata/testoutput12 testtry |
if [ $? = 0 ] ; then |
| 353 |
if [ $? != 0 ] ; then exit 1; fi |
$cf $testdata/testoutput12 testtry |
| 354 |
else exit 1 |
if [ $? != 0 ] ; then exit 1; fi |
| 355 |
fi |
else exit 1 |
| 356 |
echo "OK" |
fi |
| 357 |
|
if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi |
| 358 |
|
done |
| 359 |
fi |
fi |
| 360 |
|
|
| 361 |
# End |
# End |