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