Blame tests/run-backtrace-demangle.sh

Packit 032894
#! /bin/bash
Packit 032894
# Copyright (C) 2014, 2015 Red Hat, Inc.
Packit 032894
# This file is part of elfutils.
Packit 032894
#
Packit 032894
# This file is free software; you can redistribute it and/or modify
Packit 032894
# it under the terms of the GNU General Public License as published by
Packit 032894
# the Free Software Foundation; either version 3 of the License, or
Packit 032894
# (at your option) any later version.
Packit 032894
#
Packit 032894
# elfutils is distributed in the hope that it will be useful, but
Packit 032894
# WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 032894
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 032894
# GNU General Public License for more details.
Packit 032894
#
Packit 032894
# You should have received a copy of the GNU General Public License
Packit 032894
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 032894
Packit 032894
if test -n "$ELFUTILS_DISABLE_DEMANGLE"; then
Packit 032894
  echo "demangler unsupported"
Packit 032894
  exit 77
Packit 032894
fi
Packit 032894
Packit 032894
. $srcdir/backtrace-subr.sh
Packit 032894
Packit 032894
child=testfile-backtrace-demangle
Packit 032894
testfiles $child{,.core}
Packit 032894
tempfiles $child.{bt,err}
Packit 032894
Packit 032894
# Disable valgrind while dumping because of a bug unmapping libc.so.
Packit 032894
# https://bugs.kde.org/show_bug.cgi?id=327427
Packit 032894
SAVED_VALGRIND_CMD="$VALGRIND_CMD"
Packit 032894
unset VALGRIND_CMD
Packit 032894
Packit 032894
# There can be more than 3 frames, but depending on the system/installed
Packit 032894
# glibc we might not be able to unwind fully till the end.
Packit 032894
# cxxfunc -> f -> main
Packit 032894
# Expect to see the top two and a warning that there are more frames
Packit 032894
# (exit code 1)
Packit 032894
testrun ${abs_top_builddir}/src/stack -n 2 -e $child --core $child.core >$child.bt 2>$child.err || exitcode=$?
Packit 032894
cat $child.{bt,err}
Packit 032894
Packit 032894
if [ "x$SAVED_VALGRIND_CMD" != "x" ]; then
Packit 032894
  VALGRIND_CMD="$SAVED_VALGRIND_CMD"
Packit 032894
  export VALGRIND_CMD
Packit 032894
fi
Packit 032894
Packit 032894
if test $exitcode != 1 || ! grep "shown max number of frames" $child.err; then
Packit 032894
  echo >&2 $2: expected more than 2 frames
Packit 032894
  false
Packit 032894
fi
Packit 032894
if ! grep -w f $child.bt; then
Packit 032894
  echo >&2 $2: no f
Packit 032894
  false
Packit 032894
fi
Packit 032894
if ! grep ' cxxfunc(int)' $child.bt; then
Packit 032894
  echo >&2 $2: no cxxfunc
Packit 032894
  false
Packit 032894
fi