1
1
#! /bin/sh
2
2
3
- # This is a script for the use of PCRE2 maintainers. It configures and rebuilds
3
+ # This is a script for the use of PCRE2 maintainers. It configures and builds
4
4
# PCRE2 with a variety of configuration options, and in each case runs the
5
5
# tests to ensure that all goes well. Every possible combination would take far
6
6
# too long, so we use a representative sample. This script should be run in the
18
18
# -nojitvalgrind skip JIT tests with valgrind
19
19
# -nomain skip all the main (non-JIT) set of tests
20
20
# -nomainvalgrind skip the main (non-JIT) valgrind tests
21
- # -notmp skip the test in a temporary directory
21
+ # -notmp skip the tests in a temporary directory
22
+ # -notmpjit skip the JIT test in a temporary directory
22
23
# -novalgrind skip all the valgrind tests
23
24
24
25
# Alternatively, if any of those names are given with '+' instead of '-no',
@@ -36,6 +37,7 @@ usejitvalgrind=1
36
37
usemain=1
37
38
usemainvalgrind=1
38
39
usetmp=1
40
+ usetmpjit=1
39
41
usevalgrind=1
40
42
41
43
dummy=0
@@ -53,6 +55,8 @@ while [ $# -gt 0 ] ; do
53
55
usemain=0
54
56
usemainvalgrind=0
55
57
usetmp=0
58
+ usetmpjit=0
59
+ usevalgrind=0
56
60
seenplus=1
57
61
fi ;;
58
62
esac
@@ -63,22 +67,24 @@ while [ $# -gt 0 ] ; do
63
67
-noasan) useasan=0;;
64
68
-nousan) useusan=0;;
65
69
-nodebug) usedebug=0;;
66
- -nojit) usejit=0; usejitvalgrind=0;;
70
+ -nojit) usejit=0; usejitvalgrind=0; usetmpjit=0; ;
67
71
-nojitmain) usejit=0;;
68
72
-nojitvalgrind) usejitvalgrind=0;;
69
73
-nomain) usemain=0; usemainvalgrind=0;;
70
74
-nomainvalgrind) usemainvalgrind=0;;
71
- -notmp) usetmp=0;;
75
+ -notmp) usetmp=0; usetmpjit=0;;
76
+ -notmpjit) usetmpjit=0;;
72
77
-novalgrind) usevalgrind=0;;
73
78
+asan) useasan=1;;
74
79
+usan) useusan=1;;
75
80
+debug) usedebug=1;;
76
- +jit) usejit=1; usejitvalgrind=1;;
81
+ +jit) usejit=1; usejitvalgrind=1; usetmpjit=1; ;
77
82
+jitmain) usejit=1;;
78
83
+jitvalgrind) usejitvalgrind=1;;
79
84
+main) usemain=1; usemainvalgrind=1;;
80
85
+mainvalgrind) usemainvalgrind=1;;
81
86
+tmp) usetmp=1;;
87
+ +tmpjit) usetmpjit=1;;
82
88
+valgrind) usevalgrind=1; usejitvalgrind=1; usemainvalgrind=1;;
83
89
* ) echo " Unknown option '$1 '" ; exit 1;;
84
90
esac
@@ -124,9 +130,11 @@ if [ $? -eq 0 ] && grep GCC /tmp/pcre2ccversion >/dev/null; then
124
130
CFLAGS=" $CFLAGS -Wnested-externs"
125
131
CFLAGS=" $CFLAGS -pedantic"
126
132
CFLAGS=" $CFLAGS -Wuninitialized"
127
- CFLAGS=" $CFLAGS -Wmaybe-uninitialized"
133
+ CFLAGS=" $CFLAGS -Wmaybe-uninitialized"
128
134
CFLAGS=" $CFLAGS -Wmissing-prototypes"
129
135
CFLAGS=" $CFLAGS -Wstrict-prototypes"
136
+ CFKAGS=" $CFLAGS -Warray-bounds"
137
+ CFLAGS=" $CFLAGS -Wformat-overflow=2"
130
138
fi
131
139
rm -f /tmp/pcre2ccversion
132
140
@@ -137,7 +145,7 @@ rm -f /tmp/pcre2ccversion
137
145
138
146
runtest ()
139
147
{
140
- rm -f $srcdir /pcre2test $srcdir /pcre2grep $srcdir /pcre2_jit_test
148
+ rm -f $srcdir /pcre2test $srcdir /pcre2grep $srcdir /pcre2_jit_test $srcdir /pcre2posix_test
141
149
testcount=` expr $testcount + 1`
142
150
143
151
if [ " $opts " = " " ] ; then
@@ -218,13 +226,21 @@ runtest()
218
226
cat teststdoutM
219
227
exit 1
220
228
fi
229
+ echo " Running pcre2posix test $withvalgrind "
230
+ $valgrind ./pcre2posix_test > teststdoutM 2> teststderrM
231
+
232
+ if [ $? -ne 0 ]; then
233
+ echo " "
234
+ echo " **** Test failed ****"
235
+ exit 1
236
+ fi
221
237
else
222
- echo " Skipping pcre2grep tests: 8-bit library not compiled"
238
+ echo " Skipping pcre2grep and pcre2posix tests: 8-bit library not compiled"
223
239
fi
224
240
225
241
if [ " $jit " -gt 0 ]; then
226
242
echo " Running JIT regression tests $withvalgrind "
227
- $jrvalgrind $srcdir /pcre2_jit_test > teststdoutM 2> teststderrM
243
+ $jrvalgrind . /pcre2_jit_test > teststdoutM 2> teststderrM
228
244
if [ $? -ne 0 -o -s teststderrM ]; then
229
245
echo " "
230
246
echo " **** Test failed ****"
@@ -242,7 +258,7 @@ runtest()
242
258
243
259
testtotal=` expr 17 \* $usemain + \
244
260
1 \* $usemain \* $usedebug + \
245
- 1 \* $usetmp + \
261
+ 1 \* $usetmp + 1 \* $usetmpjit + \
246
262
1 \* $ISGCC \* $usemain + \
247
263
1 \* $ISGCC \* $usemain \* $useasan + \
248
264
1 \* $ISGCC \* $usemain \* $useusan + \
@@ -293,15 +309,15 @@ if [ $ISGCC -ne 0 -a $usemain -ne 0 ]; then
293
309
opts=" --disable-shared $enable_jit --enable-pcre2-16 --enable-pcre2-32"
294
310
runtest
295
311
fi
296
- # This also seems to be the case for sanitize undefined.
312
+ # This also seems to be the case for sanitize undefined.
297
313
if [ $useusan -ne 0 ]; then
298
314
echo " ------- Maximally configured test with -fsanitize=undefined -fno-sanitize=shift -fno-sanitize=alignment -std=gnu99 -------"
299
315
CFLAGS=" $OFLAGS $SAVECFLAGS -no-pie -fno-PIE -fsanitize=undefined -fno-sanitize=shift -fno-sanitize=alignment -std=gnu99"
300
316
echo " CFLAGS=$CFLAGS "
301
317
opts=" --disable-shared $enable_jit --enable-pcre2-16 --enable-pcre2-32"
302
318
runtest
303
319
fi
304
- CFLAGS=" $OFLAGS $ SAVECFLAGS"
320
+ CFLAGS=" $SAVECFLAGS "
305
321
fi
306
322
307
323
# This set of tests builds PCRE2 and runs the tests with a variety of configure
312
328
# library for the subsequent tests.
313
329
314
330
echo " ---------- CFLAGS for the remaining tests ----------"
331
+ CFLAGS=" $OFLAGS $CFLAGS "
315
332
echo " CFLAGS=$CFLAGS "
316
333
317
334
if [ $usemain -ne 0 ]; then
@@ -386,7 +403,7 @@ if [ $usevalgrind -ne 0 ]; then
386
403
fi
387
404
388
405
if [ $usejitvalgrind -ne 0 ]; then
389
- jrvalgrind=" valgrind --tool=memcheck -q --smc-check=all-non-file --suppressions=$srcdir /testdata/valgrind-jit.supp"
406
+ jrvalgrind=" valgrind --tool=memcheck -q --smc-check=all-non-file --suppressions=$srcdir /testdata/valgrind-jit.supp"
390
407
for opts in \
391
408
" --enable-jit --disable-shared" \
392
409
" --enable-jit --enable-pcre2-16 --enable-pcre2-32"
@@ -418,8 +435,7 @@ echo "---------- End of tests in the source directory ----------"
418
435
echo " Removing teststdoutM and teststderrM"
419
436
rm -rf teststdoutM teststderrM
420
437
421
- if [ $usetmp -ne 0 ]; then
422
- echo " ---------- Tests in the $tmp directory ----------"
438
+ if [ $usetmp -ne 0 -o $usetmpjit -ne 0 ]; then
423
439
srcdir=` pwd`
424
440
export srcdir
425
441
@@ -438,11 +454,23 @@ if [ $usetmp -ne 0 ]; then
438
454
exit 1
439
455
fi
440
456
441
- for opts in \
442
- " --disable-shared"
443
- do
444
- runtest
445
- done
457
+ if [ $usetmp -ne 0 ]; then
458
+ echo " ---------- Tests in the $tmp directory ----------"
459
+ for opts in \
460
+ " --disable-shared"
461
+ do
462
+ runtest
463
+ done
464
+ fi
465
+
466
+ if [ $usetmpjit -ne 0 ]; then
467
+ echo " ---------- JIT tests in the $tmp directory ----------"
468
+ for opts in \
469
+ " --enable-jit --disable-shared"
470
+ do
471
+ runtest
472
+ done
473
+ fi
446
474
447
475
echo " Removing $tmp "
448
476
rm -rf $tmp
0 commit comments