| 1 |
#! /bin/sh |
#! /bin/sh |
| 2 |
|
|
| 3 |
# Run PCRE tests. |
# Run PCRE tests. |
| 4 |
|
|
| 5 |
valgrind= |
valgrind= |
| 6 |
|
|
| 44 |
do8=no |
do8=no |
| 45 |
do9=no |
do9=no |
| 46 |
do10=no |
do10=no |
| 47 |
|
do11=no |
| 48 |
|
do12=no |
| 49 |
|
|
| 50 |
while [ $# -gt 0 ] ; do |
while [ $# -gt 0 ] ; do |
| 51 |
case $1 in |
case $1 in |
| 59 |
8) do8=yes;; |
8) do8=yes;; |
| 60 |
9) do9=yes;; |
9) do9=yes;; |
| 61 |
10) do10=yes;; |
10) do10=yes;; |
| 62 |
|
11) do11=yes;; |
| 63 |
|
12) do12=yes;; |
| 64 |
valgrind) valgrind="valgrind -q";; |
valgrind) valgrind="valgrind -q";; |
| 65 |
*) echo "Unknown test number $1"; exit 1;; |
*) echo "Unknown test number $1"; exit 1;; |
| 66 |
esac |
esac |
| 95 |
echo "Can't run test 10 because Unicode property support is not configured" |
echo "Can't run test 10 because Unicode property support is not configured" |
| 96 |
exit 1 |
exit 1 |
| 97 |
fi |
fi |
| 98 |
|
if [ $do12 = yes ] ; then |
| 99 |
|
echo "Can't run test 12 because Unicode property support is not configured" |
| 100 |
|
exit 1 |
| 101 |
|
fi |
| 102 |
fi |
fi |
| 103 |
|
|
| 104 |
if [ $link_size -ne 2 ] ; then |
if [ $link_size -ne 2 ] ; then |
| 112 |
|
|
| 113 |
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 \ |
| 114 |
$do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \ |
$do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \ |
| 115 |
$do9 = no -a $do10 = no ] ; then |
$do9 = no -a $do10 = no -a $do11 = no -a $do12 = no ] ; then |
| 116 |
do1=yes |
do1=yes |
| 117 |
do2=yes |
do2=yes |
| 118 |
do3=yes |
do3=yes |
| 123 |
if [ $utf8 -ne 0 ] ; then do8=yes; fi |
if [ $utf8 -ne 0 ] ; then do8=yes; fi |
| 124 |
if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi |
if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi |
| 125 |
if [ $link_size -eq 2 -a $ucp -ne 0 ] ; then do10=yes; fi |
if [ $link_size -eq 2 -a $ucp -ne 0 ] ; then do10=yes; fi |
| 126 |
|
do11=yes |
| 127 |
|
if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do12=yes; fi |
| 128 |
fi |
fi |
| 129 |
|
|
| 130 |
# Show which release |
# Show which release |
| 133 |
echo PCRE C library tests |
echo PCRE C library tests |
| 134 |
./pcretest /dev/null |
./pcretest /dev/null |
| 135 |
|
|
| 136 |
# Primary test, Perl-compatible |
# Primary test, Perl-compatible for both 5.8 and 5.10 |
| 137 |
|
|
| 138 |
if [ $do1 = yes ] ; then |
if [ $do1 = yes ] ; then |
| 139 |
echo "Test 1: main functionality (Perl compatible)" |
echo "Test 1: main functionality (Perl 5.8 & 5.10 compatible)" |
| 140 |
$valgrind ./pcretest -q $testdata/testinput1 testtry |
$valgrind ./pcretest -q $testdata/testinput1 testtry |
| 141 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
| 142 |
$cf $testdata/testoutput1 testtry |
$cf $testdata/testoutput1 testtry |
| 146 |
echo "OK" |
echo "OK" |
| 147 |
fi |
fi |
| 148 |
|
|
| 149 |
# PCRE tests that are not Perl-compatible - API & error tests, mostly |
# PCRE tests that are not Perl-compatible - API, errors, internals |
| 150 |
|
|
| 151 |
if [ $do2 = yes ] ; then |
if [ $do2 = yes ] ; then |
| 152 |
echo "Test 2: API and error handling (not Perl compatible)" |
echo "Test 2: API, errors, internals, and non-Perl stuff" |
| 153 |
$valgrind ./pcretest -q $testdata/testinput2 testtry |
$valgrind ./pcretest -q $testdata/testinput2 testtry |
| 154 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
| 155 |
$cf $testdata/testoutput2 testtry |
$cf $testdata/testoutput2 testtry |
| 156 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 157 |
else exit 1 |
else |
| 158 |
|
echo " " |
| 159 |
|
echo "** Test 2 requires a lot of stack. If it has crashed with a" |
| 160 |
|
echo "** segmentation fault, it may be that you do not have enough" |
| 161 |
|
echo "** stack available by default. Please see the 'pcrestack' man" |
| 162 |
|
echo "** page for a discussion of PCRE's stack usage." |
| 163 |
|
echo " " |
| 164 |
|
exit 1 |
| 165 |
fi |
fi |
| 166 |
echo "OK" |
echo "OK" |
| 167 |
fi |
fi |
| 215 |
# Additional tests for UTF8 support |
# Additional tests for UTF8 support |
| 216 |
|
|
| 217 |
if [ $do4 = yes ] ; then |
if [ $do4 = yes ] ; then |
| 218 |
echo "Test 4: UTF-8 support (Perl compatible)" |
echo "Test 4: UTF-8 support (Perl 5.8 & 5.10 compatible)" |
| 219 |
$valgrind ./pcretest -q $testdata/testinput4 testtry |
$valgrind ./pcretest -q $testdata/testinput4 testtry |
| 220 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
| 221 |
$cf $testdata/testoutput4 testtry |
$cf $testdata/testoutput4 testtry |
| 226 |
fi |
fi |
| 227 |
|
|
| 228 |
if [ $do5 = yes ] ; then |
if [ $do5 = yes ] ; then |
| 229 |
echo "Test 5: API and internals for UTF-8 support (not Perl compatible)" |
echo "Test 5: API, internals, and non-Perl stuff for UTF-8 support" |
| 230 |
$valgrind ./pcretest -q $testdata/testinput5 testtry |
$valgrind ./pcretest -q $testdata/testinput5 testtry |
| 231 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
| 232 |
$cf $testdata/testoutput5 testtry |
$cf $testdata/testoutput5 testtry |
| 237 |
fi |
fi |
| 238 |
|
|
| 239 |
if [ $do6 = yes ] ; then |
if [ $do6 = yes ] ; then |
| 240 |
echo "Test 6: Unicode property support" |
echo "Test 6: Unicode property support (Perl 5.10 compatible)" |
| 241 |
$valgrind ./pcretest -q $testdata/testinput6 testtry |
$valgrind ./pcretest -q $testdata/testinput6 testtry |
| 242 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
| 243 |
$cf $testdata/testoutput6 testtry |
$cf $testdata/testoutput6 testtry |
| 299 |
echo "OK" |
echo "OK" |
| 300 |
fi |
fi |
| 301 |
|
|
| 302 |
|
# Test of Perl 5.10 features |
| 303 |
|
|
| 304 |
|
if [ $do11 = yes ] ; then |
| 305 |
|
echo "Test 11: Perl 5.10 features" |
| 306 |
|
$valgrind ./pcretest -q $testdata/testinput11 testtry |
| 307 |
|
if [ $? = 0 ] ; then |
| 308 |
|
$cf $testdata/testoutput11 testtry |
| 309 |
|
if [ $? != 0 ] ; then exit 1; fi |
| 310 |
|
else exit 1 |
| 311 |
|
fi |
| 312 |
|
echo "OK" |
| 313 |
|
fi |
| 314 |
|
|
| 315 |
|
# Test non-Perl-compatible Unicode property support |
| 316 |
|
|
| 317 |
|
if [ $do12 = yes ] ; then |
| 318 |
|
echo "Test 12: API, internals, and non-Perl stuff for Unicode property support" |
| 319 |
|
$valgrind ./pcretest -q $testdata/testinput12 testtry |
| 320 |
|
if [ $? = 0 ] ; then |
| 321 |
|
$cf $testdata/testoutput12 testtry |
| 322 |
|
if [ $? != 0 ] ; then exit 1; fi |
| 323 |
|
else exit 1 |
| 324 |
|
fi |
| 325 |
|
echo "OK" |
| 326 |
|
fi |
| 327 |
|
|
| 328 |
# End |
# End |