]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
tests: Use valgrind --leak-check=full.
authorMark Wielaard <mjw@redhat.com>
Wed, 2 Dec 2015 16:27:18 +0000 (17:27 +0100)
committerMark Wielaard <mjw@redhat.com>
Sat, 2 Jan 2016 19:37:45 +0000 (20:37 +0100)
When --enable-valgrind is given run the testsuite with --leak-check=full
treating any memory leak as a failure. Also disable valgrind for those
tests that trigger a valgrind bug.
https://bugs.kde.org/show_bug.cgi?id=327427

Signed-off-by: Mark Wielaard <mjw@redhat.com>
tests/ChangeLog
tests/Makefile.am
tests/run-backtrace-demangle.sh
tests/run-stack-d-test.sh
tests/run-stack-demangled-test.sh
tests/run-stack-i-test.sh

index 4c56400cf7e19c30c4f086183be241dd1fd30151..2940e3829b8d4565ea9e7e162f70154ffa24d74c 100644 (file)
@@ -1,3 +1,11 @@
+2015-12-02  Mark Wielaard  <mjw@redhat.com>
+
+       * Makefile.am (valgrind_cmd): Use --leak-check=full.
+       * run-backtrace-demangle.sh: Disable valgrind.
+       * run-stack-demangled-test.sh: Likewise.
+       * run-stack-d-test.sh: Likewise.
+       * run-stack-i-test.sh: Likewise.
+
 2015-12-01  Mark Wielaard  <mjw@redhat.com>
 
        * test-flag-nobits.c (main): Call elf_end.
index 30cf137c60e7c2ce1814c09a505ba3a0e746a889..0077c0f59b393475bc845bb3acce8a5bab3ef488 100644 (file)
@@ -307,7 +307,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
             run-lfs-symbols.sh lfs-symbols testfile-nolfs.bz2
 
 if USE_VALGRIND
-valgrind_cmd='valgrind -q --error-exitcode=1 --run-libc-freeres=no'
+valgrind_cmd='valgrind -q --leak-check=full --error-exitcode=1'
 endif
 
 
index 71a7351816b5e21291a2a09c62ebba3cccd68004..2d2532400da8dd21a3d9dbe447598e881bbf122f 100755 (executable)
@@ -26,6 +26,11 @@ child=testfile-backtrace-demangle
 testfiles $child{,.core}
 tempfiles $child.{bt,err}
 
+# Disable valgrind while dumping because of a bug unmapping libc.so.
+# https://bugs.kde.org/show_bug.cgi?id=327427
+SAVED_VALGRIND_CMD="$VALGRIND_CMD"
+unset VALGRIND_CMD
+
 # There can be more than 3 frames, but depending on the system/installed
 # glibc we might not be able to unwind fully till the end.
 # cxxfunc -> f -> main
@@ -33,6 +38,12 @@ tempfiles $child.{bt,err}
 # (exit code 1)
 testrun ${abs_top_builddir}/src/stack -n 2 -e $child --core $child.core >$child.bt 2>$child.err || exitcode=$?
 cat $child.{bt,err}
+
+if [ "x$SAVED_VALGRIND_CMD" != "x" ]; then
+  VALGRIND_CMD="$SAVED_VALGRIND_CMD"
+  export VALGRIND_CMD
+fi
+
 if test $exitcode != 1 || ! grep "shown max number of frames" $child.err; then
   echo >&2 $2: expected more than 2 frames
   false
index 41982014d1f88a726b36694cd1d2a8db98a60ebf..a9f03806fc5e4a53bfb2d36f791565fbbca347e2 100755 (executable)
@@ -68,6 +68,11 @@ else
 STACKCMD=${abs_top_builddir}/src/stack
 fi
 
+# Disable valgrind while dumping because of a bug unmapping libc.so.
+# https://bugs.kde.org/show_bug.cgi?id=327427
+SAVED_VALGRIND_CMD="$VALGRIND_CMD"
+unset VALGRIND_CMD
+
 # Without -d the top function comes out as fu. Use --raw to not demangle.
 testrun_compare ${abs_top_builddir}/src/stack -r -n 2 -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
 PID 13654 - core
@@ -109,4 +114,9 @@ TID 13654:
 $STACKCMD: tid 13654: shown max number of frames (2, use -n 0 for unlimited)
 EOF
 
+if [ "x$SAVED_VALGRIND_CMD" != "x" ]; then
+  VALGRIND_CMD="$SAVED_VALGRIND_CMD"
+  export VALGRIND_CMD
+fi
+
 exit 0
index 98f8ff8efc1979ffa338391f4953203455e11ba3..c26918f9f5c21cff6638857afec08d3fccbf4abc 100755 (executable)
@@ -37,6 +37,11 @@ else
 STACKCMD=${abs_top_builddir}/src/stack
 fi
 
+# Disable valgrind while dumping because of a bug unmapping libc.so.
+# https://bugs.kde.org/show_bug.cgi?id=327427
+SAVED_VALGRIND_CMD="$VALGRIND_CMD"
+unset VALGRIND_CMD
+
 # Without -d the top function comes out as fu.
 testrun_compare ${abs_top_builddir}/src/stack -n 2 -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
 PID 13654 - core
@@ -92,4 +97,9 @@ TID 13654:
 $STACKCMD: tid 13654: shown max number of frames (6, use -n 0 for unlimited)
 EOF
 
+if [ "x$SAVED_VALGRIND_CMD" != "x" ]; then
+  VALGRIND_CMD="$SAVED_VALGRIND_CMD"
+  export VALGRIND_CMD
+fi
+
 exit 0
index ffab85f9a39a5662b9671ecd4a109b1e5361b71c..3722ab09112f8fa6bd5dca7bd96d793abfa281aa 100755 (executable)
@@ -29,6 +29,11 @@ else
 STACKCMD=${abs_top_builddir}/src/stack
 fi
 
+# Disable valgrind while dumping because of a bug unmapping libc.so.
+# https://bugs.kde.org/show_bug.cgi?id=327427
+SAVED_VALGRIND_CMD="$VALGRIND_CMD"
+unset VALGRIND_CMD
+
 # Compare with run-stack-d-test.sh to see the output without --inlines.
 # Only two call frames are visible (there is a jump from main to fu or
 # fubar). Explicitly use --raw so demangler support being configured in
@@ -68,4 +73,9 @@ TID 13654:
 $STACKCMD: tid 13654: shown max number of frames (6, use -n 0 for unlimited)
 EOF
 
+if [ "x$SAVED_VALGRIND_CMD" != "x" ]; then
+  VALGRIND_CMD="$SAVED_VALGRIND_CMD"
+  export VALGRIND_CMD
+fi
+
 exit 0