packaging: update homepage url
[platform/upstream/elfutils.git] / tests / run-deleted.sh
1 #! /bin/bash
2 # Copyright (C) 2014 Red Hat, Inc.
3 # This file is part of elfutils.
4 #
5 # This file is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # elfutils is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 . $srcdir/backtrace-subr.sh
19
20 tempfiles deleted deleted-lib.so
21 cp -p ${abs_builddir}/deleted ${abs_builddir}/deleted-lib.so .
22
23 # We don't want to run the deleted process under valgrind then
24 # stack will see the valgrind process backtrace.
25 OLD_VALGRIND_CMD="$VALGRIND_CMD"
26 unset VALGRIND_CMD
27
28 pid=$(testrun ${abs_builddir}/deleted)
29 sleep 1
30 rm -f deleted deleted-lib.so
31 tempfiles bt bt.err
32
33 set VALGRIND_CMD="$OLD_VALGRIND_CMD"
34 # It may have non-zero exit code with:
35 # .../elfutils/src/stack: dwfl_thread_getframes tid 26376 at 0x4006c8 in .../elfutils/tests/deleted: no matching address range
36 testrun ${abs_top_builddir}/src/stack -p $pid 1>bt 2>bt.err || true
37 cat bt bt.err
38 kill -9 $pid
39 wait
40 check_native_unsupported bt.err deleted
41 if grep -q -E ': dwfl_linux_proc_attach pid ([[:digit:]]+): Function not implemented$' bt.err; then
42   echo >&2 deleted: OS not supported
43   exit 77
44 fi
45 # For PPC64 we need access to the OPD table which we get through the shdrs
46 # (see backends/ppc64_init.c) but for the deleted-lib we only have phdrs.
47 # So we don't have the name of the function. But since we should find
48 # the EH_FRAME through phdrs just fine, we can unwind into main.
49 if test "`uname -m`" != "ppc64"; then
50   grep -qw libfunc bt
51 fi
52 grep -qw main bt