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