1#! /bin/sh
2# Copyright (C) 2013 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/test-subr.sh
19
20# See run-readelf-dwz-multi.sh
21testfiles libtestfile_multi_shared.so testfile_multi_main testfile_multi.dwz
22testfiles testfile-dwzstr testfile-dwzstr.multi
23
24testrun_compare ${abs_builddir}/allfcts testfile_multi_main libtestfile_multi_shared.so testfile-dwzstr <<\EOF
25/home/mark/src/tests/dwz/main.c:3:main
26/home/mark/src/tests/dwz/shared.c:3:call_foo
27/home/mark/src/tests/main.c:8:main
28EOF
29
30# - test-offset-loop.c
31#
32# #include <stdbool.h>
33# #include <string.h>
34# #include <errno.h>
35# void padding (int x, int y, int z) { }
36# static inline bool is_error (int err) { return err != 0; }
37# static inline int get_errno (void) { return errno; }
38# int main () { return is_error (get_errno ()); }
39#
40# gcc -g -O2 test-offset-loop.c -o test-offset-loop
41# cp test-offset-loop test-offset-loop2
42# dwz test-offset-loop test-offset-loop2 -m test-offset-loop.alt
43
44testfiles test-offset-loop test-offset-loop.alt
45tempfiles allfcts.out
46
47# Use head to capture output because the output could be infinite...
48testrun ${abs_builddir}/allfcts test-offset-loop | head -n 20 > allfcts.out
49testrun_compare cat allfcts.out <<\EOF
50/tmp/test-offset-loop.c:6:get_errno
51/tmp/test-offset-loop.c:5:is_error
52/tmp/test-offset-loop.c:4:padding
53/tmp/test-offset-loop.c:7:main
54EOF
55
56exit 0
57