Home | History | Annotate | Download | only in tests
      1 #! /bin/sh
      2 # Copyright (C) 2015 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 # Generate a file with merged .shstrtab/.strtab table.
     21 # strip and unstrip it. Check all files with elflint.
     22 
     23 # A random ET_EXEC file
     24 input=${abs_top_builddir}/tests/elfstrmerge
     25 merged=merged.elf
     26 stripped=${merged}.stripped
     27 debugfile=${merged}.debug
     28 remerged=remerged.elf
     29 
     30 tempfiles $merged $stripped $debugfile $remerged
     31 
     32 echo elflint $input
     33 testrun ${abs_top_builddir}/src/elflint --gnu $input
     34 echo elfstrmerge
     35 testrun ${abs_top_builddir}/tests/elfstrmerge -o $merged $input
     36 echo elflint $merged
     37 testrun ${abs_top_builddir}/src/elflint --gnu $merged
     38 echo strip
     39 testrun ${abs_top_builddir}/src/strip -o $stripped -f $debugfile $merged
     40 echo elflint $stripped
     41 testrun ${abs_top_builddir}/src/elflint --gnu $stripped
     42 echo elflint $debugfile
     43 testrun ${abs_top_builddir}/src/elflint --gnu -d $debugfile
     44 echo unstrip
     45 testrun ${abs_top_builddir}/src/unstrip -o $remerged $stripped $debugfile
     46 echo elflint $remerged
     47 testrun ${abs_top_builddir}/src/elflint --gnu $remerged
     48 echo elfcmp
     49 testrun ${abs_top_builddir}/src/elfcmp $merged $remerged
     50 
     51 # A random ET_REL file
     52 input=${abs_top_builddir}/tests/elfstrmerge.o
     53 merged=merged.elf
     54 stripped=${merged}.stripped
     55 debugfile=${merged}.debug
     56 remerged=remerged.elf
     57 
     58 tempfiles $merged $stripped $debugfile $remerged
     59 
     60 echo elflint $input
     61 testrun ${abs_top_builddir}/src/elflint --gnu $input
     62 echo elfstrmerge
     63 testrun ${abs_top_builddir}/tests/elfstrmerge -o $merged $input
     64 echo elflint $merged
     65 testrun ${abs_top_builddir}/src/elflint --gnu $merged
     66 echo strip
     67 testrun ${abs_top_builddir}/src/strip -o $stripped -f $debugfile $merged
     68 echo elflint $stripped
     69 testrun ${abs_top_builddir}/src/elflint --gnu $stripped
     70 echo elflint $debugfile
     71 testrun ${abs_top_builddir}/src/elflint --gnu -d $debugfile
     72 echo unstrip
     73 testrun ${abs_top_builddir}/src/unstrip -o $remerged $stripped $debugfile
     74 echo elflint $remerged
     75 testrun ${abs_top_builddir}/src/elflint --gnu $remerged
     76 echo elfcmp
     77 testrun ${abs_top_builddir}/src/elfcmp $merged $remerged
     78 
     79 exit 0
     80