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

Contents of /code/trunk/RunTest

Parent Directory Parent Directory | Revision Log Revision Log


Revision 161 - (hide annotations) (download)
Thu May 3 10:28:07 2007 UTC (7 years, 3 months ago) by ph10
File size: 6517 byte(s)
Use the pcretest "Z" option so all tests can be run with all link sizes.

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