/[pcre]/code/trunk/RunTest
ViewVC logotype

Contents of /code/trunk/RunTest

Parent Directory Parent Directory | Revision Log Revision Log


Revision 666 - (show annotations)
Mon Aug 22 14:56:43 2011 UTC (3 years, 10 months ago) by ph10
File size: 11976 byte(s)
Error occurred while calculating annotation data.
Commit changes for JIT support
1 #! /bin/sh
2
3 # Run the PCRE tests using the pcretest program. All tests are now run both
4 # with and without -s, to ensure that everything is tested with and without
5 # studying. However, there are some tests that produce different output after
6 # studying, typically when we are tracing the actual matching process (for
7 # example, using auto-callouts). In these few cases, the tests are duplicated
8 # in the files, one with /S to force studying always, and one with /SS to force
9 # *not* studying always. The use of -s doesn't then make any difference to
10 # their output. There is also one test which compiles invalid UTF-8 with the
11 # UTF-8 check turned off for which studying is disabled with /SS.
12
13 valgrind=
14
15 # Set up a suitable "diff" command for comparison. Some systems
16 # have a diff that lacks a -u option. Try to deal with this.
17
18 if diff -u /dev/null /dev/null; then cf="diff -u"; else cf="diff"; fi
19
20 # Find the test data
21
22 testdata=testdata
23 if [ -n "$srcdir" -a -d "$srcdir" ] ; then
24 testdata="$srcdir/testdata"
25 fi
26
27 # Find which optional facilities are available
28
29 case `./pcretest -C | ./pcregrep 'Internal link size'` in
30 *2) link_size=2;;
31 *3) link_size=3;;
32 *4) link_size=4;;
33 *) echo "Failed to find internal link size"; exit 1;;
34 esac
35
36 ./pcretest -C | ./pcregrep 'No UTF-8 support' >/dev/null
37 utf8=$?
38
39 ./pcretest -C | ./pcregrep 'No Unicode properties support' >/dev/null
40 ucp=$?
41
42 jitopt=
43 ./pcretest -C | ./pcregrep 'No Just-in-time compiler support' >/dev/null
44 jit=$?
45 if [ $jit -ne 0 ] ; then
46 jitopt=-s+
47 fi
48
49 # Select which tests to run; for those that are explicitly requested, check
50 # that the necessary optional facilities are available.
51
52 do1=no
53 do2=no
54 do3=no
55 do4=no
56 do5=no
57 do6=no
58 do7=no
59 do8=no
60 do9=no
61 do10=no
62 do11=no
63 do12=no
64 do13=no
65
66 while [ $# -gt 0 ] ; do
67 case $1 in
68 1) do1=yes;;
69 2) do2=yes;;
70 3) do3=yes;;
71 4) do4=yes;;
72 5) do5=yes;;
73 6) do6=yes;;
74 7) do7=yes;;
75 8) do8=yes;;
76 9) do9=yes;;
77 10) do10=yes;;
78 11) do11=yes;;
79 12) do12=yes;;
80 13) do13=yes;;
81 valgrind) valgrind="valgrind -q --smc-check=all";;
82 *) echo "Unknown test number $1"; exit 1;;
83 esac
84 shift
85 done
86
87 if [ $utf8 -eq 0 ] ; then
88 if [ $do4 = yes ] ; then
89 echo "Can't run test 4 because UTF-8 support is not configured"
90 exit 1
91 fi
92 if [ $do5 = yes ] ; then
93 echo "Can't run test 5 because UTF-8 support is not configured"
94 exit 1
95 fi
96 if [ $do8 = yes ] ; then
97 echo "Can't run test 8 because UTF-8 support is not configured"
98 exit 1
99 fi
100 if [ $do12 = yes ] ; then
101 echo "Can't run test 12 because UTF-8 support is not configured"
102 exit 1
103 fi
104 fi
105
106 if [ $ucp -eq 0 ] ; then
107 if [ $do6 = yes ] ; then
108 echo "Can't run test 6 because Unicode property support is not configured"
109 exit 1
110 fi
111 if [ $do9 = yes ] ; then
112 echo "Can't run test 9 because Unicode property support is not configured"
113 exit 1
114 fi
115 if [ $do10 = yes ] ; then
116 echo "Can't run test 10 because Unicode property support is not configured"
117 exit 1
118 fi
119 if [ $do13 = yes ] ; then
120 echo "Can't run test 12 because Unicode property support is not configured"
121 exit 1
122 fi
123 fi
124
125 if [ $link_size -ne 2 ] ; then
126 if [ $do10 = yes ] ; then
127 echo "Can't run test 10 because the link size ($link_size) is not 2"
128 exit 1
129 fi
130 fi
131
132 # If no specific tests were requested, select all that are relevant.
133
134 if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \
135 $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
136 $do9 = no -a $do10 = no -a $do11 = no -a $do12 = no -a \
137 $do13 = no ] ; then
138 do1=yes
139 do2=yes
140 do3=yes
141 if [ $utf8 -ne 0 ] ; then do4=yes; fi
142 if [ $utf8 -ne 0 ] ; then do5=yes; fi
143 if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do6=yes; fi
144 do7=yes
145 if [ $utf8 -ne 0 ] ; then do8=yes; fi
146 if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi
147 if [ $link_size -eq 2 -a $ucp -ne 0 ] ; then do10=yes; fi
148 do11=yes
149 if [ $utf8 -ne 0 ] ; then do12=yes; fi
150 if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do13=yes; fi
151 fi
152
153 # Show which release
154
155 echo ""
156 echo PCRE C library tests
157 ./pcretest /dev/null
158
159 # Primary test, compatible with JIT and all versions of Perl >= 5.8
160
161 if [ $do1 = yes ] ; then
162 echo "Test 1: main functionality (Compatible with Perl >= 5.8)"
163 for opt in "" "-s" $jitopt; do
164 $valgrind ./pcretest -q $opt $testdata/testinput1 testtry
165 if [ $? = 0 ] ; then
166 $cf $testdata/testoutput1 testtry
167 if [ $? != 0 ] ; then exit 1; fi
168 else exit 1
169 fi
170 if [ "$opt" = "-s" ] ; then echo "OK with study"
171 elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
172 else echo "OK"
173 fi
174 done
175 fi
176
177 # PCRE tests that are not JIT or Perl-compatible: API, errors, internals
178
179 if [ $do2 = yes ] ; then
180 echo "Test 2: API, errors, internals, and non-Perl stuff"
181 for opt in "" "-s" $jitopt; do
182 $valgrind ./pcretest -q $opt $testdata/testinput2 testtry
183 if [ $? = 0 ] ; then
184 $cf $testdata/testoutput2 testtry
185 if [ $? != 0 ] ; then exit 1; fi
186 else
187 echo " "
188 echo "** Test 2 requires a lot of stack. If it has crashed with a"
189 echo "** segmentation fault, it may be that you do not have enough"
190 echo "** stack available by default. Please see the 'pcrestack' man"
191 echo "** page for a discussion of PCRE's stack usage."
192 echo " "
193 exit 1
194 fi
195 if [ "$opt" = "-s" ] ; then echo "OK with study"
196 elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
197 else echo "OK"
198 fi
199 done
200 fi
201
202 # Locale-specific tests, provided that either the "fr_FR" or the "french"
203 # locale is available. The former is the Unix-like standard; the latter is
204 # for Windows.
205
206 if [ $do3 = yes ] ; then
207 locale -a | grep '^fr_FR$' >/dev/null
208 if [ $? -eq 0 ] ; then
209 locale=fr_FR
210 infile=$testdata/testinput3
211 outfile=$testdata/testoutput3
212 else
213 locale -a | grep '^french$' >/dev/null
214 if [ $? -eq 0 ] ; then
215 locale=french
216 sed 's/fr_FR/french/' $testdata/testinput3 >test3input
217 sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
218 infile=test3input
219 outfile=test3output
220 else
221 locale=
222 fi
223 fi
224
225 if [ "$locale" != "" ] ; then
226 echo "Test 3: locale-specific features (using '$locale' locale)"
227 for opt in "" "-s" $jitopt; do
228 $valgrind ./pcretest -q $opt $infile testtry
229 if [ $? = 0 ] ; then
230 $cf $outfile testtry
231 if [ $? != 0 ] ; then
232 echo " "
233 echo "Locale test did not run entirely successfully."
234 echo "This usually means that there is a problem with the locale"
235 echo "settings rather than a bug in PCRE."
236 break;
237 else
238 if [ "$opt" = "-s" ] ; then echo "OK with study"
239 elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
240 else echo "OK"
241 fi
242 fi
243 else exit 1
244 fi
245 done
246 else
247 echo "Cannot test locale-specific features - neither the 'fr_FR' nor the"
248 echo "'french' locale exists, or the \"locale\" command is not available"
249 echo "to check for them."
250 echo " "
251 fi
252 fi
253
254 # Additional tests for UTF8 support
255
256 if [ $do4 = yes ] ; then
257 echo "Test 4: UTF-8 support (Compatible with Perl >= 5.8)"
258 for opt in "" "-s" $jitopt; do
259 $valgrind ./pcretest -q $opt $testdata/testinput4 testtry
260 if [ $? = 0 ] ; then
261 $cf $testdata/testoutput4 testtry
262 if [ $? != 0 ] ; then exit 1; fi
263 else exit 1
264 fi
265 if [ "$opt" = "-s" ] ; then echo "OK with study"
266 elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
267 else echo "OK"
268 fi
269 done
270 fi
271
272 if [ $do5 = yes ] ; then
273 echo "Test 5: API, internals, and non-Perl stuff for UTF-8 support"
274 for opt in "" "-s" $jitopt; do
275 $valgrind ./pcretest -q $opt $testdata/testinput5 testtry
276 if [ $? = 0 ] ; then
277 $cf $testdata/testoutput5 testtry
278 if [ $? != 0 ] ; then exit 1; fi
279 else exit 1
280 fi
281 if [ "$opt" = "-s" ] ; then echo "OK with study"
282 elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
283 else echo "OK"
284 fi
285 done
286 fi
287
288 if [ $do6 = yes ] ; then
289 echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)"
290 for opt in "" "-s" $jitopt; do
291 $valgrind ./pcretest -q $opt $testdata/testinput6 testtry
292 if [ $? = 0 ] ; then
293 $cf $testdata/testoutput6 testtry
294 if [ $? != 0 ] ; then exit 1; fi
295 else exit 1
296 fi
297 if [ "$opt" = "-s" ] ; then echo "OK with study"
298 elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
299 else echo "OK"
300 fi
301 done
302 fi
303
304 # Tests for DFA matching support
305
306 if [ $do7 = yes ] ; then
307 echo "Test 7: DFA matching"
308 for opt in "" "-s"; do
309 $valgrind ./pcretest -q $opt -dfa $testdata/testinput7 testtry
310 if [ $? = 0 ] ; then
311 $cf $testdata/testoutput7 testtry
312 if [ $? != 0 ] ; then exit 1; fi
313 else exit 1
314 fi
315 if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
316 done
317 fi
318
319 if [ $do8 = yes ] ; then
320 echo "Test 8: DFA matching with UTF-8"
321 for opt in "" "-s"; do
322 $valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry
323 if [ $? = 0 ] ; then
324 $cf $testdata/testoutput8 testtry
325 if [ $? != 0 ] ; then exit 1; fi
326 else exit 1
327 fi
328 if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
329 done
330 fi
331
332 if [ $do9 = yes ] ; then
333 echo "Test 9: DFA matching with Unicode properties"
334 for opt in "" "-s"; do
335 $valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry
336 if [ $? = 0 ] ; then
337 $cf $testdata/testoutput9 testtry
338 if [ $? != 0 ] ; then exit 1; fi
339 else exit 1
340 fi
341 if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
342 done
343 fi
344
345 # Test of internal offsets and code sizes. This test is run only when there
346 # is Unicode property support and the link size is 2. The actual tests are
347 # mostly the same as in some of the above, but in this test we inspect some
348 # offsets and sizes that require a known link size. This is a doublecheck for
349 # the maintainer, just in case something changes unexpectely.
350
351 if [ $do10 = yes ] ; then
352 echo "Test 10: Internal offsets and code size tests"
353 for opt in "" "-s"; do
354 $valgrind ./pcretest -q $opt $testdata/testinput10 testtry
355 if [ $? = 0 ] ; then
356 $cf $testdata/testoutput10 testtry
357 if [ $? != 0 ] ; then exit 1; fi
358 else exit 1
359 fi
360 if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
361 done
362 fi
363
364 # Test of Perl >= 5.10 features without UTF8 support
365
366 if [ $do11 = yes ] ; then
367 echo "Test 11: Features from Perl >= 5.10 without UTF8 support"
368 for opt in "" "-s" $jitopt; do
369 $valgrind ./pcretest -q $opt $testdata/testinput11 testtry
370 if [ $? = 0 ] ; then
371 $cf $testdata/testoutput11 testtry
372 if [ $? != 0 ] ; then exit 1; fi
373 else exit 1
374 fi
375 if [ "$opt" = "-s" ] ; then echo "OK with study"
376 elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
377 else echo "OK"
378 fi
379 done
380 fi
381
382 # Test of Perl >= 5.10 features with UTF8 support
383
384 if [ $do12 = yes ] ; then
385 echo "Test 12: Features from Perl >= 5.10 with UTF8 support"
386 for opt in "" "-s" $jitopt; do
387 $valgrind ./pcretest -q $opt $testdata/testinput12 testtry
388 if [ $? = 0 ] ; then
389 $cf $testdata/testoutput12 testtry
390 if [ $? != 0 ] ; then exit 1; fi
391 else exit 1
392 fi
393 if [ "$opt" = "-s" ] ; then echo "OK with study"
394 elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
395 else echo "OK"
396 fi
397 done
398 fi
399
400 # Test non-Perl-compatible Unicode property support
401
402 if [ $do13 = yes ] ; then
403 echo "Test 13: API, internals, and non-Perl stuff for Unicode property support"
404 for opt in "" "-s" $jitopt; do
405 $valgrind ./pcretest -q $opt $testdata/testinput13 testtry
406 if [ $? = 0 ] ; then
407 $cf $testdata/testoutput13 testtry
408 if [ $? != 0 ] ; then exit 1; fi
409 else exit 1
410 fi
411 if [ "$opt" = "-s" ] ; then echo "OK with study"
412 elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
413 else echo "OK"
414 fi
415 done
416 fi
417
418 # End

Properties

Name Value
svn:executable *
svn:keywords "Author Date Id Revision Url"

  ViewVC Help
Powered by ViewVC 1.1.5