| 6 |
# Run PCRE tests |
# Run PCRE tests |
| 7 |
|
|
| 8 |
cf=diff |
cf=diff |
| 9 |
testdata=@top_srcdir@/testdata |
valgrind= |
| 10 |
|
if [ ! -d testdata ] ; then |
| 11 |
|
ln -s @top_srcdir@/testdata testdata |
| 12 |
|
fi |
| 13 |
|
testdata=./testdata |
| 14 |
|
|
| 15 |
|
# Find which optional facilities are available |
| 16 |
|
|
| 17 |
|
case `./pcretest -C | ./pcregrep 'Internal link size'` in |
| 18 |
|
*2) link_size=2;; |
| 19 |
|
*3) link_size=3;; |
| 20 |
|
*4) link_size=4;; |
| 21 |
|
*) echo "Failed to find internal link size"; exit 1;; |
| 22 |
|
esac |
| 23 |
|
|
| 24 |
# Select which tests to run; if no selection, run all |
./pcretest -C | ./pcregrep 'No UTF-8 support' >/dev/null |
| 25 |
|
utf8=$? |
| 26 |
|
|
| 27 |
|
./pcretest -C | ./pcregrep 'No Unicode properties support' >/dev/null |
| 28 |
|
ucp=$? |
| 29 |
|
|
| 30 |
|
# Select which tests to run; for those that are explicitly requested, check |
| 31 |
|
# that the necessary optional facilities are available. |
| 32 |
|
|
| 33 |
do1=no |
do1=no |
| 34 |
do2=no |
do2=no |
| 51 |
7) do7=yes;; |
7) do7=yes;; |
| 52 |
8) do8=yes;; |
8) do8=yes;; |
| 53 |
9) do9=yes;; |
9) do9=yes;; |
| 54 |
|
valgrind) valgrind="valgrind -q";; |
| 55 |
*) echo "Unknown test number $1"; exit 1;; |
*) echo "Unknown test number $1"; exit 1;; |
| 56 |
esac |
esac |
| 57 |
shift |
shift |
| 58 |
done |
done |
| 59 |
|
|
| 60 |
if [ "@LINK_SIZE@" != "" -a "@LINK_SIZE@" != "-DLINK_SIZE=2" ] ; then |
if [ "$link_size" != "2" ] ; then |
| 61 |
if [ $do2 = yes ] ; then |
if [ $do2 = yes ] ; then |
| 62 |
echo "Can't run test 2 with an internal link size other than 2" |
echo "Can't run test 2 with an internal link size other than 2" |
| 63 |
exit 1 |
exit 1 |
| 72 |
fi |
fi |
| 73 |
fi |
fi |
| 74 |
|
|
| 75 |
if [ "@UTF8@" = "" ] ; then |
if [ $utf8 -eq 0 ] ; then |
| 76 |
if [ $do4 = yes ] ; then |
if [ $do4 = yes ] ; then |
| 77 |
echo "Can't run test 4 because UTF-8 support is not configured" |
echo "Can't run test 4 because UTF-8 support is not configured" |
| 78 |
exit 1 |
exit 1 |
| 95 |
fi |
fi |
| 96 |
fi |
fi |
| 97 |
|
|
| 98 |
if [ "@UCP@" = "" ] ; then |
if [ $ucp -eq 0 ] ; then |
| 99 |
if [ $do6 = yes ] ; then |
if [ $do6 = yes ] ; then |
| 100 |
echo "Can't run test 6 because Unicode property support is not configured" |
echo "Can't run test 6 because Unicode property support is not configured" |
| 101 |
exit 1 |
exit 1 |
| 106 |
fi |
fi |
| 107 |
fi |
fi |
| 108 |
|
|
| 109 |
|
# If no specific tests were requested, select all that are relevant. |
| 110 |
|
|
| 111 |
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 \ |
| 112 |
$do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \ |
$do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \ |
| 113 |
$do9 = no ] ; then |
$do9 = no ] ; then |
| 114 |
do1=yes |
do1=yes |
| 115 |
do2=yes |
do2=yes |
| 116 |
do3=yes |
do3=yes |
| 117 |
if [ "@UTF8@" != "" ] ; then do4=yes; fi |
if [ $utf8 -ne 0 ] ; then do4=yes; fi |
| 118 |
if [ "@UTF8@" != "" ] ; then do5=yes; fi |
if [ $utf8 -ne 0 ] ; then do5=yes; fi |
| 119 |
if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do6=yes; fi |
if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do6=yes; fi |
| 120 |
do7=yes |
do7=yes |
| 121 |
if [ "@UTF8@" != "" ] ; then do8=yes; fi |
if [ $utf8 -ne 0 ] ; then do8=yes; fi |
| 122 |
if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do9=yes; fi |
if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi |
| 123 |
fi |
fi |
| 124 |
|
|
| 125 |
# Show which release |
# Show which release |
| 126 |
|
|
| 127 |
|
echo "" |
| 128 |
|
echo PCRE C library tests |
| 129 |
./pcretest /dev/null |
./pcretest /dev/null |
| 130 |
|
|
| 131 |
# Primary test, Perl-compatible |
# Primary test, Perl-compatible |
| 132 |
|
|
| 133 |
if [ $do1 = yes ] ; then |
if [ $do1 = yes ] ; then |
| 134 |
echo "Test 1: main functionality (Perl compatible)" |
echo "Test 1: main functionality (Perl compatible)" |
| 135 |
./pcretest $testdata/testinput1 testtry |
$valgrind ./pcretest -q $testdata/testinput1 testtry |
| 136 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
| 137 |
$cf testtry $testdata/testoutput1 |
$cf testtry $testdata/testoutput1 |
| 138 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 139 |
else exit 1 |
else exit 1 |
| 140 |
fi |
fi |
| 141 |
echo "OK" |
echo "OK" |
|
echo " " |
|
| 142 |
fi |
fi |
| 143 |
|
|
| 144 |
# PCRE tests that are not Perl-compatible - API & error tests, mostly |
# PCRE tests that are not Perl-compatible - API & error tests, mostly |
| 145 |
|
|
| 146 |
if [ $do2 = yes ] ; then |
if [ $do2 = yes ] ; then |
| 147 |
if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then |
if [ "$link_size" = "2" ] ; then |
| 148 |
echo "Test 2: API and error handling (not Perl compatible)" |
echo "Test 2: API and error handling (not Perl compatible)" |
| 149 |
./pcretest -i $testdata/testinput2 testtry |
$valgrind ./pcretest -q $testdata/testinput2 testtry |
| 150 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
| 151 |
$cf testtry $testdata/testoutput2 |
$cf testtry $testdata/testoutput2 |
| 152 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 153 |
else exit 1 |
else exit 1 |
| 154 |
fi |
fi |
| 155 |
echo "OK" |
echo "OK" |
|
echo " " |
|
| 156 |
else |
else |
| 157 |
echo Test 2 skipped for link size other than 2 \(@LINK_SIZE@\) |
echo Test 2 skipped for link size other than 2 \($link_size\) |
| 158 |
echo " " |
echo " " |
| 159 |
fi |
fi |
| 160 |
fi |
fi |
| 161 |
|
|
| 165 |
locale -a | grep '^fr_FR$' >/dev/null |
locale -a | grep '^fr_FR$' >/dev/null |
| 166 |
if [ $? -eq 0 ] ; then |
if [ $? -eq 0 ] ; then |
| 167 |
echo "Test 3: locale-specific features (using 'fr_FR' locale)" |
echo "Test 3: locale-specific features (using 'fr_FR' locale)" |
| 168 |
./pcretest $testdata/testinput3 testtry |
$valgrind ./pcretest -q $testdata/testinput3 testtry |
| 169 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
| 170 |
$cf testtry $testdata/testoutput3 |
$cf testtry $testdata/testoutput3 |
| 171 |
if [ $? != 0 ] ; then |
if [ $? != 0 ] ; then |
| 176 |
else |
else |
| 177 |
echo "OK" |
echo "OK" |
| 178 |
fi |
fi |
|
echo " " |
|
| 179 |
else exit 1 |
else exit 1 |
| 180 |
fi |
fi |
| 181 |
else |
else |
| 189 |
|
|
| 190 |
if [ $do4 = yes ] ; then |
if [ $do4 = yes ] ; then |
| 191 |
echo "Test 4: UTF-8 support (Perl compatible)" |
echo "Test 4: UTF-8 support (Perl compatible)" |
| 192 |
./pcretest $testdata/testinput4 testtry |
$valgrind ./pcretest -q $testdata/testinput4 testtry |
| 193 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
| 194 |
$cf testtry $testdata/testoutput4 |
$cf testtry $testdata/testoutput4 |
| 195 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 196 |
else exit 1 |
else exit 1 |
| 197 |
fi |
fi |
| 198 |
echo "OK" |
echo "OK" |
|
echo " " |
|
| 199 |
fi |
fi |
| 200 |
|
|
| 201 |
if [ $do5 = yes ] ; then |
if [ $do5 = yes ] ; then |
| 202 |
if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then |
if [ "$link_size" = "2" ] ; then |
| 203 |
echo "Test 5: API and internals for UTF-8 support (not Perl compatible)" |
echo "Test 5: API and internals for UTF-8 support (not Perl compatible)" |
| 204 |
./pcretest $testdata/testinput5 testtry |
$valgrind ./pcretest -q $testdata/testinput5 testtry |
| 205 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
| 206 |
$cf testtry $testdata/testoutput5 |
$cf testtry $testdata/testoutput5 |
| 207 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 208 |
else exit 1 |
else exit 1 |
| 209 |
fi |
fi |
| 210 |
echo "OK" |
echo "OK" |
|
echo " " |
|
| 211 |
else |
else |
| 212 |
echo Test 5 skipped for link size other than 2 \(@LINK_SIZE@\) |
echo Test 5 skipped for link size other than 2 \($link_size\) |
| 213 |
echo " " |
echo " " |
| 214 |
fi |
fi |
| 215 |
fi |
fi |
| 216 |
|
|
| 217 |
if [ $do6 = yes ] ; then |
if [ $do6 = yes ] ; then |
| 218 |
if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then |
if [ "$link_size" = "2" ] ; then |
| 219 |
echo "Test 6: Unicode property support" |
echo "Test 6: Unicode property support" |
| 220 |
./pcretest $testdata/testinput6 testtry |
$valgrind ./pcretest -q $testdata/testinput6 testtry |
| 221 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
| 222 |
$cf testtry $testdata/testoutput6 |
$cf testtry $testdata/testoutput6 |
| 223 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 224 |
else exit 1 |
else exit 1 |
| 225 |
fi |
fi |
| 226 |
echo "OK" |
echo "OK" |
|
echo " " |
|
| 227 |
else |
else |
| 228 |
echo Test 6 skipped for link size other than 2 \(@LINK_SIZE@\) |
echo Test 6 skipped for link size other than 2 \($link_size\) |
| 229 |
echo " " |
echo " " |
| 230 |
fi |
fi |
| 231 |
fi |
fi |
| 232 |
|
|
| 234 |
|
|
| 235 |
if [ $do7 = yes ] ; then |
if [ $do7 = yes ] ; then |
| 236 |
echo "Test 7: DFA matching" |
echo "Test 7: DFA matching" |
| 237 |
./pcretest -dfa $testdata/testinput7 testtry |
$valgrind ./pcretest -q -dfa $testdata/testinput7 testtry |
| 238 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
| 239 |
$cf testtry $testdata/testoutput7 |
$cf testtry $testdata/testoutput7 |
| 240 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 241 |
else exit 1 |
else exit 1 |
| 242 |
fi |
fi |
| 243 |
echo "OK" |
echo "OK" |
|
echo " " |
|
| 244 |
fi |
fi |
| 245 |
|
|
| 246 |
if [ $do8 = yes ] ; then |
if [ $do8 = yes ] ; then |
| 247 |
echo "Test 8: DFA matching with UTF-8" |
echo "Test 8: DFA matching with UTF-8" |
| 248 |
./pcretest -dfa $testdata/testinput8 testtry |
$valgrind ./pcretest -q -dfa $testdata/testinput8 testtry |
| 249 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
| 250 |
$cf testtry $testdata/testoutput8 |
$cf testtry $testdata/testoutput8 |
| 251 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 252 |
else exit 1 |
else exit 1 |
| 253 |
fi |
fi |
| 254 |
echo "OK" |
echo "OK" |
|
echo " " |
|
| 255 |
fi |
fi |
| 256 |
|
|
| 257 |
if [ $do9 = yes ] ; then |
if [ $do9 = yes ] ; then |
| 258 |
echo "Test 9: DFA matching with Unicode properties" |
echo "Test 9: DFA matching with Unicode properties" |
| 259 |
./pcretest -dfa $testdata/testinput9 testtry |
$valgrind ./pcretest -q -dfa $testdata/testinput9 testtry |
| 260 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
| 261 |
$cf testtry $testdata/testoutput9 |
$cf testtry $testdata/testoutput9 |
| 262 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 263 |
else exit 1 |
else exit 1 |
| 264 |
fi |
fi |
| 265 |
echo "OK" |
echo "OK" |
|
echo " " |
|
| 266 |
fi |
fi |
| 267 |
|
|
| 268 |
# End |
# End |