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

Contents of /code/trunk/maint/ManyConfigTests

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5