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 |
|
|
16 |
# Select which tests to run; if no selection, run all |
# Select which tests to run; if no selection, run all |
17 |
|
|
21 |
do4=no |
do4=no |
22 |
do5=no |
do5=no |
23 |
do6=no |
do6=no |
24 |
|
do7=no |
25 |
|
do8=no |
26 |
|
do9=no |
27 |
|
|
28 |
while [ $# -gt 0 ] ; do |
while [ $# -gt 0 ] ; do |
29 |
case $1 in |
case $1 in |
31 |
2) do2=yes;; |
2) do2=yes;; |
32 |
3) do3=yes;; |
3) do3=yes;; |
33 |
4) do4=yes;; |
4) do4=yes;; |
34 |
5) do5=yes;; |
5) do5=yes;; |
35 |
6) do6=yes;; |
6) do6=yes;; |
36 |
|
7) do7=yes;; |
37 |
|
8) do8=yes;; |
38 |
|
9) do9=yes;; |
39 |
|
valgrind) valgrind="valgrind -q";; |
40 |
*) echo "Unknown test number $1"; exit 1;; |
*) echo "Unknown test number $1"; exit 1;; |
41 |
esac |
esac |
42 |
shift |
shift |
43 |
done |
done |
44 |
|
|
45 |
|
if [ "@LINK_SIZE@" != "" -a "@LINK_SIZE@" != "-DLINK_SIZE=2" ] ; then |
46 |
|
if [ $do2 = yes ] ; then |
47 |
|
echo "Can't run test 2 with an internal link size other than 2" |
48 |
|
exit 1 |
49 |
|
fi |
50 |
|
if [ $do5 = yes ] ; then |
51 |
|
echo "Can't run test 5 with an internal link size other than 2" |
52 |
|
exit 1 |
53 |
|
fi |
54 |
|
if [ $do6 = yes ] ; then |
55 |
|
echo "Can't run test 6 with an internal link size other than 2" |
56 |
|
exit 1 |
57 |
|
fi |
58 |
|
fi |
59 |
|
|
60 |
if [ "@UTF8@" = "" ] ; then |
if [ "@UTF8@" = "" ] ; then |
61 |
|
if [ $do4 = yes ] ; then |
62 |
|
echo "Can't run test 4 because UTF-8 support is not configured" |
63 |
|
exit 1 |
64 |
|
fi |
65 |
if [ $do5 = yes ] ; then |
if [ $do5 = yes ] ; then |
66 |
echo "Can't run test 5 because UFT8 support is not configured" |
echo "Can't run test 5 because UTF-8 support is not configured" |
67 |
exit 1 |
exit 1 |
68 |
fi |
fi |
69 |
if [ $do6 = yes ] ; then |
if [ $do6 = yes ] ; then |
70 |
echo "Can't run test 6 because UFT8 support is not configured" |
echo "Can't run test 6 because UTF-8 support is not configured" |
71 |
|
exit 1 |
72 |
|
fi |
73 |
|
if [ $do8 = yes ] ; then |
74 |
|
echo "Can't run test 8 because UTF-8 support is not configured" |
75 |
|
exit 1 |
76 |
|
fi |
77 |
|
if [ $do9 = yes ] ; then |
78 |
|
echo "Can't run test 9 because UTF-8 support is not configured" |
79 |
exit 1 |
exit 1 |
80 |
fi |
fi |
81 |
fi |
fi |
82 |
|
|
83 |
if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a\ |
if [ "@UCP@" = "" ] ; then |
84 |
$do5 = no -a $do6 = no ] ; then |
if [ $do6 = yes ] ; then |
85 |
|
echo "Can't run test 6 because Unicode property support is not configured" |
86 |
|
exit 1 |
87 |
|
fi |
88 |
|
if [ $do9 = yes ] ; then |
89 |
|
echo "Can't run test 9 because Unicode property support is not configured" |
90 |
|
exit 1 |
91 |
|
fi |
92 |
|
fi |
93 |
|
|
94 |
|
if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \ |
95 |
|
$do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \ |
96 |
|
$do9 = no ] ; then |
97 |
do1=yes |
do1=yes |
98 |
do2=yes |
do2=yes |
99 |
do3=yes |
do3=yes |
100 |
do4=yes |
if [ "@UTF8@" != "" ] ; then do4=yes; fi |
101 |
if [ "@UTF8@" != "" ] ; then do5=yes; fi |
if [ "@UTF8@" != "" ] ; then do5=yes; fi |
102 |
if [ "@UTF8@" != "" ] ; then do6=yes; fi |
if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do6=yes; fi |
103 |
|
do7=yes |
104 |
|
if [ "@UTF8@" != "" ] ; then do8=yes; fi |
105 |
|
if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do9=yes; fi |
106 |
fi |
fi |
107 |
|
|
108 |
|
# Show which release |
109 |
|
|
110 |
|
./pcretest /dev/null |
111 |
|
|
112 |
# Primary test, Perl-compatible |
# Primary test, Perl-compatible |
113 |
|
|
114 |
if [ $do1 = yes ] ; then |
if [ $do1 = yes ] ; then |
115 |
echo "Testing main functionality (Perl compatible)" |
echo "Test 1: main functionality (Perl compatible)" |
116 |
./pcretest $testdata/testinput1 testtry |
$valgrind ./pcretest -q $testdata/testinput1 testtry |
117 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
118 |
$cf testtry $testdata/testoutput1 |
$cf testtry $testdata/testoutput1 |
119 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
120 |
else exit 1 |
else exit 1 |
121 |
fi |
fi |
122 |
|
echo "OK" |
123 |
|
echo " " |
124 |
fi |
fi |
125 |
|
|
126 |
# PCRE tests that are not Perl-compatible - API & error tests, mostly |
# PCRE tests that are not Perl-compatible - API & error tests, mostly |
127 |
|
|
128 |
if [ $do2 = yes ] ; then |
if [ $do2 = yes ] ; then |
129 |
echo "Testing API and error handling (not Perl compatible)" |
if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then |
130 |
./pcretest -i $testdata/testinput2 testtry |
echo "Test 2: API and error handling (not Perl compatible)" |
131 |
if [ $? = 0 ] ; then |
$valgrind ./pcretest -q $testdata/testinput2 testtry |
132 |
$cf testtry $testdata/testoutput2 |
if [ $? = 0 ] ; then |
133 |
if [ $? != 0 ] ; then exit 1; fi |
$cf testtry $testdata/testoutput2 |
134 |
else exit 1 |
if [ $? != 0 ] ; then exit 1; fi |
135 |
|
else exit 1 |
136 |
|
fi |
137 |
|
echo "OK" |
138 |
|
echo " " |
139 |
|
else |
140 |
|
echo Test 2 skipped for link size other than 2 \(@LINK_SIZE@\) |
141 |
|
echo " " |
142 |
fi |
fi |
143 |
fi |
fi |
144 |
|
|
145 |
# Additional Perl-compatible tests for Perl 5.005's new features |
# Locale-specific tests, provided the "fr_FR" locale is available |
146 |
|
|
147 |
if [ $do3 = yes ] ; then |
if [ $do3 = yes ] ; then |
148 |
echo "Testing Perl 5.005 features (Perl 5.005 compatible)" |
locale -a | grep '^fr_FR$' >/dev/null |
149 |
./pcretest $testdata/testinput3 testtry |
if [ $? -eq 0 ] ; then |
150 |
|
echo "Test 3: locale-specific features (using 'fr_FR' locale)" |
151 |
|
$valgrind ./pcretest -q $testdata/testinput3 testtry |
152 |
|
if [ $? = 0 ] ; then |
153 |
|
$cf testtry $testdata/testoutput3 |
154 |
|
if [ $? != 0 ] ; then |
155 |
|
echo " " |
156 |
|
echo "Locale test did not run entirely successfully." |
157 |
|
echo "This usually means that there is a problem with the locale" |
158 |
|
echo "settings rather than a bug in PCRE." |
159 |
|
else |
160 |
|
echo "OK" |
161 |
|
fi |
162 |
|
echo " " |
163 |
|
else exit 1 |
164 |
|
fi |
165 |
|
else |
166 |
|
echo "Cannot test locale-specific features - 'fr_FR' locale not found," |
167 |
|
echo "or the \"locale\" command is not available to check for it." |
168 |
|
echo " " |
169 |
|
fi |
170 |
|
fi |
171 |
|
|
172 |
|
# Additional tests for UTF8 support |
173 |
|
|
174 |
|
if [ $do4 = yes ] ; then |
175 |
|
echo "Test 4: UTF-8 support (Perl compatible)" |
176 |
|
$valgrind ./pcretest -q $testdata/testinput4 testtry |
177 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
178 |
$cf testtry $testdata/testoutput3 |
$cf testtry $testdata/testoutput4 |
179 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
180 |
else exit 1 |
else exit 1 |
181 |
fi |
fi |
182 |
|
echo "OK" |
183 |
|
echo " " |
184 |
fi |
fi |
185 |
|
|
186 |
if [ $do1 = yes -a $do2 = yes -a $do3 = yes ] ; then |
if [ $do5 = yes ] ; then |
187 |
echo " " |
if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then |
188 |
echo "The three main tests all ran OK" |
echo "Test 5: API and internals for UTF-8 support (not Perl compatible)" |
189 |
echo " " |
$valgrind ./pcretest -q $testdata/testinput5 testtry |
190 |
|
if [ $? = 0 ] ; then |
191 |
|
$cf testtry $testdata/testoutput5 |
192 |
|
if [ $? != 0 ] ; then exit 1; fi |
193 |
|
else exit 1 |
194 |
|
fi |
195 |
|
echo "OK" |
196 |
|
echo " " |
197 |
|
else |
198 |
|
echo Test 5 skipped for link size other than 2 \(@LINK_SIZE@\) |
199 |
|
echo " " |
200 |
|
fi |
201 |
fi |
fi |
202 |
|
|
203 |
# Locale-specific tests, provided the "fr" locale is available |
if [ $do6 = yes ] ; then |
204 |
|
if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then |
205 |
if [ $do4 = yes ] ; then |
echo "Test 6: Unicode property support" |
206 |
locale -a | grep '^fr$' >/dev/null |
$valgrind ./pcretest -q $testdata/testinput6 testtry |
|
if [ $? -eq 0 ] ; then |
|
|
echo "Testing locale-specific features (using 'fr' locale)" |
|
|
./pcretest $testdata/testinput4 testtry |
|
207 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
208 |
$cf testtry $testdata/testoutput4 |
$cf testtry $testdata/testoutput6 |
209 |
if [ $? != 0 ] ; then |
if [ $? != 0 ] ; then exit 1; fi |
|
echo " " |
|
|
echo "Locale test did not run entirely successfully." |
|
|
echo "This usually means that there is a problem with the locale" |
|
|
echo "settings rather than a bug in PCRE." |
|
|
else |
|
|
echo "Locale test ran OK" |
|
|
fi |
|
|
echo " " |
|
210 |
else exit 1 |
else exit 1 |
211 |
fi |
fi |
212 |
|
echo "OK" |
213 |
|
echo " " |
214 |
else |
else |
215 |
echo "Cannot test locale-specific features - 'fr' locale not found," |
echo Test 6 skipped for link size other than 2 \(@LINK_SIZE@\) |
|
echo "or the \"locale\" command is not available to check for it." |
|
216 |
echo " " |
echo " " |
217 |
fi |
fi |
218 |
fi |
fi |
219 |
|
|
220 |
# Additional tests for UTF8 support |
# Tests for DFA matching support |
221 |
|
|
222 |
if [ $do5 = yes ] ; then |
if [ $do7 = yes ] ; then |
223 |
echo "Testing experimental, incomplete UTF8 support (Perl compatible)" |
echo "Test 7: DFA matching" |
224 |
./pcretest $testdata/testinput5 testtry |
$valgrind ./pcretest -q -dfa $testdata/testinput7 testtry |
225 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
226 |
$cf testtry $testdata/testoutput5 |
$cf testtry $testdata/testoutput7 |
227 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
228 |
else exit 1 |
else exit 1 |
229 |
fi |
fi |
230 |
echo "UTF8 test ran OK" |
echo "OK" |
231 |
echo " " |
echo " " |
232 |
fi |
fi |
233 |
|
|
234 |
if [ $do6 = yes ] ; then |
if [ $do8 = yes ] ; then |
235 |
echo "Testing API and internals for UTF8 support (not Perl compatible)" |
echo "Test 8: DFA matching with UTF-8" |
236 |
./pcretest $testdata/testinput6 testtry |
$valgrind ./pcretest -q -dfa $testdata/testinput8 testtry |
237 |
|
if [ $? = 0 ] ; then |
238 |
|
$cf testtry $testdata/testoutput8 |
239 |
|
if [ $? != 0 ] ; then exit 1; fi |
240 |
|
else exit 1 |
241 |
|
fi |
242 |
|
echo "OK" |
243 |
|
echo " " |
244 |
|
fi |
245 |
|
|
246 |
|
if [ $do9 = yes ] ; then |
247 |
|
echo "Test 9: DFA matching with Unicode properties" |
248 |
|
$valgrind ./pcretest -q -dfa $testdata/testinput9 testtry |
249 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
250 |
$cf testtry $testdata/testoutput6 |
$cf testtry $testdata/testoutput9 |
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 "UTF8 internals test ran OK" |
echo "OK" |
255 |
echo " " |
echo " " |
256 |
fi |
fi |
257 |
|
|