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

Contents of /code/trunk/RunTest

Parent Directory Parent Directory | Revision Log Revision Log


Revision 137 - (hide annotations) (download)
Thu Mar 29 13:56:00 2007 UTC (7 years, 5 months ago) by ph10
File size: 6442 byte(s)
Daniel's patches.

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