summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog28
-rw-r--r--tests/Makefile.am6
-rw-r--r--tests/addrcfi.c17
-rw-r--r--tests/addrscopes.c1
-rw-r--r--tests/alldts.c3
-rw-r--r--tests/allregs.c1
-rw-r--r--tests/backtrace.sparc.core.bz2bin0 -> 9628 bytes
-rwxr-xr-xtests/backtrace.sparc.exec.bz2bin0 -> 348964 bytes
-rw-r--r--tests/dwarf-getstring.c1
-rw-r--r--tests/funcscopes.c1
-rw-r--r--tests/rerequest_tag.c1
-rwxr-xr-xtests/run-backtrace-core-sparc.sh20
-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
-rw-r--r--tests/test-flag-nobits.c3
17 files changed, 117 insertions, 6 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 69a25fc6..b8d1d954 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,31 @@
+2015-12-08 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ * run-backtrace-core-sparc.sh: New file.
+ * backtrace.sparc.core.bz2: New file.
+ * backtrace.sparc.exec.bz2: New file.
+ * Makefile.am (EXTRA_DIST): ... and added all here.
+ (TESTS): Added run-backtrace-core-sparc.sh.
+
+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.
+ * rerequest_tag.c (main): Call dwarf_end.
+ * funcscopes.c (handle_function): Free scopes.
+ * dwarf-getstring.c (main): Call dwarf_end.
+ * allregs.c (main): Free state.info.
+ * alldts.c (main): Free dyn.
+ * addrcfi.c (handle_address): Free stuff.frame between handle_cfi
+ calls.
+ * addrscopes.c (handle_address): Free scopes.
+
2015-10-16 Mark Wielaard <mjw@redhat.com>
* Makefile.am [BUILD_STATIC] (libdw): Add -lz.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 30cf137c..8fca8014 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -114,7 +114,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
run-backtrace-core-x32.sh \
run-backtrace-core-i386.sh run-backtrace-core-ppc.sh \
run-backtrace-core-s390x.sh run-backtrace-core-s390.sh \
- run-backtrace-core-aarch64.sh \
+ run-backtrace-core-aarch64.sh run-backtrace-core-sparc.sh \
run-backtrace-demangle.sh run-stack-d-test.sh run-stack-i-test.sh \
run-stack-demangled-test.sh \
run-readelf-dwz-multi.sh run-allfcts-multi.sh run-deleted.sh \
@@ -287,6 +287,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
run-backtrace-core-s390x.sh run-backtrace-core-s390.sh \
run-backtrace-core-aarch64.sh \
backtrace.aarch64.core.bz2 backtrace.aarch64.exec.bz2 \
+ run-backtrace-core-sparc.sh \
+ backtrace.sparc.core.bz2 backtrace.sparc.exec.bz2 \
run-backtrace-demangle.sh testfile-backtrace-demangle.bz2 \
testfile-backtrace-demangle.cc \
testfile-backtrace-demangle.core.bz2 \
@@ -307,7 +309,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/addrcfi.c b/tests/addrcfi.c
index eb950c0b..589b8513 100644
--- a/tests/addrcfi.c
+++ b/tests/addrcfi.c
@@ -160,10 +160,19 @@ handle_address (GElf_Addr pc, Dwfl *dwfl)
Dwfl_Module *mod = dwfl_addrmodule (dwfl, pc);
struct stuff stuff;
- return (handle_cfi (dwfl, ".eh_frame",
- dwfl_module_eh_cfi (mod, &stuff.bias), pc, &stuff)
- & handle_cfi (dwfl, ".debug_frame",
- dwfl_module_dwarf_cfi (mod, &stuff.bias), pc, &stuff));
+ stuff.frame = NULL;
+ stuff.bias = 0;
+ int res = handle_cfi (dwfl, ".eh_frame",
+ dwfl_module_eh_cfi (mod, &stuff.bias), pc, &stuff);
+ free (stuff.frame);
+
+ stuff.frame = NULL;
+ stuff.bias = 0;
+ res &= handle_cfi (dwfl, ".debug_frame",
+ dwfl_module_dwarf_cfi (mod, &stuff.bias), pc, &stuff);
+ free (stuff.frame);
+
+ return res;
}
int
diff --git a/tests/addrscopes.c b/tests/addrscopes.c
index 2285d2ca..791569f5 100644
--- a/tests/addrscopes.c
+++ b/tests/addrscopes.c
@@ -134,6 +134,7 @@ handle_address (GElf_Addr pc, Dwfl *dwfl)
print_vars (indent + INDENT, die);
}
+ free (scopes);
}
}
diff --git a/tests/alldts.c b/tests/alldts.c
index c39b8fb6..eaecaf57 100644
--- a/tests/alldts.c
+++ b/tests/alldts.c
@@ -256,6 +256,9 @@ main (void)
/* And the data allocated in the .shstrtab section. */
free (data->d_buf);
+ /* And the dynamic entries. */
+ free (dyn);
+
/* All done. */
if (elf_end (elf) != 0)
{
diff --git a/tests/allregs.c b/tests/allregs.c
index 901d4e88..286f7e3c 100644
--- a/tests/allregs.c
+++ b/tests/allregs.c
@@ -184,6 +184,7 @@ main (int argc, char **argv)
dwarf_encoding_string (state.info[i].type),
state.info[i].bits);
}
+ free (state.info);
}
else
do
diff --git a/tests/backtrace.sparc.core.bz2 b/tests/backtrace.sparc.core.bz2
new file mode 100644
index 00000000..ad37f75c
--- /dev/null
+++ b/tests/backtrace.sparc.core.bz2
Binary files differ
diff --git a/tests/backtrace.sparc.exec.bz2 b/tests/backtrace.sparc.exec.bz2
new file mode 100755
index 00000000..b049ec50
--- /dev/null
+++ b/tests/backtrace.sparc.exec.bz2
Binary files differ
diff --git a/tests/dwarf-getstring.c b/tests/dwarf-getstring.c
index 824edef8..ffa3e375 100644
--- a/tests/dwarf-getstring.c
+++ b/tests/dwarf-getstring.c
@@ -70,6 +70,7 @@ main (int argc, char *argv[])
offset += len + 1;
}
+ dwarf_end (dbg);
close (fd);
}
diff --git a/tests/funcscopes.c b/tests/funcscopes.c
index 55cb4fac..9c901858 100644
--- a/tests/funcscopes.c
+++ b/tests/funcscopes.c
@@ -162,6 +162,7 @@ handle_function (Dwarf_Die *funcdie, void *arg)
print_vars (indent + INDENT, die);
}
+ free (scopes);
}
return 0;
diff --git a/tests/rerequest_tag.c b/tests/rerequest_tag.c
index d0bf5f24..b4d46271 100644
--- a/tests/rerequest_tag.c
+++ b/tests/rerequest_tag.c
@@ -42,5 +42,6 @@ main (int argc, char **argv)
assert (die == &die_mem);
assert (dwarf_tag (die) == 0);
+ dwarf_end (dw);
return 0;
}
diff --git a/tests/run-backtrace-core-sparc.sh b/tests/run-backtrace-core-sparc.sh
new file mode 100755
index 00000000..60399baa
--- /dev/null
+++ b/tests/run-backtrace-core-sparc.sh
@@ -0,0 +1,20 @@
+#! /bin/bash
+# Copyright (C) 2015 Oracle, Inc.
+# This file is part of elfutils.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# elfutils is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. $srcdir/backtrace-subr.sh
+
+check_core sparc
diff --git a/tests/run-backtrace-demangle.sh b/tests/run-backtrace-demangle.sh
index 71a73518..2d253240 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 41982014..a9f03806 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 98f8ff8e..c26918f9 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 ffab85f9..3722ab09 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
diff --git a/tests/test-flag-nobits.c b/tests/test-flag-nobits.c
index ff19ce20..15d44ea8 100644
--- a/tests/test-flag-nobits.c
+++ b/tests/test-flag-nobits.c
@@ -36,4 +36,7 @@ main (int argc, char **argv)
Elf_Scn *scn = NULL;
while ((scn = elf_nextscn (stripped, scn)) != NULL)
elf_flagdata (elf_getdata (scn, NULL), ELF_C_SET, ELF_F_DIRTY);
+
+ elf_end (stripped);
+ return 0;
}