Blame tests/run-reverse-sections.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 ()
Packit 032894
{
Packit 032894
  in_file="$1"
Packit 032894
  out_file="${in_file}.rev"
Packit 032894
  out_file_mmap="${out_file}.mmap"
Packit 032894
Packit 032894
  testfiles ${in_file}
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
# A collection of random testfiles to test 32/64bit, little/big endian
Packit 032894
# and non-ET_REL (with phdrs)/ET_REL (without phdrs).
Packit 032894
Packit 032894
# 32bit, big endian, rel
Packit 032894
test_reverse testfile29
Packit 032894
Packit 032894
# 64bit, big endian, rel
Packit 032894
test_reverse testfile23
Packit 032894
Packit 032894
# 32bit, little endian, rel
Packit 032894
test_reverse testfile9
Packit 032894
Packit 032894
# 64bit, little endian, rel
Packit 032894
test_reverse testfile38
Packit 032894
Packit 032894
# 32bit, big endian, non-rel
Packit 032894
test_reverse testfile26
Packit 032894
Packit 032894
# 64bit, big endian, non-rel
Packit 032894
test_reverse testfile27
Packit 032894
Packit 032894
# 32bit, little endian, non-rel
Packit 032894
test_reverse testfile
Packit 032894
Packit 032894
# 64bit, little endian, non-rel
Packit 032894
# Don't use testfile10. It has section headers in the middle of the file.
Packit 032894
# Same for testfile12. It is legal, but not the point of this testcase.
Packit 032894
# test_reverse testfile10
Packit 032894
test_reverse testfile13
Packit 032894
Packit 032894
exit 0