blob: 79b0d8817617de3b6c68960a6bb493dd613a859c [file] [log] [blame]
Mark Wielaarda0172d72012-06-25 17:18:53 +02001#! /bin/sh
2# Copyright (C) 2012 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# #include <string.h>
21#
22# #define HELLO "world"
23#
24# int
25# main(int argc, char ** argv)
26# {
27# return strlen (HELLO);
28# }
29#
30# gcc -gdwarf-4 -g3 -o testfile-macros macro.c
31# gcc -gstrict-dwarf -gdwarf-4 -g3 -o testfile-macinfo macro.c
32
33testfiles testfile-macinfo testfile-macros
Mark Wielaarda6098312013-04-26 21:21:56 +020034tempfiles readelf.macros.out
Mark Wielaarda0172d72012-06-25 17:18:53 +020035
36status=0
37
Mark Wielaard86be7922013-04-26 23:44:25 +020038testrun ${abs_top_builddir}/src/readelf --debug-dump=info testfile-macinfo \
Mark Wielaarda0172d72012-06-25 17:18:53 +020039 | grep macro_info > readelf.macros.out ||
40 { echo "*** failure readelf --debug-dump=info testfile-macinfo"; status=1; }
41testrun_compare cat readelf.macros.out <<\EOF
42 macro_info (sec_offset) 0
43EOF
44
Mark Wielaard86be7922013-04-26 23:44:25 +020045testrun ${abs_top_builddir}/src/readelf --debug-dump=info testfile-macros \
Mark Wielaarda0172d72012-06-25 17:18:53 +020046 | grep GNU_macros > readelf.macros.out ||
47 { echo "*** failure readelf --debug-dump=info testfile-macros"; status=1; }
48testrun_compare cat readelf.macros.out <<\EOF
49 GNU_macros (sec_offset) 0
50EOF
51
Mark Wielaarda0172d72012-06-25 17:18:53 +020052exit $status