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

Contents of /code/trunk/maint/ManyConfigTests

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1459 - (show annotations)
Tue Mar 4 10:45:15 2014 UTC (16 months ago) by ph10
File size: 9263 byte(s)
Error occurred while calculating annotation data.
Preparations for next release.
1 #! /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 # long, so we use a representative sample. This script should be run in the
7 # PCRE source directory.
8
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
13 # 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 # This is a temporary directory for testing out-of-line builds
23
24 tmp=/tmp/pcretesting
25
26 # 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
31 CFLAGS="-g -O0"
32 CXXFLAGS="$CFLAGS"
33 ISGCC="no"
34
35 # If the compiler is gcc, add a lot of warning switches.
36
37 cc --version >zzz 2>/dev/null
38 if [ $? -eq 0 ] && grep GCC zzz >/dev/null; then
39 ISGCC="yes"
40 CFLAGS="$CFLAGS -Wall"
41 CFLAGS="$CFLAGS -Wno-overlength-strings"
42 CFLAGS="$CFLAGS -Wpointer-arith"
43 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 fi
54
55
56 # 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 rm -f *_unittest
62 testcount=`expr $testcount + 1`
63
64 if [ "$opts" = "" ] ; then
65 echo "[$testcount/$testtotal] Configuring with: default settings"
66 else
67 echo "[$testcount/$testtotal] Configuring with:"
68 echo " $opts"
69 fi
70
71 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
72 $srcdir/configure $opts >/dev/null 2>teststderr
73
74 if [ $? -ne 0 ]; then
75 echo " "
76 echo "**** Error while configuring ****"
77 cat teststderr
78 exit 1
79 fi
80
81 echo "Making"
82 make -j >/dev/null 2>teststderr
83 if [ $? -ne 0 -o -s teststderr ]; then
84 echo " "
85 echo "**** Errors or warnings while making ****"
86 echo " "
87 cat teststderr
88 exit 1
89 fi
90
91 if [ $verbose -eq 1 ]; then
92 ./pcretest -C
93 fi
94
95 nl=`./pcretest -C newline`
96 ./pcretest -C jit >/dev/null
97 jit=$?
98 ./pcretest -C utf >/dev/null
99 utf=$?
100
101 if [ "$nl" = "LF" -o "$nl" = "ANY" ]; then
102 echo "Running C library tests $withvalgrind"
103 $srcdir/RunTest $valgrind >teststdout
104 if [ $? -ne 0 ]; then
105 echo " "
106 echo "**** Test failed ****"
107 cat teststdout
108 exit 1
109 fi
110 else
111 echo "Skipping C library tests: newline is $nl"
112 fi
113
114 if [ "$nl" = "LF" ]; then
115 echo "Running pcregrep tests $withvalgrind"
116 $srcdir/RunGrepTest $valgrind >teststdout 2>teststderr
117 if [ $? -ne 0 ]; then
118 echo " "
119 echo "**** Test failed ****"
120 cat teststderr
121 cat teststdout
122 exit 1
123 fi
124 else
125 echo "Skipping pcregrep tests: newline is $nl"
126 fi
127
128 if [ "$jit" -gt 0 -a $utf -gt 0 ]; then
129 echo "Running JIT regression tests $withvalgrind"
130 $cvalgrind $srcdir/pcre_jit_test >teststdout 2>teststderr
131 if [ $? -ne 0 ]; then
132 echo " "
133 echo "**** Test failed ****"
134 cat teststderr
135 cat teststdout
136 exit 1
137 fi
138 else
139 echo "Skipping JIT regression tests: JIT or UTF not enabled"
140 fi
141
142 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 echo "Running $utest $withvalgrind"
149 $cvalgrind $utest >teststdout
150 if [ $? -ne 0 ]; then
151 echo " "
152 echo "**** Test failed ****"
153 cat teststdout
154 exit 1
155 fi
156 done
157 else
158 echo "Skipping C++ tests: pcrecpp_unittest does not exist"
159 fi
160 else
161 echo "Skipping C++ tests: newline is $nl"
162 fi
163 }
164
165
166 # Update the total count whenever a new test is added; it is used to show
167 # progess as each test is run.
168
169 testtotal=43
170 testcount=0
171
172 # This set of tests builds PCRE and runs the tests with a variety of configure
173 # 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
179 valgrind=
180 cvalgrind=
181 withvalgrind=
182 srcdir=.
183 export srcdir
184
185 # 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
188 if [ "$ISGCC" = "yes" ]; then
189 echo "Maximally configured test with -O2"
190 SAVECLFAGS="$CFLAGS"
191 CFLAGS="$CFLAGS -O2"
192 opts="--disable-shared --enable-unicode-properties --enable-jit --enable-pcre16 --enable-pcre32"
193 runtest
194 CFLAGS="$SAVECFLAGS"
195 fi
196
197 echo "General tests in the current directory"
198 for opts in \
199 "" \
200 "--enable-utf8 --disable-static" \
201 "--disable-stack-for-recursion --disable-shared" \
202 "--enable-utf8 --disable-stack-for-recursion --disable-shared" \
203 "--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 "--enable-newline-is-anycrlf --enable-bsr-anycrlf --disable-shared" \
211 "--enable-utf8 --enable-newline-is-any --enable-unicode-properties --disable-stack-for-recursion --disable-static --disable-cpp" \
212 "--enable-jit --disable-shared" \
213 "--enable-jit --enable-unicode-properties --disable-shared" \
214 "--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 "--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 "--enable-pcre16 --enable-jit --enable-unicode-properties --with-link-size=4 --disable-shared" \
224 "--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 "--enable-pcre32 --enable-jit --enable-unicode-properties --with-link-size=4 --disable-shared" \
232 "--enable-pcre32 --enable-pcre16 --disable-shared" \
233 "--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 do
236 runtest
237 done
238
239 # Now re-run some of the tests under valgrind.
240
241 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 "--enable-jit --enable-unicode-properties --disable-shared" \
250 "--enable-pcre16 --enable-pcre32 --enable-jit --enable-unicode-properties " \
251 "--disable-shared"
252 do
253 opts="--enable-valgrind $opts"
254 runtest
255 done
256
257 valgrind=
258 cvalgrind=
259 withvalgrind=
260
261 # 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 # source directory is cleaned up first.
264
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 fi
272 fi
273
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 fi
292
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 # End

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5