1 |
#! /bin/sh
|
2 |
|
3 |
# This file is generated by configure from RunTest.in. Make any changes
|
4 |
# to that file.
|
5 |
|
6 |
# Run PCRE tests
|
7 |
|
8 |
cf=diff
|
9 |
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
|
17 |
|
18 |
do1=no
|
19 |
do2=no
|
20 |
do3=no
|
21 |
do4=no
|
22 |
do5=no
|
23 |
do6=no
|
24 |
do7=no
|
25 |
do8=no
|
26 |
do9=no
|
27 |
|
28 |
while [ $# -gt 0 ] ; do
|
29 |
case $1 in
|
30 |
1) do1=yes;;
|
31 |
2) do2=yes;;
|
32 |
3) do3=yes;;
|
33 |
4) do4=yes;;
|
34 |
5) do5=yes;;
|
35 |
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;;
|
41 |
esac
|
42 |
shift
|
43 |
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
|
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
|
66 |
echo "Can't run test 5 because UTF-8 support is not configured"
|
67 |
exit 1
|
68 |
fi
|
69 |
if [ $do6 = yes ] ; then
|
70 |
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
|
80 |
fi
|
81 |
fi
|
82 |
|
83 |
if [ "@UCP@" = "" ] ; then
|
84 |
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
|
98 |
do2=yes
|
99 |
do3=yes
|
100 |
if [ "@UTF8@" != "" ] ; then do4=yes; fi
|
101 |
if [ "@UTF8@" != "" ] ; then do5=yes; fi
|
102 |
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
|
107 |
|
108 |
# Show which release
|
109 |
|
110 |
./pcretest /dev/null
|
111 |
|
112 |
# Primary test, Perl-compatible
|
113 |
|
114 |
if [ $do1 = yes ] ; then
|
115 |
echo "Test 1: main functionality (Perl compatible)"
|
116 |
$valgrind ./pcretest -q $testdata/testinput1 testtry
|
117 |
if [ $? = 0 ] ; then
|
118 |
$cf testtry $testdata/testoutput1
|
119 |
if [ $? != 0 ] ; then exit 1; fi
|
120 |
else exit 1
|
121 |
fi
|
122 |
echo "OK"
|
123 |
echo " "
|
124 |
fi
|
125 |
|
126 |
# PCRE tests that are not Perl-compatible - API & error tests, mostly
|
127 |
|
128 |
if [ $do2 = yes ] ; then
|
129 |
if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then
|
130 |
echo "Test 2: API and error handling (not Perl compatible)"
|
131 |
$valgrind ./pcretest -q -i $testdata/testinput2 testtry
|
132 |
if [ $? = 0 ] ; then
|
133 |
$cf testtry $testdata/testoutput2
|
134 |
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
|
143 |
fi
|
144 |
|
145 |
# Locale-specific tests, provided the "fr_FR" locale is available
|
146 |
|
147 |
if [ $do3 = yes ] ; then
|
148 |
locale -a | grep '^fr_FR$' >/dev/null
|
149 |
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
|
178 |
$cf testtry $testdata/testoutput4
|
179 |
if [ $? != 0 ] ; then exit 1; fi
|
180 |
else exit 1
|
181 |
fi
|
182 |
echo "OK"
|
183 |
echo " "
|
184 |
fi
|
185 |
|
186 |
if [ $do5 = yes ] ; then
|
187 |
if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then
|
188 |
echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"
|
189 |
$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
|
202 |
|
203 |
if [ $do6 = yes ] ; then
|
204 |
if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then
|
205 |
echo "Test 6: Unicode property support"
|
206 |
$valgrind ./pcretest -q $testdata/testinput6 testtry
|
207 |
if [ $? = 0 ] ; then
|
208 |
$cf testtry $testdata/testoutput6
|
209 |
if [ $? != 0 ] ; then exit 1; fi
|
210 |
else exit 1
|
211 |
fi
|
212 |
echo "OK"
|
213 |
echo " "
|
214 |
else
|
215 |
echo Test 6 skipped for link size other than 2 \(@LINK_SIZE@\)
|
216 |
echo " "
|
217 |
fi
|
218 |
fi
|
219 |
|
220 |
# Tests for DFA matching support
|
221 |
|
222 |
if [ $do7 = yes ] ; then
|
223 |
echo "Test 7: DFA matching"
|
224 |
$valgrind ./pcretest -q -dfa $testdata/testinput7 testtry
|
225 |
if [ $? = 0 ] ; then
|
226 |
$cf testtry $testdata/testoutput7
|
227 |
if [ $? != 0 ] ; then exit 1; fi
|
228 |
else exit 1
|
229 |
fi
|
230 |
echo "OK"
|
231 |
echo " "
|
232 |
fi
|
233 |
|
234 |
if [ $do8 = yes ] ; then
|
235 |
echo "Test 8: DFA matching with UTF-8"
|
236 |
$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
|
250 |
$cf testtry $testdata/testoutput9
|
251 |
if [ $? != 0 ] ; then exit 1; fi
|
252 |
else exit 1
|
253 |
fi
|
254 |
echo "OK"
|
255 |
echo " "
|
256 |
fi
|
257 |
|
258 |
# End
|