/[pcre]/code/trunk/maint/ManyConfigTests
ViewVC logotype

Contents of /code/trunk/maint/ManyConfigTests

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1459 - (hide annotations) (download)
Tue Mar 4 10:45:15 2014 UTC (9 months, 2 weeks ago) by ph10
File size: 9263 byte(s)
Preparations for next release.

1 ph10 129 #! /bin/sh
2    
3     # This is a script for the use of PCRE maintainers. It configures and rebuilds
4     # PCRE with a variety of configuration options, and in each case runs the tests
5     # to ensure that all goes well. Every possible combination would take far too
6 ph10 139 # long, so we use a representative sample. This script should be run in the
7     # PCRE source directory.
8 ph10 129
9     # Some of the tests have to be skipped when PCRE is built with non-Unix newline
10     # recognition. I am planning to reduce this as much as possible in due course.
11    
12 ph10 139
13 ph10 129 # This is in case the caller has set aliases (as I do - PH)
14    
15     unset cp ls mv rm
16    
17     # Use -v to make the output more verbose
18    
19     verbose=0
20     if [ "$1" = "-v" ] ; then verbose=1; fi
21    
22 ph10 139 # This is a temporary directory for testing out-of-line builds
23 ph10 129
24 ph10 139 tmp=/tmp/pcretesting
25    
26 ph10 1417 # Don't bother with compiler optimization for most tests; it just slows down
27     # compilation a lot (and running the tests themselves is quick). However, a
28     # few specific tests turn optimization on, because it can provoke some compiler
29     # warnings.
30 ph10 139
31 ph10 1317 CFLAGS="-g -O0"
32 ph10 1410 CXXFLAGS="$CFLAGS"
33 ph10 1417 ISGCC="no"
34 ph10 1317
35 ph10 1410 # If the compiler is gcc, add a lot of warning switches.
36 ph10 1317
37 ph10 1410 cc --version >zzz 2>/dev/null
38     if [ $? -eq 0 ] && grep GCC zzz >/dev/null; then
39 ph10 1417 ISGCC="yes"
40 ph10 1410 CFLAGS="$CFLAGS -Wall"
41     CFLAGS="$CFLAGS -Wno-overlength-strings"
42 ph10 1450 CFLAGS="$CFLAGS -Wpointer-arith"
43 ph10 1410 CFLAGS="$CFLAGS -Wwrite-strings"
44     CFLAGS="$CFLAGS -Wundef -Wshadow"
45     CFLAGS="$CFLAGS -Wextra -Wformat"
46     CFLAGS="$CFLAGS -Wbad-function-cast"
47     CFLAGS="$CFLAGS -Wmissing-declarations"
48     CFLAGS="$CFLAGS -Wnested-externs"
49     CFLAGS="$CFLAGS -pedantic"
50     CFLAGS="$CFLAGS -Wuninitialized"
51     CFLAGS="$CFLAGS -Wmissing-prototypes"
52     CFLAGS="$CFLAGS -Wstrict-prototypes"
53 ph10 1450 fi
54 ph10 1410
55    
56 ph10 139 # This function runs a single test with the set of configuration options that
57     # are in $opts. The source directory must be set in srcdir.
58    
59     function runtest()
60     {
61 ph10 129 rm -f *_unittest
62 ph10 1450 testcount=`expr $testcount + 1`
63 ph10 129
64     if [ "$opts" = "" ] ; then
65 ph10 1317 echo "[$testcount/$testtotal] Configuring with: default settings"
66 ph10 129 else
67 ph10 1317 echo "[$testcount/$testtotal] Configuring with:"
68 ph10 898 echo " $opts"
69 ph10 129 fi
70    
71 ph10 1410 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
72 ph10 1317 $srcdir/configure $opts >/dev/null 2>teststderr
73 ph10 1450
74 ph10 129 if [ $? -ne 0 ]; then
75     echo " "
76     echo "**** Error while configuring ****"
77     cat teststderr
78     exit 1
79     fi
80    
81 ph10 139 echo "Making"
82 ph10 1459 make -j >/dev/null 2>teststderr
83 ph10 1410 if [ $? -ne 0 -o -s teststderr ]; then
84 ph10 129 echo " "
85 ph10 1410 echo "**** Errors or warnings while making ****"
86 ph10 1450 echo " "
87 ph10 129 cat teststderr
88     exit 1
89     fi
90    
91     if [ $verbose -eq 1 ]; then
92     ./pcretest -C
93     fi
94    
95 ph10 838 nl=`./pcretest -C newline`
96     ./pcretest -C jit >/dev/null
97     jit=$?
98     ./pcretest -C utf >/dev/null
99     utf=$?
100 ph10 129
101     if [ "$nl" = "LF" -o "$nl" = "ANY" ]; then
102 ph10 731 echo "Running C library tests $withvalgrind"
103     $srcdir/RunTest $valgrind >teststdout
104 ph10 129 if [ $? -ne 0 ]; then
105     echo " "
106     echo "**** Test failed ****"
107     cat teststdout
108     exit 1
109     fi
110     else
111 ph10 139 echo "Skipping C library tests: newline is $nl"
112 ph10 129 fi
113    
114     if [ "$nl" = "LF" ]; then
115 ph10 731 echo "Running pcregrep tests $withvalgrind"
116     $srcdir/RunGrepTest $valgrind >teststdout 2>teststderr
117 ph10 129 if [ $? -ne 0 ]; then
118     echo " "
119     echo "**** Test failed ****"
120     cat teststderr
121     cat teststdout
122     exit 1
123     fi
124     else
125 ph10 139 echo "Skipping pcregrep tests: newline is $nl"
126 ph10 129 fi
127    
128 ph10 838 if [ "$jit" -gt 0 -a $utf -gt 0 ]; then
129 ph10 731 echo "Running JIT regression tests $withvalgrind"
130     $cvalgrind $srcdir/pcre_jit_test >teststdout 2>teststderr
131 ph10 690 if [ $? -ne 0 ]; then
132     echo " "
133     echo "**** Test failed ****"
134     cat teststderr
135     cat teststdout
136     exit 1
137     fi
138     else
139 ph10 838 echo "Skipping JIT regression tests: JIT or UTF not enabled"
140 ph10 690 fi
141    
142 ph10 129 if [ "$nl" = "LF" -o "$nl" = "ANY" ]; then
143     if [ -f pcrecpp_unittest ] ; then
144     for utest in pcrecpp_unittest \
145     pcre_scanner_unittest \
146     pcre_stringpiece_unittest
147     do
148 ph10 731 echo "Running $utest $withvalgrind"
149     $cvalgrind $utest >teststdout
150 ph10 129 if [ $? -ne 0 ]; then
151     echo " "
152     echo "**** Test failed ****"
153     cat teststdout
154     exit 1
155     fi
156     done
157 ph10 139 else
158 ph10 244 echo "Skipping C++ tests: pcrecpp_unittest does not exist"
159 ph10 129 fi
160     else
161 ph10 139 echo "Skipping C++ tests: newline is $nl"
162 ph10 129 fi
163 ph10 139 }
164 ph10 129
165 ph10 139
166 ph10 1417 # Update the total count whenever a new test is added; it is used to show
167     # progess as each test is run.
168    
169 ph10 1459 testtotal=43
170 ph10 1417 testcount=0
171    
172 ph10 139 # This set of tests builds PCRE and runs the tests with a variety of configure
173 ph10 1417 # options, in the current (source) directory. The empty configuration builds
174     # with all the default settings. As well as testing that these options work, we
175     # use --disable-shared or --disable-static after the default test (which builds
176     # both) to save a bit of time by building only one version of the library for
177     # the subsequent tests.
178 ph10 139
179 ph10 836 valgrind=
180     cvalgrind=
181     withvalgrind=
182 ph10 1417 srcdir=.
183     export srcdir
184 ph10 836
185 ph10 1417 # If gcc is in use, run a maximally configured test with -O2, because that can
186     # throw up warnings that are not detected with -O0.
187 ph10 1317
188 ph10 1417 if [ "$ISGCC" = "yes" ]; then
189     echo "Maximally configured test with -O2"
190     SAVECLFAGS="$CFLAGS"
191     CFLAGS="$CFLAGS -O2"
192 ph10 1450 opts="--disable-shared --enable-unicode-properties --enable-jit --enable-pcre16 --enable-pcre32"
193 ph10 1417 runtest
194 ph10 1450 CFLAGS="$SAVECFLAGS"
195 ph10 1417 fi
196 ph10 1317
197 ph10 1417 echo "General tests in the current directory"
198 ph10 139 for opts in \
199     "" \
200     "--enable-utf8 --disable-static" \
201 ph10 690 "--disable-stack-for-recursion --disable-shared" \
202     "--enable-utf8 --disable-stack-for-recursion --disable-shared" \
203 ph10 139 "--enable-unicode-properties --disable-shared" \
204     "--enable-unicode-properties --disable-stack-for-recursion --disable-shared" \
205     "--enable-unicode-properties --disable-cpp --with-link-size=3 --disable-shared" \
206     "--enable-rebuild-chartables --disable-shared" \
207     "--enable-newline-is-any --disable-shared" \
208     "--enable-newline-is-cr --disable-shared" \
209     "--enable-newline-is-crlf --disable-shared" \
210 ph10 231 "--enable-newline-is-anycrlf --enable-bsr-anycrlf --disable-shared" \
211 ph10 667 "--enable-utf8 --enable-newline-is-any --enable-unicode-properties --disable-stack-for-recursion --disable-static --disable-cpp" \
212 ph10 690 "--enable-jit --disable-shared" \
213     "--enable-jit --enable-unicode-properties --disable-shared" \
214 ph10 836 "--enable-jit --enable-unicode-properties --with-link-size=3 --disable-shared" \
215     "--enable-pcre16" \
216     "--enable-pcre16 --enable-jit --enable-utf --disable-shared" \
217     "--enable-pcre16 --enable-jit --enable-unicode-properties --disable-shared" \
218     "--enable-pcre16 --enable-jit --disable-pcre8 --disable-shared" \
219     "--enable-pcre16 --enable-jit --disable-pcre8 --enable-utf --disable-shared" \
220     "--enable-pcre16 --disable-stack-for-recursion --disable-shared" \
221 ph10 838 "--enable-pcre16 --enable-unicode-properties --disable-stack-for-recursion --disable-shared" \
222     "--enable-pcre16 --enable-jit --enable-unicode-properties --with-link-size=3 --disable-shared" \
223 ph10 1220 "--enable-pcre16 --enable-jit --enable-unicode-properties --with-link-size=4 --disable-shared" \
224 chpe 1055 "--enable-pcre32" \
225     "--enable-pcre32 --enable-jit --enable-utf --disable-shared" \
226     "--enable-pcre32 --enable-jit --enable-unicode-properties --disable-shared" \
227     "--enable-pcre32 --enable-jit --disable-pcre8 --disable-shared" \
228     "--enable-pcre32 --enable-jit --disable-pcre8 --enable-utf --disable-shared" \
229     "--enable-pcre32 --disable-stack-for-recursion --disable-shared" \
230     "--enable-pcre32 --enable-unicode-properties --disable-stack-for-recursion --disable-shared" \
231 ph10 1168 "--enable-pcre32 --enable-jit --enable-unicode-properties --with-link-size=4 --disable-shared" \
232     "--enable-pcre32 --enable-pcre16 --disable-shared" \
233 ph10 1450 "--enable-pcre32 --enable-pcre16 --disable-pcre8 --disable-shared" \
234     "--enable-pcre32 --enable-pcre16 --disable-pcre8 --enable-jit --enable-unicode-properties --enable-newline-is-anycrlf --enable-bsr-anycrlf --disable-shared"
235 ph10 139 do
236     runtest
237 ph10 129 done
238    
239 ph10 731 # Now re-run some of the tests under valgrind.
240 ph10 139
241 ph10 731 echo "Tests in the current directory using valgrind"
242     valgrind=valgrind
243     cvalgrind="valgrind -q --smc-check=all"
244     withvalgrind="with valgrind"
245    
246     for opts in \
247     "--enable-unicode-properties --disable-stack-for-recursion --disable-shared" \
248     "--enable-unicode-properties --with-link-size=3 --disable-shared" \
249 ph10 836 "--enable-jit --enable-unicode-properties --disable-shared" \
250 chpe 1055 "--enable-pcre16 --enable-pcre32 --enable-jit --enable-unicode-properties " \
251     "--disable-shared"
252 ph10 731 do
253 ph10 1169 opts="--enable-valgrind $opts"
254 ph10 731 runtest
255     done
256    
257 ph10 836 valgrind=
258     cvalgrind=
259     withvalgrind=
260    
261 ph10 139 # Clean up the distribution and then do at least one build and test in a
262     # directory other than the source directory. It doesn't work unless the
263 ph10 836 # source directory is cleaned up first.
264 ph10 139
265     if [ -f Makefile ]; then
266     echo "Running 'make distclean'"
267     make distclean >/dev/null 2>&1
268     if [ $? -ne 0 ]; then
269     echo "** 'make distclean' failed"
270     exit 1
271 ph10 244 fi
272     fi
273 ph10 139
274     echo "Tests in the $tmp directory"
275     srcdir=`pwd`
276     export srcdir
277    
278     if [ ! -e $tmp ]; then
279     mkdir $tmp
280     fi
281    
282     if [ ! -d $tmp ]; then
283     echo "** Failed to create $tmp or it is not a directory"
284     exit 1
285     fi
286    
287     cd $tmp
288     if [ $? -ne 0 ]; then
289     echo "** Failed to cd to $tmp"
290     exit 1
291 ph10 244 fi
292 ph10 139
293     for opts in \
294     "--enable-unicode-properties --disable-shared"
295     do
296     runtest
297     done
298    
299     echo "Removing $tmp"
300    
301     rm -rf $tmp
302    
303     echo "All done"
304    
305 ph10 129 # End

Properties

Name Value
svn:executable *

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12