2 # Copyright (C) 2013 Red Hat, Inc.
3 # This file is part of elfutils.
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.
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.
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/>.
18 . $srcdir/test-subr.sh
20 # See run-readelf-dwz-multi.sh
21 testfiles libtestfile_multi_shared.so testfile_multi_main testfile_multi.dwz
22 testfiles testfile-dwzstr testfile-dwzstr.multi
24 testrun_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
30 # - test-offset-loop.c
32 # #include <stdbool.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 ()); }
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
44 testfiles test-offset-loop test-offset-loop.alt
47 # Use head to capture output because the output could be infinite...
48 testrun ${abs_builddir}/allfcts test-offset-loop | head -n 20 > allfcts.out
49 testrun_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
56 # allfcts has a too simple mechanism for setting the alt file.
57 # check that if we don't set it, things still work (because libdw will
58 # find the alt file for us).
60 mv test-offset-loop test-offset-loop.alt subdir/
61 testrun ${abs_builddir}/allfcts subdir/test-offset-loop > allfcts.out
62 testrun_compare cat allfcts.out <<\EOF
63 Warning: no alt file found.
64 /tmp/test-offset-loop.c:6:get_errno
65 /tmp/test-offset-loop.c:5:is_error
66 /tmp/test-offset-loop.c:4:padding
67 /tmp/test-offset-loop.c:7:main