summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2015-05-01 10:31:36 +0200
committerMark Wielaard <[email protected]>2015-05-01 10:40:06 +0200
commite6e80dae42a030f56b6aa0a92514130e78f43d72 (patch)
tree617eb374e49cd725b34a084fbfb0dbfa75f0a2de
parent7702a3c1060247a0389fa684454c749e29acf663 (diff)
tests: Split run-stack tests to support missing demangler.
SKIP tests that need a demangler if it is not there. Signed-off-by: Mark Wielaard <[email protected]>
-rw-r--r--ChangeLog4
-rw-r--r--configure.ac4
-rw-r--r--tests/ChangeLog8
-rw-r--r--tests/Makefile.am2
-rwxr-xr-xtests/run-stack-d-test.sh14
-rwxr-xr-xtests/run-stack-demangled-test.sh94
-rwxr-xr-xtests/run-stack-i-test.sh13
7 files changed, 125 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index dc206483..1a11c6d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2015-05-01 Mark Wielaard <[email protected]>
+ * configure.ac (DEMANGLE): Explicitly set enable_demangler.
+
+2015-05-01 Mark Wielaard <[email protected]>
+
* configure.ac (debugpred): Use and set use_debugpred_val.
(textrelcheck): Explicitly set enable_textrelcheck to yes or no.
(symbol-versioning): Likewise for enable_symbol_versioning.
diff --git a/configure.ac b/configure.ac
index 876600d3..0ba3db36 100644
--- a/configure.ac
+++ b/configure.ac
@@ -235,6 +235,8 @@ AC_SUBST([zip_LIBS])
AC_CHECK_LIB([stdc++], [__cxa_demangle], [dnl
AC_DEFINE([USE_DEMANGLE], [1], [Defined if demangling is enabled])])
AM_CONDITIONAL(DEMANGLE, test "$ac_cv_lib_stdcpp___cxa_demangle" = yes)
+AS_IF([test "$ac_cv_lib_stdcpp___cxa_demangle" = yes]
+ [enable_demangler=yes],[enable_demangler=no])
AC_ARG_ENABLE([textrelcheck],
AS_HELP_STRING([--disable-textrelcheck],
@@ -378,7 +380,7 @@ AC_MSG_NOTICE([
gzip support : ${with_zlib}
bzip2 support : ${with_bzlib}
lzma/xz support : ${with_lzma}
- libstdc++ demangle support : ${ac_cv_lib_stdcpp___cxa_demangle}
+ libstdc++ demangle support : ${enable_demangler}
File textrel check : ${enable_textrelcheck}
Symbol versioning : ${enable_symbol_versioning}
diff --git a/tests/ChangeLog b/tests/ChangeLog
index b6861849..0556b1fa 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,11 @@
+2015-05-01 Mark Wielaard <[email protected]>
+
+ * run-stack-d-test.sh: Use --raw and mangled output.
+ * run-stack-i-test.sh: Likewise.
+ * run-stack-demangled-test.sh: New test.
+ * Makefile.am (EXTRA_DIST): Add run-stack-demangled-test.sh.
+ (TESTS): Likewise.
+
2015-04-01 H.J. Lu <[email protected]>
* Makefile.am (TESTS): Add run-strip-test10.sh.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 45bb74df..f94bd67e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -113,6 +113,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
run-backtrace-core-s390x.sh run-backtrace-core-s390.sh \
run-backtrace-core-aarch64.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 \
run-linkmap-cut.sh run-aggregate-size.sh vdsosyms run-readelf-A.sh \
run-getsrc-die.sh run-strptr.sh newdata elfstrtab
@@ -282,6 +283,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
testfile-backtrace-demangle.cc \
testfile-backtrace-demangle.core.bz2 \
run-stack-d-test.sh run-stack-i-test.sh \
+ run-stack-demangled-test.sh \
testfiledwarfinlines.bz2 testfiledwarfinlines.core.bz2 \
run-readelf-zdebug.sh testfile-debug.bz2 testfile-zdebug.bz2 \
run-deleted.sh run-linkmap-cut.sh linkmap-cut-lib.so.bz2 \
diff --git a/tests/run-stack-d-test.sh b/tests/run-stack-d-test.sh
index 040c2fa9..41982014 100755
--- a/tests/run-stack-d-test.sh
+++ b/tests/run-stack-d-test.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2014 Red Hat, Inc.
+# Copyright (C) 2014, 2015 Red Hat, Inc.
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
@@ -68,21 +68,21 @@ else
STACKCMD=${abs_top_builddir}/src/stack
fi
-# Without -d the top function comes out as fu.
-testrun_compare ${abs_top_builddir}/src/stack -n 2 -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
+# 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
TID 13654:
-#0 0x00000000004006c8 fu(int)
+#0 0x00000000004006c8 _Z2fui
#1 0x00000000004004c5 main
$STACKCMD: tid 13654: shown max number of frames (2, use -n 0 for unlimited)
EOF
# But when asking for source we see it is actually on line 6.
-# (Which is in function fubar, not fu).
-testrun_compare ${abs_top_builddir}/src/stack -n 2 -s -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
+# (Which is in function fubar, not fu). Use --raw to not demangle.
+testrun_compare ${abs_top_builddir}/src/stack -r -n 2 -s -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
PID 13654 - core
TID 13654:
-#0 0x00000000004006c8 fu(int)
+#0 0x00000000004006c8 _Z2fui
/home/mark/src/tests/dwarfinlines.cpp:6
#1 0x00000000004004c5 main
/home/mark/src/tests/dwarfinlines.cpp:39
diff --git a/tests/run-stack-demangled-test.sh b/tests/run-stack-demangled-test.sh
new file mode 100755
index 00000000..0d9f8f3e
--- /dev/null
+++ b/tests/run-stack-demangled-test.sh
@@ -0,0 +1,94 @@
+#! /bin/sh
+# Copyright (C) 2014, 2015 Red Hat, 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/>.
+
+if test -n "$ELFUTILS_DISABLE_DEMANGLE"; then
+ exit 77
+fi
+
+. $srcdir/test-subr.sh
+
+# See run-stack-d-test.sh and run-stack-i-test.sh
+# Same tests, now with demangler support, no -r, and without -d.
+# Only change in output is an explit fu(int) instead of _Z2fui.
+
+testfiles testfiledwarfinlines testfiledwarfinlines.core
+
+# Depending on whether we are running make check or make installcheck
+# the actual binary name under test might be different. It is used in
+# the error message, which we also try to match.
+if test "$elfutils_testrun" = "installed"; then
+STACKCMD=${bindir}/`program_transform stack`
+else
+STACKCMD=${abs_top_builddir}/src/stack
+fi
+
+# 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
+TID 13654:
+#0 0x00000000004006c8 fu(int)
+#1 0x00000000004004c5 main
+$STACKCMD: tid 13654: shown max number of frames (2, use -n 0 for unlimited)
+EOF
+
+# But when asking for source we see it is actually on line 6.
+# (Which is in function fubar, not fu).
+testrun_compare ${abs_top_builddir}/src/stack -n 2 -s -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
+PID 13654 - core
+TID 13654:
+#0 0x00000000004006c8 fu(int)
+ /home/mark/src/tests/dwarfinlines.cpp:6
+#1 0x00000000004004c5 main
+ /home/mark/src/tests/dwarfinlines.cpp:39
+$STACKCMD: tid 13654: shown max number of frames (2, use -n 0 for unlimited)
+EOF
+
+# With --inlines we get all inlined calls. Note they share the same
+# address.
+testrun_compare ${abs_top_builddir}/src/stack -n 6 -i -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
+PID 13654 - core
+TID 13654:
+#0 0x00000000004006c8 fubar
+#1 0x00000000004006c8 foobar
+#2 0x00000000004006c8 bar
+#3 0x00000000004006c8 foo
+#4 0x00000000004006c8 fu(int)
+#5 0x00000000004004c5 main
+$STACKCMD: tid 13654: shown max number of frames (6, use -n 0 for unlimited)
+EOF
+
+# With --source we can also see where in the source the inlined frames
+# where originally called from.
+testrun_compare ${abs_top_builddir}/src/stack -n 6 -s -i -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
+PID 13654 - core
+TID 13654:
+#0 0x00000000004006c8 fubar
+ /home/mark/src/tests/dwarfinlines.cpp:6
+#1 0x00000000004006c8 foobar
+ /home/mark/src/tests/dwarfinlines.cpp:14
+#2 0x00000000004006c8 bar
+ /home/mark/src/tests/dwarfinlines.cpp:21
+#3 0x00000000004006c8 foo
+ /home/mark/src/tests/dwarfinlines.cpp:27
+#4 0x00000000004006c8 fu(int)
+ /home/mark/src/tests/dwarfinlines.cpp:33
+#5 0x00000000004004c5 main
+ /home/mark/src/tests/dwarfinlines.cpp:39
+$STACKCMD: tid 13654: shown max number of frames (6, use -n 0 for unlimited)
+EOF
+
+exit 0
diff --git a/tests/run-stack-i-test.sh b/tests/run-stack-i-test.sh
index 2d09ec0d..ffab85f9 100755
--- a/tests/run-stack-i-test.sh
+++ b/tests/run-stack-i-test.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2014 Red Hat, Inc.
+# Copyright (C) 2014, 2015 Red Hat, Inc.
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
@@ -31,25 +31,26 @@ fi
# 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).
+# fubar). Explicitly use --raw so demangler support being configured in
+# doesn't change the results.
# With --inlines we get all inlined calls. Note they share the same
# address.
-testrun_compare ${abs_top_builddir}/src/stack -n 6 -i -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
+testrun_compare ${abs_top_builddir}/src/stack -r -n 6 -i -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
PID 13654 - core
TID 13654:
#0 0x00000000004006c8 fubar
#1 0x00000000004006c8 foobar
#2 0x00000000004006c8 bar
#3 0x00000000004006c8 foo
-#4 0x00000000004006c8 fu(int)
+#4 0x00000000004006c8 _Z2fui
#5 0x00000000004004c5 main
$STACKCMD: tid 13654: shown max number of frames (6, use -n 0 for unlimited)
EOF
# With --source we can also see where in the source the inlined frames
# where originally called from.
-testrun_compare ${abs_top_builddir}/src/stack -n 6 -s -i -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
+testrun_compare ${abs_top_builddir}/src/stack -r -n 6 -s -i -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
PID 13654 - core
TID 13654:
#0 0x00000000004006c8 fubar
@@ -60,7 +61,7 @@ TID 13654:
/home/mark/src/tests/dwarfinlines.cpp:21
#3 0x00000000004006c8 foo
/home/mark/src/tests/dwarfinlines.cpp:27
-#4 0x00000000004006c8 fu(int)
+#4 0x00000000004006c8 _Z2fui
/home/mark/src/tests/dwarfinlines.cpp:33
#5 0x00000000004004c5 main
/home/mark/src/tests/dwarfinlines.cpp:39