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

Contents of /code/trunk/RunTest

Parent Directory Parent Directory | Revision Log Revision Log


Revision 173 - (hide annotations) (download)
Tue Jun 5 11:17:10 2007 UTC (6 years, 10 months ago) by ph10
File size: 6883 byte(s)
Update to next RC number; fix bug in test script.

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