Imported Upstream version 0.155
[platform/upstream/elfutils.git] / tests / run-macro-test.sh
1 #! /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
33 testfiles testfile-macinfo testfile-macros
34
35 status=0
36
37 testrun ../src/readelf --debug-dump=info testfile-macinfo \
38         | grep macro_info > readelf.macros.out ||
39   { echo "*** failure readelf --debug-dump=info testfile-macinfo"; status=1; }
40 testrun_compare cat readelf.macros.out <<\EOF
41            macro_info           (sec_offset) 0
42 EOF
43
44 testrun ../src/readelf --debug-dump=info testfile-macros \
45         | grep GNU_macros > readelf.macros.out ||
46   { echo "*** failure readelf --debug-dump=info testfile-macros"; status=1; }
47 testrun_compare cat readelf.macros.out <<\EOF
48            GNU_macros           (sec_offset) 0
49 EOF
50
51 rm -f readelf.macros.out
52
53 exit $status