Home | History | Annotate | Download | only in tests
      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 tempfiles readelf.macros.out
     35 
     36 status=0
     37 
     38 testrun ${abs_top_builddir}/src/readelf --debug-dump=info testfile-macinfo \
     39 	| grep macro_info > readelf.macros.out ||
     40   { echo "*** failure readelf --debug-dump=info testfile-macinfo"; status=1; }
     41 testrun_compare cat readelf.macros.out <<\EOF
     42            macro_info           (sec_offset) 0
     43 EOF
     44 
     45 testrun ${abs_top_builddir}/src/readelf --debug-dump=info testfile-macros \
     46 	| grep GNU_macros > readelf.macros.out ||
     47   { echo "*** failure readelf --debug-dump=info testfile-macros"; status=1; }
     48 testrun_compare cat readelf.macros.out <<\EOF
     49            GNU_macros           (sec_offset) 0
     50 EOF
     51 
     52 exit $status
     53