Blame tests/run-reverse-sections-self.sh

Packit 032894
#! /bin/sh
Packit 032894
# Copyright (C) 2019 Red Hat, Inc.
Packit 032894
# This file is part of elfutils.
Packit 032894
#
Packit 032894
# This file is free software; you can redistribute it and/or modify
Packit 032894
# it under the terms of the GNU General Public License as published by
Packit 032894
# the Free Software Foundation; either version 3 of the License, or
Packit 032894
# (at your option) any later version.
Packit 032894
#
Packit 032894
# elfutils is distributed in the hope that it will be useful, but
Packit 032894
# WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 032894
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 032894
# GNU General Public License for more details.
Packit 032894
#
Packit 032894
# You should have received a copy of the GNU General Public License
Packit 032894
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 032894
Packit 032894
. $srcdir/test-subr.sh
Packit 032894
Packit 032894
test_reverse_self ()
Packit 032894
{
Packit 032894
  in_file="$1"
Packit 032894
  base_name="$(basename ${in_file})"
Packit 032894
  out_file="${base_name}.rev"
Packit 032894
  out_file_mmap="${out_file}.mmap"
Packit 032894
Packit 032894
  tempfiles ${out_file} ${out_file_mmap}
Packit 032894
Packit 032894
  # Reverse the offsets (the files should still be the same otherwise)
Packit 032894
  testrun ${abs_builddir}/elfcopy --reverse-offs ${in_file} ${out_file}
Packit 032894
  testrun ${abs_top_builddir}/src/elfcmp ${in_file} ${out_file}
Packit 032894
  testrun ${abs_top_builddir}/src/elflint --gnu ${out_file}
Packit 032894
  # An in-place nop will likely revert them back
Packit 032894
  testrun ${abs_builddir}/elfrdwrnop ${out_file}
Packit 032894
  testrun ${abs_top_builddir}/src/elfcmp ${in_file} ${out_file}
Packit 032894
  testrun ${abs_top_builddir}/src/elflint --gnu ${out_file}
Packit 032894
}
Packit 032894
Packit 032894
# Only really makes sense for ET_REL files, but try all, just to check
Packit 032894
# it also works if we keep the order for the allocated sections.
Packit 032894
for file in $self_test_files; do
Packit 032894
  test_reverse_self $file
Packit 032894
done
Packit 032894
Packit 032894
exit 0