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

Contents of /code/trunk/maint/ManyConfigTests

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1654 - (show annotations)
Tue Jun 14 09:01:39 2016 UTC (5 months, 3 weeks ago) by ph10
File size: 9939 byte(s)
Error occurred while calculating annotation data.
Warning suppression no longer needed.
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 # There is an infelicity in the Autotools world (as of October 2015) which
82 # causes the message
83 #
84 # ar: `u' modifier ignored since `D' is the default (see `U')
85 #
86 # to be output while linking. This triggers an unwanted error report from this
87 # script, because it expects no stderr output while making. To get round this
88 # we filter the stderr output through sed, removing all occurrences of the
89 # above lines. Just for paranoia, check that sed is available before doing
90 # this.
91
92 echo "Making"
93 make -j >/dev/null 2>teststderr
94 makeRC=$?
95 if command -v sed >/dev/null 2>&1 ; then
96 sed "/\`u' modifier ignored since \`D' is the default/ d" \
97 teststderr > teststderrM
98 mv -f teststderrM teststderr
99 fi
100 if [ $makeRC -ne 0 -o -s teststderr ]; then
101 echo " "
102 echo "**** Errors or warnings while making ****"
103 echo " "
104 cat teststderr
105 exit 1
106 fi
107
108 if [ $verbose -eq 1 ]; then
109 ./pcretest -C
110 fi
111
112 nl=`./pcretest -C newline`
113 ./pcretest -C jit >/dev/null
114 jit=$?
115 ./pcretest -C utf >/dev/null
116 utf=$?
117
118 if [ "$nl" = "LF" -o "$nl" = "ANY" ]; then
119 echo "Running C library tests $withvalgrind"
120 $srcdir/RunTest $valgrind >teststdout
121 if [ $? -ne 0 ]; then
122 echo " "
123 echo "**** Test failed ****"
124 cat teststdout
125 exit 1
126 fi
127 else
128 echo "Skipping C library tests: newline is $nl"
129 fi
130
131 if [ "$nl" = "LF" ]; then
132 echo "Running pcregrep tests $withvalgrind"
133 $srcdir/RunGrepTest $valgrind >teststdout 2>teststderr
134 if [ $? -ne 0 ]; then
135 echo " "
136 echo "**** Test failed ****"
137 cat teststderr
138 cat teststdout
139 exit 1
140 fi
141 else
142 echo "Skipping pcregrep tests: newline is $nl"
143 fi
144
145 if [ "$jit" -gt 0 -a $utf -gt 0 ]; then
146 echo "Running JIT regression tests $withvalgrind"
147 $cvalgrind $srcdir/pcre_jit_test >teststdout 2>teststderr
148 if [ $? -ne 0 ]; then
149 echo " "
150 echo "**** Test failed ****"
151 cat teststderr
152 cat teststdout
153 exit 1
154 fi
155 else
156 echo "Skipping JIT regression tests: JIT or UTF not enabled"
157 fi
158
159 if [ "$nl" = "LF" -o "$nl" = "ANY" ]; then
160 if [ -f pcrecpp_unittest ] ; then
161 for utest in pcrecpp_unittest \
162 pcre_scanner_unittest \
163 pcre_stringpiece_unittest
164 do
165 echo "Running $utest $withvalgrind"
166 $cvalgrind $utest >teststdout
167 if [ $? -ne 0 ]; then
168 echo " "
169 echo "**** Test failed ****"
170 cat teststdout
171 exit 1
172 fi
173 done
174 else
175 echo "Skipping C++ tests: pcrecpp_unittest does not exist"
176 fi
177 else
178 echo "Skipping C++ tests: newline is $nl"
179 fi
180 }
181
182
183 # Update the total count whenever a new test is added; it is used to show
184 # progess as each test is run.
185
186 testtotal=43
187 testcount=0
188
189 # This set of tests builds PCRE and runs the tests with a variety of configure
190 # options, in the current (source) directory. The empty configuration builds
191 # with all the default settings. As well as testing that these options work, we
192 # use --disable-shared or --disable-static after the default test (which builds
193 # both) to save a bit of time by building only one version of the library for
194 # the subsequent tests.
195
196 valgrind=
197 cvalgrind=
198 withvalgrind=
199 srcdir=.
200 export srcdir
201
202 # If gcc is in use, run a maximally configured test with -O2, because that can
203 # throw up warnings that are not detected with -O0.
204
205 if [ "$ISGCC" = "yes" ]; then
206 echo "Maximally configured test with -O2"
207 SAVECLFAGS="$CFLAGS"
208 CFLAGS="$CFLAGS -O2"
209 opts="--disable-shared --enable-unicode-properties --enable-jit --enable-pcre16 --enable-pcre32"
210 runtest
211 CFLAGS="$SAVECFLAGS"
212 fi
213
214 echo "General tests in the current directory"
215 for opts in \
216 "" \
217 "--enable-utf8 --disable-static" \
218 "--disable-stack-for-recursion --disable-shared" \
219 "--enable-utf8 --disable-stack-for-recursion --disable-shared" \
220 "--enable-unicode-properties --disable-shared" \
221 "--enable-unicode-properties --disable-stack-for-recursion --disable-shared" \
222 "--enable-unicode-properties --disable-cpp --with-link-size=3 --disable-shared" \
223 "--enable-rebuild-chartables --disable-shared" \
224 "--enable-newline-is-any --disable-shared" \
225 "--enable-newline-is-cr --disable-shared" \
226 "--enable-newline-is-crlf --disable-shared" \
227 "--enable-newline-is-anycrlf --enable-bsr-anycrlf --disable-shared" \
228 "--enable-utf8 --enable-newline-is-any --enable-unicode-properties --disable-stack-for-recursion --disable-static --disable-cpp" \
229 "--enable-jit --disable-shared" \
230 "--enable-jit --enable-unicode-properties --disable-shared" \
231 "--enable-jit --enable-unicode-properties --with-link-size=3 --disable-shared" \
232 "--enable-pcre16" \
233 "--enable-pcre16 --enable-jit --enable-utf --disable-shared" \
234 "--enable-pcre16 --enable-jit --enable-unicode-properties --disable-shared" \
235 "--enable-pcre16 --enable-jit --disable-pcre8 --disable-shared" \
236 "--enable-pcre16 --enable-jit --disable-pcre8 --enable-utf --disable-shared" \
237 "--enable-pcre16 --disable-stack-for-recursion --disable-shared" \
238 "--enable-pcre16 --enable-unicode-properties --disable-stack-for-recursion --disable-shared" \
239 "--enable-pcre16 --enable-jit --enable-unicode-properties --with-link-size=3 --disable-shared" \
240 "--enable-pcre16 --enable-jit --enable-unicode-properties --with-link-size=4 --disable-shared" \
241 "--enable-pcre32" \
242 "--enable-pcre32 --enable-jit --enable-utf --disable-shared" \
243 "--enable-pcre32 --enable-jit --enable-unicode-properties --disable-shared" \
244 "--enable-pcre32 --enable-jit --disable-pcre8 --disable-shared" \
245 "--enable-pcre32 --enable-jit --disable-pcre8 --enable-utf --disable-shared" \
246 "--enable-pcre32 --disable-stack-for-recursion --disable-shared" \
247 "--enable-pcre32 --enable-unicode-properties --disable-stack-for-recursion --disable-shared" \
248 "--enable-pcre32 --enable-jit --enable-unicode-properties --with-link-size=4 --disable-shared" \
249 "--enable-pcre32 --enable-pcre16 --disable-shared" \
250 "--enable-pcre32 --enable-pcre16 --disable-pcre8 --disable-shared" \
251 "--enable-pcre32 --enable-pcre16 --disable-pcre8 --enable-jit --enable-unicode-properties --enable-newline-is-anycrlf --enable-bsr-anycrlf --disable-shared"
252 do
253 runtest
254 done
255
256 # Now re-run some of the tests under valgrind.
257
258 echo "Tests in the current directory using valgrind"
259 valgrind=valgrind
260 cvalgrind="valgrind -q --smc-check=all"
261 withvalgrind="with valgrind"
262
263 for opts in \
264 "--enable-unicode-properties --disable-stack-for-recursion --disable-shared" \
265 "--enable-unicode-properties --with-link-size=3 --disable-shared" \
266 "--enable-jit --enable-unicode-properties --disable-shared" \
267 "--enable-pcre16 --enable-pcre32 --enable-jit --enable-unicode-properties " \
268 "--disable-shared"
269 do
270 opts="--enable-valgrind $opts"
271 runtest
272 done
273
274 valgrind=
275 cvalgrind=
276 withvalgrind=
277
278 # Clean up the distribution and then do at least one build and test in a
279 # directory other than the source directory. It doesn't work unless the
280 # source directory is cleaned up first.
281
282 if [ -f Makefile ]; then
283 echo "Running 'make distclean'"
284 make distclean >/dev/null 2>&1
285 if [ $? -ne 0 ]; then
286 echo "** 'make distclean' failed"
287 exit 1
288 fi
289 fi
290
291 echo "Tests in the $tmp directory"
292 srcdir=`pwd`
293 export srcdir
294
295 if [ ! -e $tmp ]; then
296 mkdir $tmp
297 fi
298
299 if [ ! -d $tmp ]; then
300 echo "** Failed to create $tmp or it is not a directory"
301 exit 1
302 fi
303
304 cd $tmp
305 if [ $? -ne 0 ]; then
306 echo "** Failed to cd to $tmp"
307 exit 1
308 fi
309
310 for opts in \
311 "--enable-unicode-properties --disable-shared"
312 do
313 runtest
314 done
315
316 echo "Removing $tmp"
317
318 rm -rf $tmp
319
320 echo "All done"
321
322 # End

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5