summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2015-12-02 17:27:18 +0100
committerMark Wielaard <mjw@redhat.com>2016-01-02 20:37:45 +0100
commita5a354b9d7d4ca8c912945dd708ab465aec67c7f (patch)
treee05653b125492a22cff831051afcabc825c190d5
parent8bbfc552a062e47e307a897e49f2a4a25ba6291e (diff)
downloadelfutils-a5a354b9d7d4ca8c912945dd708ab465aec67c7f.tar.gz
elfutils-a5a354b9d7d4ca8c912945dd708ab465aec67c7f.tar.xz
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 <mjw@redhat.com>
-rw-r--r--tests/ChangeLog8
-rw-r--r--tests/Makefile.am2
-rwxr-xr-xtests/run-backtrace-demangle.sh11
-rwxr-xr-xtests/run-stack-d-test.sh10
-rwxr-xr-xtests/run-stack-demangled-test.sh10
-rwxr-xr-xtests/run-stack-i-test.sh10
6 files changed, 50 insertions, 1 deletions
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 <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.
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<<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
diff --git a/tests/run-stack-demangled-test.sh b/tests/run-stack-demangled-test.sh
index 98f8ff8..c26918f 100755
--- a/tests/run-stack-demangled-test.sh
+++ b/tests/run-stack-demangled-test.sh
@@ -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
diff --git a/tests/run-stack-i-test.sh b/tests/run-stack-i-test.sh
index ffab85f..3722ab0 100755
--- a/tests/run-stack-i-test.sh
+++ b/tests/run-stack-i-test.sh
@@ -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