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

Contents of /code/trunk/maint/ManyConfigTests

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1410 - (show annotations)
Fri Dec 6 16:21:06 2013 UTC (5 years, 11 months ago) by ph10
File size: 8569 byte(s)
When running the tests for many different configurations, add compiler warning
switches when gcc is being used, and fail if any warnings are generated.
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; it just slows down compilation a lot
27 # (and running the tests themselves is quick).
28
29 CFLAGS="-g -O0"
30 CXXFLAGS="$CFLAGS"
31
32 # If the compiler is gcc, add a lot of warning switches.
33
34 cc --version >zzz 2>/dev/null
35 if [ $? -eq 0 ] && grep GCC zzz >/dev/null; then
36 CFLAGS="$CFLAGS -Wall"
37 CFLAGS="$CFLAGS -Wno-overlength-strings"
38 CFLAGS="$CFLAGS -Wpointer-arith"
39 CFLAGS="$CFLAGS -Wwrite-strings"
40 CFLAGS="$CFLAGS -Wundef -Wshadow"
41 CFLAGS="$CFLAGS -Wextra -Wformat"
42 CFLAGS="$CFLAGS -Wbad-function-cast"
43 CFLAGS="$CFLAGS -Wmissing-declarations"
44 CFLAGS="$CFLAGS -Wnested-externs"
45 CFLAGS="$CFLAGS -pedantic"
46 CFLAGS="$CFLAGS -Wuninitialized"
47 CFLAGS="$CFLAGS -Wmissing-prototypes"
48 CFLAGS="$CFLAGS -Wstrict-prototypes"
49 fi
50
51
52 # This function runs a single test with the set of configuration options that
53 # are in $opts. The source directory must be set in srcdir.
54
55 function runtest()
56 {
57 rm -f *_unittest
58 testcount=`expr $testcount + 1`
59
60 if [ "$opts" = "" ] ; then
61 echo "[$testcount/$testtotal] Configuring with: default settings"
62 else
63 echo "[$testcount/$testtotal] Configuring with:"
64 echo " $opts"
65 fi
66
67 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
68 $srcdir/configure $opts >/dev/null 2>teststderr
69
70 if [ $? -ne 0 ]; then
71 echo " "
72 echo "**** Error while configuring ****"
73 cat teststderr
74 exit 1
75 fi
76
77 echo "Making"
78 make >/dev/null 2>teststderr
79 if [ $? -ne 0 -o -s teststderr ]; then
80 echo " "
81 echo "**** Errors or warnings while making ****"
82 echo " "
83 cat teststderr
84 exit 1
85 fi
86
87 if [ $verbose -eq 1 ]; then
88 ./pcretest -C
89 fi
90
91 nl=`./pcretest -C newline`
92 ./pcretest -C jit >/dev/null
93 jit=$?
94 ./pcretest -C utf >/dev/null
95 utf=$?
96
97 if [ "$nl" = "LF" -o "$nl" = "ANY" ]; then
98 echo "Running C library tests $withvalgrind"
99 $srcdir/RunTest $valgrind >teststdout
100 if [ $? -ne 0 ]; then
101 echo " "
102 echo "**** Test failed ****"
103 cat teststdout
104 exit 1
105 fi
106 else
107 echo "Skipping C library tests: newline is $nl"
108 fi
109
110 if [ "$nl" = "LF" ]; then
111 echo "Running pcregrep tests $withvalgrind"
112 $srcdir/RunGrepTest $valgrind >teststdout 2>teststderr
113 if [ $? -ne 0 ]; then
114 echo " "
115 echo "**** Test failed ****"
116 cat teststderr
117 cat teststdout
118 exit 1
119 fi
120 else
121 echo "Skipping pcregrep tests: newline is $nl"
122 fi
123
124 if [ "$jit" -gt 0 -a $utf -gt 0 ]; then
125 echo "Running JIT regression tests $withvalgrind"
126 $cvalgrind $srcdir/pcre_jit_test >teststdout 2>teststderr
127 if [ $? -ne 0 ]; then
128 echo " "
129 echo "**** Test failed ****"
130 cat teststderr
131 cat teststdout
132 exit 1
133 fi
134 else
135 echo "Skipping JIT regression tests: JIT or UTF not enabled"
136 fi
137
138 if [ "$nl" = "LF" -o "$nl" = "ANY" ]; then
139 if [ -f pcrecpp_unittest ] ; then
140 for utest in pcrecpp_unittest \
141 pcre_scanner_unittest \
142 pcre_stringpiece_unittest
143 do
144 echo "Running $utest $withvalgrind"
145 $cvalgrind $utest >teststdout
146 if [ $? -ne 0 ]; then
147 echo " "
148 echo "**** Test failed ****"
149 cat teststdout
150 exit 1
151 fi
152 done
153 else
154 echo "Skipping C++ tests: pcrecpp_unittest does not exist"
155 fi
156 else
157 echo "Skipping C++ tests: newline is $nl"
158 fi
159 }
160
161
162 # This set of tests builds PCRE and runs the tests with a variety of configure
163 # options, in the current (source) directory. The first (empty) configuration
164 # builds with all the default settings. As well as testing that these options
165 # work, we use --disable-shared or --disable-static after the first test (which
166 # builds both) to save a bit of time by building only one version of the
167 # library for the subsequent tests.
168
169 valgrind=
170 cvalgrind=
171 withvalgrind=
172
173 # Update the total count whenever a new test is added; it is used to show
174 # progess as each test is run.
175
176 testtotal=41
177 testcount=0
178
179 echo "Tests in the current directory"
180 srcdir=.
181 for opts in \
182 "" \
183 "--enable-utf8 --disable-static" \
184 "--disable-stack-for-recursion --disable-shared" \
185 "--enable-utf8 --disable-stack-for-recursion --disable-shared" \
186 "--enable-unicode-properties --disable-shared" \
187 "--enable-unicode-properties --disable-stack-for-recursion --disable-shared" \
188 "--enable-unicode-properties --disable-cpp --with-link-size=3 --disable-shared" \
189 "--enable-rebuild-chartables --disable-shared" \
190 "--enable-newline-is-any --disable-shared" \
191 "--enable-newline-is-cr --disable-shared" \
192 "--enable-newline-is-crlf --disable-shared" \
193 "--enable-newline-is-anycrlf --enable-bsr-anycrlf --disable-shared" \
194 "--enable-utf8 --enable-newline-is-any --enable-unicode-properties --disable-stack-for-recursion --disable-static --disable-cpp" \
195 "--enable-jit --disable-shared" \
196 "--enable-jit --enable-unicode-properties --disable-shared" \
197 "--enable-jit --enable-unicode-properties --with-link-size=3 --disable-shared" \
198 "--enable-pcre16" \
199 "--enable-pcre16 --enable-jit --enable-utf --disable-shared" \
200 "--enable-pcre16 --enable-jit --enable-unicode-properties --disable-shared" \
201 "--enable-pcre16 --enable-jit --disable-pcre8 --disable-shared" \
202 "--enable-pcre16 --enable-jit --disable-pcre8 --enable-utf --disable-shared" \
203 "--enable-pcre16 --disable-stack-for-recursion --disable-shared" \
204 "--enable-pcre16 --enable-unicode-properties --disable-stack-for-recursion --disable-shared" \
205 "--enable-pcre16 --enable-jit --enable-unicode-properties --with-link-size=3 --disable-shared" \
206 "--enable-pcre16 --enable-jit --enable-unicode-properties --with-link-size=4 --disable-shared" \
207 "--enable-pcre32" \
208 "--enable-pcre32 --enable-jit --enable-utf --disable-shared" \
209 "--enable-pcre32 --enable-jit --enable-unicode-properties --disable-shared" \
210 "--enable-pcre32 --enable-jit --disable-pcre8 --disable-shared" \
211 "--enable-pcre32 --enable-jit --disable-pcre8 --enable-utf --disable-shared" \
212 "--enable-pcre32 --disable-stack-for-recursion --disable-shared" \
213 "--enable-pcre32 --enable-unicode-properties --disable-stack-for-recursion --disable-shared" \
214 "--enable-pcre32 --enable-jit --enable-unicode-properties --with-link-size=4 --disable-shared" \
215 "--enable-pcre32 --enable-pcre16 --disable-shared" \
216 "--enable-pcre32 --enable-pcre16 --disable-pcre8 --disable-shared"
217 do
218 runtest
219 done
220
221 # Now re-run some of the tests under valgrind.
222
223 echo "Tests in the current directory using valgrind"
224 valgrind=valgrind
225 cvalgrind="valgrind -q --smc-check=all"
226 withvalgrind="with valgrind"
227
228 for opts in \
229 "--enable-unicode-properties --disable-stack-for-recursion --disable-shared" \
230 "--enable-unicode-properties --with-link-size=3 --disable-shared" \
231 "--enable-jit --enable-unicode-properties --disable-shared" \
232 "--enable-pcre16 --enable-pcre32 --enable-jit --enable-unicode-properties " \
233 "--disable-shared"
234 do
235 opts="--enable-valgrind $opts"
236 runtest
237 done
238
239 valgrind=
240 cvalgrind=
241 withvalgrind=
242
243 # Clean up the distribution and then do at least one build and test in a
244 # directory other than the source directory. It doesn't work unless the
245 # source directory is cleaned up first.
246
247 if [ -f Makefile ]; then
248 echo "Running 'make distclean'"
249 make distclean >/dev/null 2>&1
250 if [ $? -ne 0 ]; then
251 echo "** 'make distclean' failed"
252 exit 1
253 fi
254 fi
255
256 echo "Tests in the $tmp directory"
257 srcdir=`pwd`
258 export srcdir
259
260 if [ ! -e $tmp ]; then
261 mkdir $tmp
262 fi
263
264 if [ ! -d $tmp ]; then
265 echo "** Failed to create $tmp or it is not a directory"
266 exit 1
267 fi
268
269 cd $tmp
270 if [ $? -ne 0 ]; then
271 echo "** Failed to cd to $tmp"
272 exit 1
273 fi
274
275 for opts in \
276 "--enable-unicode-properties --disable-shared"
277 do
278 runtest
279 done
280
281 echo "Removing $tmp"
282
283 rm -rf $tmp
284
285 echo "All done"
286
287 # End

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5