[Pcre-svn] [367] code/trunk: Create a suppressions file for …

トップ ページ
このメッセージを削除
著者: Subversion repository
日付:  
To: pcre-svn
題目: [Pcre-svn] [367] code/trunk: Create a suppressions file for valgrind with JIT.
Revision: 367
          http://www.exim.org/viewvc/pcre2?view=rev&revision=367
Author:   ph10
Date:     2015-09-11 17:56:47 +0100 (Fri, 11 Sep 2015)
Log Message:
-----------
Create a suppressions file for valgrind with JIT.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/RunTest
    code/trunk/maint/ManyConfigTests


Added Paths:
-----------
    code/trunk/testdata/valgrind-jit.supp


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2015-09-09 09:21:38 UTC (rev 366)
+++ code/trunk/ChangeLog    2015-09-11 16:56:47 UTC (rev 367)
@@ -179,7 +179,12 @@
 scripts were modified. The pcre2grep tests can now also be run when there is no 
 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
--------------------------


Modified: code/trunk/RunTest
===================================================================
--- code/trunk/RunTest    2015-09-09 09:21:38 UTC (rev 366)
+++ code/trunk/RunTest    2015-09-11 16:56:47 UTC (rev 367)
@@ -157,7 +157,7 @@


 checkspecial()
   {
-  $valgrind ./pcre2test $1 >>testtry
+  $valgrind  $vjs ./pcre2test $1 >>testtry
   if [ $? -ne 0 ] ; then
     echo "** pcre2test $1 failed - check testtry"
     exit 1
@@ -194,6 +194,7 @@
 sim=
 skip=
 valgrind=
+vjs=


# This is in case the caller has set aliases (as I do - PH)
unset cp ls mv rm
@@ -377,11 +378,18 @@
$sim ./pcre2test -C unicode >/dev/null
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=
 $sim ./pcre2test -C jit >/dev/null
 jit=$?
 if [ $jit -ne 0 -a "$nojit" != "yes" ] ; then
   jitopt=-jit
+  if [ "$valgrind" != "" ] ; then
+    vjs="--suppressions=$testdata/valgrind-jit.supp"
+  fi   
 fi


 # If no specific tests were requested, select all. Those that are not
@@ -459,7 +467,7 @@
   if [ $do1 = yes ] ; then
     echo $title1
     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"
     done
   fi
@@ -469,7 +477,7 @@
   if [ $do2 = yes ] ; then
     echo $title2 "(excluding UTF-$bits)"
     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
         checkresult $? 2 "$opt"
       else
@@ -529,7 +537,7 @@
     if [ "$locale" != "" ] ; then
       echo $title3 "(using '$locale' locale)"
       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
           case "$opt" in
             -jit) with=" with JIT";;
@@ -566,7 +574,7 @@
       echo "  Skipped because UTF-$bits support is not available"
     else
       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"
       done
     fi
@@ -578,7 +586,7 @@
       echo "  Skipped because UTF-$bits support is not available"
     else
       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"
       done
     fi
@@ -630,7 +638,7 @@
       echo "  Skipped when running 16/32-bit tests"
     else
       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"
       done
     fi
@@ -646,7 +654,7 @@
       echo "  Skipped because UTF-$bits support is not available"
     else
       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"
       done
     fi
@@ -660,7 +668,7 @@
       echo "  Skipped when running 8-bit tests"
     else
       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"
       done
     fi
@@ -677,7 +685,7 @@
       echo "  Skipped because UTF-$bits support is not available"
     else
       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"
       done
     fi
@@ -734,7 +742,7 @@
     if [ $jit -eq 0 -o "$nojit" = "yes" ] ; then
       echo "  Skipped because JIT is not available or nojit was specified"
     else
-      $sim $valgrind ./pcre2test -q $defaultstack $bmode $testdata/testinput17 testtry
+      $sim $valgrind $vjs ./pcre2test -q $defaultstack $bmode $testdata/testinput17 testtry
       checkresult $? 17 ""
     fi
   fi


Modified: code/trunk/maint/ManyConfigTests
===================================================================
--- code/trunk/maint/ManyConfigTests    2015-09-09 09:21:38 UTC (rev 366)
+++ code/trunk/maint/ManyConfigTests    2015-09-11 16:56:47 UTC (rev 367)
@@ -10,13 +10,16 @@
 # tests, in order to run those that are giving errors. The following options
 # do this:
 #
-# -noasan      skip the test that uses -fsanitize=address
-# -nousan      skip the test that uses -fsanitize=undefined
-# -nodebug     skip the test that uses --enable-debug
-# -nojit       skip JIT tests
-# -nomain      skip the main set of tests
-# -notmp       skip the test in a temporary directory
-# -novalgrind  skip the valgrind tests
+# -noasan         skip the test that uses -fsanitize=address
+# -nousan         skip the test that uses -fsanitize=undefined
+# -nodebug        skip the test that uses --enable-debug
+# -nojit          skip all JIT tests
+# -nojitmain      skip non-valgrind JIT tests
+# -nojitvalgrind  skip JIT tests with valgrind
+# -nomain         skip the main set of tests
+# -nomainvalgrind skip the non-JIT valgrind tests
+# -notmp          skip the test in a temporary directory
+# -novalgrind     skip the valgrind tests


# The -v option causes a call to 'pcre2test -C' to happen for each
# configuration.
@@ -25,7 +28,9 @@
useusan=1
usedebug=1
usejit=1
+usejitvalgrind=1
usemain=1
+usemainvalgrind=1
usetmp=1
usevalgrind=1
verbose=0
@@ -32,19 +37,26 @@

 while [ $# -gt 0 ] ; do
   case $1 in
-    -noasan)       useasan=0;;
-    -nousan)       useusan=0;; 
-    -nodebug)      usedebug=0;; 
-    -nojit)        usejit=0;;
-    -nomain)       usemain=0;;
-    -notmp)        usetmp=0;;
-    -novalgrind)   usevalgrind=0;;
-    -v)            verbose=1;;
-    *)             echo "Unknown option '$1'"; exit 1;;
+    -noasan)         useasan=0;;
+    -nousan)         useusan=0;;
+    -nodebug)        usedebug=0;;
+    -nojit)          usejit=0; usejitvalgrind=0;;
+    -nojitmain)      usejit=0;;
+    -nojitvalgrind)  usejitvalgrind=0;;
+    -nomain)         usemain=0; usemainvalgrind=0;;
+    -nomainvalgrind) usemainvalgrind=0;;
+    -notmp)          usetmp=0;;
+    -novalgrind)     usevalgrind=0;;
+    -v)              verbose=1;;
+    *)               echo "Unknown option '$1'"; exit 1;;
   esac
   shift
 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)

unset cp ls mv rm
@@ -103,22 +115,21 @@
fi

   CFLAGS="$CFLAGS" \
-    $srcdir/configure $opts >/dev/null 2>teststderr
-
+    $srcdir/configure $opts >/dev/null 2>teststderrM
   if [ $? -ne 0 ]; then
     echo " "
     echo "******** Error while configuring ********"
-    cat teststderr
+    cat teststderrM
     exit 1
   fi


   echo "Making"
-  make -j >/dev/null 2>teststderr
-  if [ $? -ne 0 -o -s teststderr ]; then
+  make -j >/dev/null 2>teststderrM
+  if [ $? -ne 0 -o -s teststderrM ]; then
     echo " "
     echo "******** Errors or warnings while making ********"
     echo " "
-    cat teststderr
+    cat teststderrM
     exit 1
   fi


@@ -132,23 +143,27 @@
pcre2_8=$?

   echo "Running PCRE2 library tests $withvalgrind"
-  $srcdir/RunTest $valgrind >teststdout 2>teststderr
-  if [ $? -ne 0 -o -s teststderr ]; then
+  $srcdir/RunTest $valgrind >teststdoutM 2>teststderrM
+
+  if [ $? -ne 0 -o -s teststderrM ]; then
     echo " "
     echo "**** Test failed ****"
-    cat teststderr
-    if [ -s teststdout ] ; then cat teststdout; fi
+    if [ -s teststderrM ] ; then
+      cat teststderrM
+    else
+      cat teststdoutM
+    fi
     exit 1
   fi


   if [ $pcre2_8 -gt 0 ]; then
     echo "Running pcre2grep tests $withvalgrind"
-    $srcdir/RunGrepTest $valgrind >teststdout 2>teststderr
-    if [ $? -ne 0 -o -s teststderr ]; then
+    $srcdir/RunGrepTest $valgrind >teststdoutM 2>teststderrM
+    if [ $? -ne 0 -o -s teststderrM ]; then
       echo " "
       echo "**** Test failed ****"
-      cat teststderr
-      cat teststdout
+      cat teststderrM
+      cat teststdoutM
       exit 1
     fi
   else
@@ -157,12 +172,12 @@


   if [ "$jit" -gt 0 ]; then
     echo "Running JIT regression tests $withvalgrind"
-    $cvalgrind $srcdir/pcre2_jit_test >teststdout 2>teststderr
-    if [ $? -ne 0 -o -s teststderr ]; then
+    $cvalgrind $srcdir/pcre2_jit_test >teststdoutM 2>teststderrM
+    if [ $? -ne 0 -o -s teststderrM ]; then
       echo " "
       echo "**** Test failed ****"
-      cat teststderr
-      cat teststdout
+      cat teststderrM
+      cat teststdoutM
       exit 1
     fi
   else
@@ -180,9 +195,16 @@
   1 \* $ISGCC \* $usemain \* $useasan + \
   1 \* $ISGCC \* $usemain \* $useusan + \
   13 \* $usejit + \
-  \( 3 + 2 \* $usejit \) \* $usevalgrind`
+  3 \* $usemainvalgrind + \
+  2 \* $usejitvalgrind`
+
 testcount=0


+if [ $testtotal -eq 0 ] ; then
+  echo "** No tests selected"
+  exit 1
+fi
+
 valgrind=
 cvalgrind=
 withvalgrind=
@@ -244,7 +266,7 @@
     echo "---------- Maximally configured test with --enable-debug ----------"
     opts="--disable-shared $enable_jit --enable-pcre2-16 --enable-pcre2-32 --enable-debug"
     runtest
-  fi   
+  fi


echo "---------- Non-JIT tests in the current directory ----------"
for opts in \
@@ -304,16 +326,18 @@
cvalgrind="valgrind -q --smc-check=all"
withvalgrind="with valgrind"

-  for opts in \
-    "--disable-stack-for-recursion --disable-shared" \
-    "--with-link-size=3 --enable-pcre2-16 --enable-pcre2-32 --disable-shared" \
-    "--disable-unicode --disable-shared"
-  do
-    opts="--enable-valgrind $opts"
-    runtest
-  done
+  if [ $usemainvalgrind -ne 0 ]; then
+    for opts in \
+      "--disable-stack-for-recursion --disable-shared" \
+      "--with-link-size=3 --enable-pcre2-16 --enable-pcre2-32 --disable-shared" \
+      "--disable-unicode --disable-shared"
+    do
+      opts="--enable-valgrind $opts"
+      runtest
+    done
+  fi


-  if [ $usejit -ne 0 ]; then
+  if [ $usejitvalgrind -ne 0 ]; then
     for opts in \
       "--enable-jit --disable-shared" \
       "--enable-jit --enable-pcre2-16 --enable-pcre2-32"
@@ -341,26 +365,26 @@
   fi
 fi


-echo "---------- Tests in the $tmp directory ----------"
-srcdir=`pwd`
-export srcdir
+if [ $usetmp -ne 0 ]; then
+ echo "---------- Tests in the $tmp directory ----------"
+ srcdir=`pwd`
+ export srcdir

-if [ ! -e $tmp ]; then
-  mkdir $tmp
-fi
+  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
+  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
+  cd $tmp
+  if [ $? -ne 0 ]; then
+    echo "** Failed to cd to $tmp"
+    exit 1
+  fi


-if [ $usetmp -ne 0 ]; then
   for opts in \
     "--disable-shared"
   do
@@ -369,8 +393,8 @@
 fi


echo "Removing $tmp"
-
rm -rf $tmp
+rm -rf teststdoutM teststderrM

echo "All done"


Added: code/trunk/testdata/valgrind-jit.supp
===================================================================
--- code/trunk/testdata/valgrind-jit.supp                            (rev 0)
+++ code/trunk/testdata/valgrind-jit.supp    2015-09-11 16:56:47 UTC (rev 367)
@@ -0,0 +1,7 @@
+{
+   name
+   Memcheck:Addr16
+   obj:*
+   obj:*
+   obj:*
+}