Create a suppressions file for valgrind with JIT.

This commit is contained in:
Philip.Hazel 2015-09-11 16:56:47 +00:00
parent 7f12be426c
commit 297024d65b
4 changed files with 120 additions and 76 deletions

View File

@ -179,6 +179,11 @@ this work, the new command was added to several test files and the testing
scripts were modified. The pcre2grep tests can now also be run when there is no scripts were modified. The pcre2grep tests can now also be run when there is no
LF in the default newline convention. LF in the default newline convention.
51. The RunTest script has been modified so that, when JIT is used and valgrind
is specified, a valgrind suppressions file is set up to ignore "Invalid read of
size 16" errors because these are false positives when the hardware supports
the SSE2 instruction set.
Version 10.20 30-June-2015 Version 10.20 30-June-2015
-------------------------- --------------------------

30
RunTest
View File

@ -157,7 +157,7 @@ checkresult()
checkspecial() checkspecial()
{ {
$valgrind ./pcre2test $1 >>testtry $valgrind $vjs ./pcre2test $1 >>testtry
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
echo "** pcre2test $1 failed - check testtry" echo "** pcre2test $1 failed - check testtry"
exit 1 exit 1
@ -194,6 +194,7 @@ bigstack=
sim= sim=
skip= skip=
valgrind= valgrind=
vjs=
# This is in case the caller has set aliases (as I do - PH) # This is in case the caller has set aliases (as I do - PH)
unset cp ls mv rm unset cp ls mv rm
@ -377,11 +378,18 @@ fi
$sim ./pcre2test -C unicode >/dev/null $sim ./pcre2test -C unicode >/dev/null
utf=$? utf=$?
# When JIT is used with valgrind, we need to set up valgrind suppressions as
# otherwise there are a lot of false positive valgrind reports when the
# the hardware supports SSE2.
jitopt= jitopt=
$sim ./pcre2test -C jit >/dev/null $sim ./pcre2test -C jit >/dev/null
jit=$? jit=$?
if [ $jit -ne 0 -a "$nojit" != "yes" ] ; then if [ $jit -ne 0 -a "$nojit" != "yes" ] ; then
jitopt=-jit jitopt=-jit
if [ "$valgrind" != "" ] ; then
vjs="--suppressions=$testdata/valgrind-jit.supp"
fi
fi fi
# If no specific tests were requested, select all. Those that are not # If no specific tests were requested, select all. Those that are not
@ -459,7 +467,7 @@ for bmode in "$test8" "$test16" "$test32"; do
if [ $do1 = yes ] ; then if [ $do1 = yes ] ; then
echo $title1 echo $title1
for opt in "" $jitopt; do for opt in "" $jitopt; do
$sim $valgrind ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput1 testtry $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput1 testtry
checkresult $? 1 "$opt" checkresult $? 1 "$opt"
done done
fi fi
@ -469,7 +477,7 @@ for bmode in "$test8" "$test16" "$test32"; do
if [ $do2 = yes ] ; then if [ $do2 = yes ] ; then
echo $title2 "(excluding UTF-$bits)" echo $title2 "(excluding UTF-$bits)"
for opt in "" $jitopt; do for opt in "" $jitopt; do
$sim $valgrind ./pcre2test -q $test2stack $bmode $opt $testdata/testinput2 testtry $sim $valgrind ${opt:+$vjs} ./pcre2test -q $test2stack $bmode $opt $testdata/testinput2 testtry
if [ $? = 0 ] ; then if [ $? = 0 ] ; then
checkresult $? 2 "$opt" checkresult $? 2 "$opt"
else else
@ -529,7 +537,7 @@ for bmode in "$test8" "$test16" "$test32"; do
if [ "$locale" != "" ] ; then if [ "$locale" != "" ] ; then
echo $title3 "(using '$locale' locale)" echo $title3 "(using '$locale' locale)"
for opt in "" $jitopt; do for opt in "" $jitopt; do
$sim $valgrind ./pcre2test -q $defaultstack $bmode $opt $infile testtry $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $infile testtry
if [ $? = 0 ] ; then if [ $? = 0 ] ; then
case "$opt" in case "$opt" in
-jit) with=" with JIT";; -jit) with=" with JIT";;
@ -566,7 +574,7 @@ for bmode in "$test8" "$test16" "$test32"; do
echo " Skipped because UTF-$bits support is not available" echo " Skipped because UTF-$bits support is not available"
else else
for opt in "" $jitopt; do for opt in "" $jitopt; do
$sim $valgrind ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput4 testtry $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput4 testtry
checkresult $? 4 "$opt" checkresult $? 4 "$opt"
done done
fi fi
@ -578,7 +586,7 @@ for bmode in "$test8" "$test16" "$test32"; do
echo " Skipped because UTF-$bits support is not available" echo " Skipped because UTF-$bits support is not available"
else else
for opt in "" $jitopt; do for opt in "" $jitopt; do
$sim $valgrind ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput5 testtry $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput5 testtry
checkresult $? 5 "$opt" checkresult $? 5 "$opt"
done done
fi fi
@ -630,7 +638,7 @@ for bmode in "$test8" "$test16" "$test32"; do
echo " Skipped when running 16/32-bit tests" echo " Skipped when running 16/32-bit tests"
else else
for opt in "" $jitopt; do for opt in "" $jitopt; do
$sim $valgrind ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput9 testtry $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput9 testtry
checkresult $? 9 "$opt" checkresult $? 9 "$opt"
done done
fi fi
@ -646,7 +654,7 @@ for bmode in "$test8" "$test16" "$test32"; do
echo " Skipped because UTF-$bits support is not available" echo " Skipped because UTF-$bits support is not available"
else else
for opt in "" $jitopt; do for opt in "" $jitopt; do
$sim $valgrind ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput10 testtry $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput10 testtry
checkresult $? 10 "$opt" checkresult $? 10 "$opt"
done done
fi fi
@ -660,7 +668,7 @@ for bmode in "$test8" "$test16" "$test32"; do
echo " Skipped when running 8-bit tests" echo " Skipped when running 8-bit tests"
else else
for opt in "" $jitopt; do for opt in "" $jitopt; do
$sim $valgrind ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput11 testtry $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput11 testtry
checkresult $? 11-$bits "$opt" checkresult $? 11-$bits "$opt"
done done
fi fi
@ -677,7 +685,7 @@ for bmode in "$test8" "$test16" "$test32"; do
echo " Skipped because UTF-$bits support is not available" echo " Skipped because UTF-$bits support is not available"
else else
for opt in "" $jitopt; do for opt in "" $jitopt; do
$sim $valgrind ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput12 testtry $sim $valgrind ${opt:+$vjs} ./pcre2test -q $defaultstack $bmode $opt $testdata/testinput12 testtry
checkresult $? 12-$bits "$opt" checkresult $? 12-$bits "$opt"
done done
fi fi
@ -734,7 +742,7 @@ for bmode in "$test8" "$test16" "$test32"; do
if [ $jit -eq 0 -o "$nojit" = "yes" ] ; then if [ $jit -eq 0 -o "$nojit" = "yes" ] ; then
echo " Skipped because JIT is not available or nojit was specified" echo " Skipped because JIT is not available or nojit was specified"
else else
$sim $valgrind ./pcre2test -q $defaultstack $bmode $testdata/testinput17 testtry $sim $valgrind $vjs ./pcre2test -q $defaultstack $bmode $testdata/testinput17 testtry
checkresult $? 17 "" checkresult $? 17 ""
fi fi
fi fi

View File

@ -13,8 +13,11 @@
# -noasan skip the test that uses -fsanitize=address # -noasan skip the test that uses -fsanitize=address
# -nousan skip the test that uses -fsanitize=undefined # -nousan skip the test that uses -fsanitize=undefined
# -nodebug skip the test that uses --enable-debug # -nodebug skip the test that uses --enable-debug
# -nojit skip JIT tests # -nojit skip all JIT tests
# -nojitmain skip non-valgrind JIT tests
# -nojitvalgrind skip JIT tests with valgrind
# -nomain skip the main set of tests # -nomain skip the main set of tests
# -nomainvalgrind skip the non-JIT valgrind tests
# -notmp skip the test in a temporary directory # -notmp skip the test in a temporary directory
# -novalgrind skip the valgrind tests # -novalgrind skip the valgrind tests
@ -25,7 +28,9 @@ useasan=1
useusan=1 useusan=1
usedebug=1 usedebug=1
usejit=1 usejit=1
usejitvalgrind=1
usemain=1 usemain=1
usemainvalgrind=1
usetmp=1 usetmp=1
usevalgrind=1 usevalgrind=1
verbose=0 verbose=0
@ -35,8 +40,11 @@ while [ $# -gt 0 ] ; do
-noasan) useasan=0;; -noasan) useasan=0;;
-nousan) useusan=0;; -nousan) useusan=0;;
-nodebug) usedebug=0;; -nodebug) usedebug=0;;
-nojit) usejit=0;; -nojit) usejit=0; usejitvalgrind=0;;
-nomain) usemain=0;; -nojitmain) usejit=0;;
-nojitvalgrind) usejitvalgrind=0;;
-nomain) usemain=0; usemainvalgrind=0;;
-nomainvalgrind) usemainvalgrind=0;;
-notmp) usetmp=0;; -notmp) usetmp=0;;
-novalgrind) usevalgrind=0;; -novalgrind) usevalgrind=0;;
-v) verbose=1;; -v) verbose=1;;
@ -45,6 +53,10 @@ while [ $# -gt 0 ] ; do
shift shift
done done
if [ $usejitvalgrind -eq 0 -a $usemainvalgrind -eq 0 ] ; then
usevalgrind=0
fi
# This is in case the caller has set aliases (as I do - PH) # This is in case the caller has set aliases (as I do - PH)
unset cp ls mv rm unset cp ls mv rm
@ -103,22 +115,21 @@ runtest()
fi fi
CFLAGS="$CFLAGS" \ CFLAGS="$CFLAGS" \
$srcdir/configure $opts >/dev/null 2>teststderr $srcdir/configure $opts >/dev/null 2>teststderrM
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo " " echo " "
echo "******** Error while configuring ********" echo "******** Error while configuring ********"
cat teststderr cat teststderrM
exit 1 exit 1
fi fi
echo "Making" echo "Making"
make -j >/dev/null 2>teststderr make -j >/dev/null 2>teststderrM
if [ $? -ne 0 -o -s teststderr ]; then if [ $? -ne 0 -o -s teststderrM ]; then
echo " " echo " "
echo "******** Errors or warnings while making ********" echo "******** Errors or warnings while making ********"
echo " " echo " "
cat teststderr cat teststderrM
exit 1 exit 1
fi fi
@ -132,23 +143,27 @@ runtest()
pcre2_8=$? pcre2_8=$?
echo "Running PCRE2 library tests $withvalgrind" echo "Running PCRE2 library tests $withvalgrind"
$srcdir/RunTest $valgrind >teststdout 2>teststderr $srcdir/RunTest $valgrind >teststdoutM 2>teststderrM
if [ $? -ne 0 -o -s teststderr ]; then
if [ $? -ne 0 -o -s teststderrM ]; then
echo " " echo " "
echo "**** Test failed ****" echo "**** Test failed ****"
cat teststderr if [ -s teststderrM ] ; then
if [ -s teststdout ] ; then cat teststdout; fi cat teststderrM
else
cat teststdoutM
fi
exit 1 exit 1
fi fi
if [ $pcre2_8 -gt 0 ]; then if [ $pcre2_8 -gt 0 ]; then
echo "Running pcre2grep tests $withvalgrind" echo "Running pcre2grep tests $withvalgrind"
$srcdir/RunGrepTest $valgrind >teststdout 2>teststderr $srcdir/RunGrepTest $valgrind >teststdoutM 2>teststderrM
if [ $? -ne 0 -o -s teststderr ]; then if [ $? -ne 0 -o -s teststderrM ]; then
echo " " echo " "
echo "**** Test failed ****" echo "**** Test failed ****"
cat teststderr cat teststderrM
cat teststdout cat teststdoutM
exit 1 exit 1
fi fi
else else
@ -157,12 +172,12 @@ runtest()
if [ "$jit" -gt 0 ]; then if [ "$jit" -gt 0 ]; then
echo "Running JIT regression tests $withvalgrind" echo "Running JIT regression tests $withvalgrind"
$cvalgrind $srcdir/pcre2_jit_test >teststdout 2>teststderr $cvalgrind $srcdir/pcre2_jit_test >teststdoutM 2>teststderrM
if [ $? -ne 0 -o -s teststderr ]; then if [ $? -ne 0 -o -s teststderrM ]; then
echo " " echo " "
echo "**** Test failed ****" echo "**** Test failed ****"
cat teststderr cat teststderrM
cat teststdout cat teststdoutM
exit 1 exit 1
fi fi
else else
@ -180,9 +195,16 @@ testtotal=`expr 20 \* $usemain + \
1 \* $ISGCC \* $usemain \* $useasan + \ 1 \* $ISGCC \* $usemain \* $useasan + \
1 \* $ISGCC \* $usemain \* $useusan + \ 1 \* $ISGCC \* $usemain \* $useusan + \
13 \* $usejit + \ 13 \* $usejit + \
\( 3 + 2 \* $usejit \) \* $usevalgrind` 3 \* $usemainvalgrind + \
2 \* $usejitvalgrind`
testcount=0 testcount=0
if [ $testtotal -eq 0 ] ; then
echo "** No tests selected"
exit 1
fi
valgrind= valgrind=
cvalgrind= cvalgrind=
withvalgrind= withvalgrind=
@ -304,6 +326,7 @@ if [ $usevalgrind -ne 0 ]; then
cvalgrind="valgrind -q --smc-check=all" cvalgrind="valgrind -q --smc-check=all"
withvalgrind="with valgrind" withvalgrind="with valgrind"
if [ $usemainvalgrind -ne 0 ]; then
for opts in \ for opts in \
"--disable-stack-for-recursion --disable-shared" \ "--disable-stack-for-recursion --disable-shared" \
"--with-link-size=3 --enable-pcre2-16 --enable-pcre2-32 --disable-shared" \ "--with-link-size=3 --enable-pcre2-16 --enable-pcre2-32 --disable-shared" \
@ -312,8 +335,9 @@ if [ $usevalgrind -ne 0 ]; then
opts="--enable-valgrind $opts" opts="--enable-valgrind $opts"
runtest runtest
done done
fi
if [ $usejit -ne 0 ]; then if [ $usejitvalgrind -ne 0 ]; then
for opts in \ for opts in \
"--enable-jit --disable-shared" \ "--enable-jit --disable-shared" \
"--enable-jit --enable-pcre2-16 --enable-pcre2-32" "--enable-jit --enable-pcre2-16 --enable-pcre2-32"
@ -341,6 +365,7 @@ if [ -f Makefile ]; then
fi fi
fi fi
if [ $usetmp -ne 0 ]; then
echo "---------- Tests in the $tmp directory ----------" echo "---------- Tests in the $tmp directory ----------"
srcdir=`pwd` srcdir=`pwd`
export srcdir export srcdir
@ -360,7 +385,6 @@ if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi
if [ $usetmp -ne 0 ]; then
for opts in \ for opts in \
"--disable-shared" "--disable-shared"
do do
@ -369,8 +393,8 @@ if [ $usetmp -ne 0 ]; then
fi fi
echo "Removing $tmp" echo "Removing $tmp"
rm -rf $tmp rm -rf $tmp
rm -rf teststdoutM teststderrM
echo "All done" echo "All done"

7
testdata/valgrind-jit.supp vendored Normal file
View File

@ -0,0 +1,7 @@
{
name
Memcheck:Addr16
obj:*
obj:*
obj:*
}