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

Contents of /code/trunk/RunTest

Parent Directory Parent Directory | Revision Log Revision Log


Revision 654 - (hide annotations) (download)
Tue Aug 2 11:00:40 2011 UTC (3 years, 2 months ago) by ph10
File size: 11090 byte(s)
Documentation and general text tidies in preparation for test release.

1 nigel 49 #! /bin/sh
2    
3 ph10 612 # 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 nigel 49
13 nigel 87 valgrind=
14 ph10 339
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 ph10 137 testdata=testdata
23     if [ -n "$srcdir" -a -d "$srcdir" ] ; then
24     testdata="$srcdir/testdata"
25 nigel 81 fi
26 nigel 49
27 ph10 116 # Find which optional facilities are available
28 nigel 87
29 ph10 116 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 nigel 49
36 ph10 116 ./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     # Select which tests to run; for those that are explicitly requested, check
43     # that the necessary optional facilities are available.
44    
45 nigel 49 do1=no
46     do2=no
47     do3=no
48     do4=no
49     do5=no
50 nigel 75 do6=no
51 nigel 77 do7=no
52     do8=no
53     do9=no
54 ph10 164 do10=no
55 ph10 448 do11=no
56     do12=no
57 ph10 651 do13=no
58 nigel 49
59     while [ $# -gt 0 ] ; do
60     case $1 in
61     1) do1=yes;;
62     2) do2=yes;;
63     3) do3=yes;;
64     4) do4=yes;;
65 nigel 77 5) do5=yes;;
66     6) do6=yes;;
67     7) do7=yes;;
68     8) do8=yes;;
69     9) do9=yes;;
70 ph10 165 10) do10=yes;;
71 ph10 448 11) do11=yes;;
72 ph10 461 12) do12=yes;;
73 ph10 651 13) do12=yes;;
74 ph10 164 valgrind) valgrind="valgrind -q";;
75 nigel 49 *) echo "Unknown test number $1"; exit 1;;
76     esac
77     shift
78     done
79    
80 ph10 116 if [ $utf8 -eq 0 ] ; then
81 nigel 63 if [ $do4 = yes ] ; then
82 nigel 75 echo "Can't run test 4 because UTF-8 support is not configured"
83 nigel 63 exit 1
84 nigel 77 fi
85 nigel 49 if [ $do5 = yes ] ; then
86 nigel 75 echo "Can't run test 5 because UTF-8 support is not configured"
87 nigel 49 exit 1
88 nigel 77 fi
89     if [ $do8 = yes ] ; then
90     echo "Can't run test 8 because UTF-8 support is not configured"
91     exit 1
92     fi
93 ph10 651 if [ $do12 = yes ] ; then
94     echo "Can't run test 12 because UTF-8 support is not configured"
95     exit 1
96     fi
97 nigel 77 fi
98 nigel 49
99 ph10 116 if [ $ucp -eq 0 ] ; then
100 nigel 75 if [ $do6 = yes ] ; then
101     echo "Can't run test 6 because Unicode property support is not configured"
102     exit 1
103     fi
104 nigel 77 if [ $do9 = yes ] ; then
105     echo "Can't run test 9 because Unicode property support is not configured"
106     exit 1
107     fi
108 ph10 164 if [ $do10 = yes ] ; then
109     echo "Can't run test 10 because Unicode property support is not configured"
110     exit 1
111     fi
112 ph10 651 if [ $do13 = yes ] ; then
113 ph10 448 echo "Can't run test 12 because Unicode property support is not configured"
114     exit 1
115     fi
116 nigel 77 fi
117 nigel 75
118 ph10 164 if [ $link_size -ne 2 ] ; then
119     if [ $do10 = yes ] ; then
120     echo "Can't run test 10 because the link size ($link_size) is not 2"
121     exit 1
122     fi
123 ph10 165 fi
124 ph10 164
125 ph10 116 # If no specific tests were requested, select all that are relevant.
126    
127 nigel 75 if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \
128 nigel 77 $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
129 ph10 448 $do9 = no -a $do10 = no -a $do11 = no -a $do12 = no ] ; then
130 nigel 49 do1=yes
131 ph10 247 do2=yes
132 nigel 49 do3=yes
133 ph10 116 if [ $utf8 -ne 0 ] ; then do4=yes; fi
134 ph10 247 if [ $utf8 -ne 0 ] ; then do5=yes; fi
135 ph10 116 if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do6=yes; fi
136 ph10 247 do7=yes
137     if [ $utf8 -ne 0 ] ; then do8=yes; fi
138 ph10 116 if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi
139 ph10 173 if [ $link_size -eq 2 -a $ucp -ne 0 ] ; then do10=yes; fi
140 ph10 448 do11=yes
141 ph10 651 if [ $utf8 -ne 0 ] ; then do12=yes; fi
142     if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do13=yes; fi
143 nigel 49 fi
144    
145 nigel 73 # Show which release
146    
147 ph10 128 echo ""
148     echo PCRE C library tests
149 nigel 73 ./pcretest /dev/null
150    
151 ph10 559 # Primary test, compatible with all versions of Perl >= 5.8
152 nigel 49
153     if [ $do1 = yes ] ; then
154 ph10 559 echo "Test 1: main functionality (Compatible with Perl >= 5.8)"
155 ph10 654 for opt in "" "-s"; do
156 ph10 612 $valgrind ./pcretest -q $opt $testdata/testinput1 testtry
157     if [ $? = 0 ] ; then
158     $cf $testdata/testoutput1 testtry
159     if [ $? != 0 ] ; then exit 1; fi
160     else exit 1
161     fi
162     if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
163 ph10 654 done
164 nigel 49 fi
165    
166 ph10 449 # PCRE tests that are not Perl-compatible - API, errors, internals
167 nigel 49
168     if [ $do2 = yes ] ; then
169 ph10 449 echo "Test 2: API, errors, internals, and non-Perl stuff"
170 ph10 654 for opt in "" "-s"; do
171 ph10 612 $valgrind ./pcretest -q $opt $testdata/testinput2 testtry
172     if [ $? = 0 ] ; then
173     $cf $testdata/testoutput2 testtry
174     if [ $? != 0 ] ; then exit 1; fi
175     else
176     echo " "
177     echo "** Test 2 requires a lot of stack. If it has crashed with a"
178     echo "** segmentation fault, it may be that you do not have enough"
179     echo "** stack available by default. Please see the 'pcrestack' man"
180     echo "** page for a discussion of PCRE's stack usage."
181     echo " "
182     exit 1
183     fi
184     if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
185 ph10 654 done
186 nigel 49 fi
187    
188 ph10 157 # Locale-specific tests, provided that either the "fr_FR" or the "french"
189     # locale is available. The former is the Unix-like standard; the latter is
190     # for Windows.
191 nigel 49
192 nigel 63 if [ $do3 = yes ] ; then
193 nigel 73 locale -a | grep '^fr_FR$' >/dev/null
194 nigel 49 if [ $? -eq 0 ] ; then
195 ph10 157 locale=fr_FR
196     infile=$testdata/testinput3
197     outfile=$testdata/testoutput3
198     else
199     locale -a | grep '^french$' >/dev/null
200     if [ $? -eq 0 ] ; then
201     locale=french
202     sed 's/fr_FR/french/' $testdata/testinput3 >test3input
203     sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
204     infile=test3input
205 ph10 159 outfile=test3output
206 ph10 157 else
207 ph10 159 locale=
208 ph10 157 fi
209 ph10 159 fi
210 ph10 157
211     if [ "$locale" != "" ] ; then
212     echo "Test 3: locale-specific features (using '$locale' locale)"
213 ph10 654 for opt in "" "-s"; do
214 ph10 612 $valgrind ./pcretest -q $opt $infile testtry
215     if [ $? = 0 ] ; then
216     $cf $outfile testtry
217     if [ $? != 0 ] ; then
218     echo " "
219     echo "Locale test did not run entirely successfully."
220     echo "This usually means that there is a problem with the locale"
221     echo "settings rather than a bug in PCRE."
222 ph10 654 break;
223 ph10 612 else
224     if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
225     fi
226     else exit 1
227 nigel 77 fi
228 ph10 654 done
229 nigel 49 else
230 ph10 157 echo "Cannot test locale-specific features - neither the 'fr_FR' nor the"
231     echo "'french' locale exists, or the \"locale\" command is not available"
232     echo "to check for them."
233 nigel 77 echo " "
234 nigel 49 fi
235     fi
236    
237     # Additional tests for UTF8 support
238    
239 nigel 63 if [ $do4 = yes ] ; then
240 ph10 559 echo "Test 4: UTF-8 support (Compatible with Perl >= 5.8)"
241 ph10 654 for opt in "" "-s"; do
242 ph10 612 $valgrind ./pcretest -q $opt $testdata/testinput4 testtry
243     if [ $? = 0 ] ; then
244     $cf $testdata/testoutput4 testtry
245     if [ $? != 0 ] ; then exit 1; fi
246     else exit 1
247     fi
248     if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
249 ph10 654 done
250 nigel 49 fi
251    
252 nigel 63 if [ $do5 = yes ] ; then
253 ph10 426 echo "Test 5: API, internals, and non-Perl stuff for UTF-8 support"
254 ph10 654 for opt in "" "-s"; do
255 ph10 612 $valgrind ./pcretest -q $opt $testdata/testinput5 testtry
256     if [ $? = 0 ] ; then
257     $cf $testdata/testoutput5 testtry
258     if [ $? != 0 ] ; then exit 1; fi
259     else exit 1
260     fi
261     if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
262 ph10 654 done
263 nigel 49 fi
264    
265 nigel 75 if [ $do6 = yes ] ; then
266 ph10 559 echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)"
267 ph10 654 for opt in "" "-s"; do
268 ph10 612 $valgrind ./pcretest -q $opt $testdata/testinput6 testtry
269     if [ $? = 0 ] ; then
270     $cf $testdata/testoutput6 testtry
271     if [ $? != 0 ] ; then exit 1; fi
272     else exit 1
273     fi
274     if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
275 ph10 654 done
276 nigel 75 fi
277    
278 nigel 77 # Tests for DFA matching support
279    
280     if [ $do7 = yes ] ; then
281     echo "Test 7: DFA matching"
282 ph10 654 for opt in "" "-s"; do
283 ph10 612 $valgrind ./pcretest -q $opt -dfa $testdata/testinput7 testtry
284     if [ $? = 0 ] ; then
285     $cf $testdata/testoutput7 testtry
286     if [ $? != 0 ] ; then exit 1; fi
287     else exit 1
288     fi
289     if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
290 ph10 654 done
291 nigel 77 fi
292    
293     if [ $do8 = yes ] ; then
294     echo "Test 8: DFA matching with UTF-8"
295 ph10 654 for opt in "" "-s"; do
296 ph10 612 $valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry
297     if [ $? = 0 ] ; then
298     $cf $testdata/testoutput8 testtry
299     if [ $? != 0 ] ; then exit 1; fi
300     else exit 1
301     fi
302     if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
303 ph10 654 done
304 nigel 77 fi
305    
306     if [ $do9 = yes ] ; then
307     echo "Test 9: DFA matching with Unicode properties"
308 ph10 654 for opt in "" "-s"; do
309 ph10 612 $valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry
310     if [ $? = 0 ] ; then
311     $cf $testdata/testoutput9 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 ph10 654 done
317 nigel 77 fi
318    
319 ph10 164 # Test of internal offsets and code sizes. This test is run only when there
320     # is Unicode property support and the link size is 2. The actual tests are
321     # mostly the same as in some of the above, but in this test we inspect some
322     # offsets and sizes that require a known link size. This is a doublecheck for
323     # the maintainer, just in case something changes unexpectely.
324    
325     if [ $do10 = yes ] ; then
326     echo "Test 10: Internal offsets and code size tests"
327 ph10 654 for opt in "" "-s"; do
328 ph10 612 $valgrind ./pcretest -q $opt $testdata/testinput10 testtry
329     if [ $? = 0 ] ; then
330     $cf $testdata/testoutput10 testtry
331     if [ $? != 0 ] ; then exit 1; fi
332     else exit 1
333     fi
334     if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
335 ph10 654 done
336 ph10 164 fi
337    
338 ph10 651 # Test of Perl >= 5.10 features without UTF8 support
339 ph10 448
340     if [ $do11 = yes ] ; then
341 ph10 651 echo "Test 11: Features from Perl >= 5.10 without UTF8 support"
342 ph10 654 for opt in "" "-s"; do
343 ph10 612 $valgrind ./pcretest -q $opt $testdata/testinput11 testtry
344     if [ $? = 0 ] ; then
345     $cf $testdata/testoutput11 testtry
346     if [ $? != 0 ] ; then exit 1; fi
347     else exit 1
348     fi
349     if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
350 ph10 654 done
351 ph10 448 fi
352    
353 ph10 651 # Test of Perl >= 5.10 features with UTF8 support
354 ph10 448
355     if [ $do12 = yes ] ; then
356 ph10 651 echo "Test 12: Features from Perl >= 5.10 with UTF8 support"
357 ph10 654 for opt in "" "-s"; do
358 ph10 612 $valgrind ./pcretest -q $opt $testdata/testinput12 testtry
359     if [ $? = 0 ] ; then
360     $cf $testdata/testoutput12 testtry
361     if [ $? != 0 ] ; then exit 1; fi
362     else exit 1
363     fi
364     if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
365 ph10 654 done
366 ph10 448 fi
367    
368 ph10 651 # Test non-Perl-compatible Unicode property support
369    
370     if [ $do13 = yes ] ; then
371     echo "Test 13: API, internals, and non-Perl stuff for Unicode property support"
372 ph10 654 for opt in "" "-s"; do
373 ph10 651 $valgrind ./pcretest -q $opt $testdata/testinput13 testtry
374     if [ $? = 0 ] ; then
375     $cf $testdata/testoutput13 testtry
376     if [ $? != 0 ] ; then exit 1; fi
377     else exit 1
378     fi
379     if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
380 ph10 654 done
381 ph10 651 fi
382    
383 nigel 49 # End

Properties

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12