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

Contents of /code/trunk/maint/ManyConfigTests

Parent Directory Parent Directory | Revision Log Revision Log


Revision 898 - (hide annotations) (download)
Fri Jan 20 14:25:21 2012 UTC (2 years, 6 months ago) by ph10
File size: 6719 byte(s)
Formatting tidy

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

Properties

Name Value
svn:executable *

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12