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

Contents of /code/trunk/maint/ManyConfigTests

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1317 - (hide annotations) (download)
Wed May 1 16:00:37 2013 UTC (3 weeks, 2 days ago) by ph10
File size: 7878 byte(s)
Add a count to show progress, suppress compiler optimization to save time.

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

Properties

Name Value
svn:executable *

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12