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

Contents of /code/trunk/RunTest

Parent Directory Parent Directory | Revision Log Revision Log


Revision 159 - (hide annotations) (download)
Wed May 2 10:27:18 2007 UTC (6 years, 11 months ago) by ph10
File size: 6888 byte(s)
Add code to configure.ac to remove -g from default CFLAGS and CXXFLAGS.

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