From a5a354b9d7d4ca8c912945dd708ab465aec67c7f Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 2 Dec 2015 17:27:18 +0100 Subject: [PATCH] tests: Use valgrind --leak-check=full. 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 --- tests/ChangeLog | 8 ++++++++ tests/Makefile.am | 2 +- tests/run-backtrace-demangle.sh | 11 +++++++++++ tests/run-stack-d-test.sh | 10 ++++++++++ tests/run-stack-demangled-test.sh | 10 ++++++++++ tests/run-stack-i-test.sh | 10 ++++++++++ 6 files changed, 50 insertions(+), 1 deletion(-) diff --git a/tests/ChangeLog b/tests/ChangeLog index 4c56400..2940e38 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,11 @@ +2015-12-02 Mark Wielaard + + * 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 * test-flag-nobits.c (main): Call elf_end. diff --git a/tests/Makefile.am b/tests/Makefile.am index 30cf137..0077c0f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 diff --git a/tests/run-backtrace-demangle.sh b/tests/run-backtrace-demangle.sh index 71a7351..2d25324 100755 --- a/tests/run-backtrace-demangle.sh +++ b/tests/run-backtrace-demangle.sh @@ -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 diff --git a/tests/run-stack-d-test.sh b/tests/run-stack-d-test.sh index 4198201..a9f0380 100755 --- a/tests/run-stack-d-test.sh +++ b/tests/run-stack-d-test.sh @@ -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<