Blame tests/run-strip-test-many.sh

Packit 032894
#! /bin/sh
Packit 032894
# Copyright (C) 2018 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
status=0
Packit 032894
Packit 032894
# Use the original file from run-strip-test.sh but with many sections
Packit 032894
testfiles testfile
Packit 032894
tempfiles testfile1.strip testfile2.strip testfile1.debug testfile2.debug testfile.unstrip
Packit 032894
Packit 032894
echo "Adding sections to testfile"
Packit 032894
testrun ${abs_builddir}/addsections 65535 testfile ||
Packit 032894
{ echo "*** failure addsections testfile"; status=1; }
Packit 032894
Packit 032894
echo "Testing strip -o"
Packit 032894
testrun ${abs_top_builddir}/src/strip -o testfile1.strip -f testfile1.debug testfile ||
Packit 032894
{ echo "*** failure strip -o"; status=1; }
Packit 032894
Packit 032894
# Do the parts check out?
Packit 032894
echo "elflint testfile1.strip"
Packit 032894
testrun ${abs_top_builddir}/src/elflint --gnu -q testfile1.strip ||
Packit 032894
{ echo "*** failure elflint testfile1.strip"; status=1; }
Packit 032894
Packit 032894
echo "elflint testfile1.debug"
Packit 032894
testrun ${abs_top_builddir}/src/elflint --gnu -q -d testfile1.debug ||
Packit 032894
{ echo "*** failure elflint testfile1.debug"; status=1; }
Packit 032894
Packit 032894
# Now test unstrip recombining those files.
Packit 032894
echo "unstrip"
Packit 032894
testrun ${abs_top_builddir}/src/unstrip -o testfile.unstrip testfile1.strip testfile1.debug ||
Packit 032894
{ echo "*** failure unstrip"; status=1; }
Packit 032894
Packit 032894
echo "elfcmp"
Packit 032894
testrun ${abs_top_builddir}/src/elfcmp testfile testfile.unstrip ||
Packit 032894
{ echo "*** failure elfcmp"; status=1; }
Packit 032894
Packit 032894
# test strip -g
Packit 032894
echo "Testing strip -g"
Packit 032894
testrun ${abs_top_builddir}/src/strip -g -o testfile2.strip -f testfile2.debug testfile ||
Packit 032894
{ echo "*** failure strip -g"; status=1; }
Packit 032894
Packit 032894
# Do the parts check out?
Packit 032894
echo "elflint testfile2.strip"
Packit 032894
testrun ${abs_top_builddir}/src/elflint --gnu -q testfile2.strip ||
Packit 032894
{ echo "*** failure elflint testfile2.strip"; status=1; }
Packit 032894
Packit 032894
echo "elflint testfile2.debug"
Packit 032894
testrun ${abs_top_builddir}/src/elflint --gnu -q -d testfile2.debug ||
Packit 032894
{ echo "*** failure elflint testfile2.debug"; status=1; }
Packit 032894
Packit 032894
# Now strip "in-place" and make sure it is smaller.
Packit 032894
echo "Testing strip in-place"
Packit 032894
SIZE_original=$(stat -c%s testfile)
Packit 032894
echo "original size $SIZE_original"
Packit 032894
Packit 032894
testrun ${abs_top_builddir}/src/strip testfile ||
Packit 032894
{ echo "*** failure strip in-place"; status=1; }
Packit 032894
Packit 032894
SIZE_stripped=$(stat -c%s testfile)
Packit 032894
echo "stripped size $SIZE_stripped"
Packit 032894
test $SIZE_stripped -lt $SIZE_original ||
Packit 032894
  { echo "*** failure in-place strip file not smaller $original"; exit 1; }
Packit 032894
Packit 032894
echo "elflint in-place"
Packit 032894
testrun ${abs_top_builddir}/src/elflint --gnu -q testfile ||
Packit 032894
{ echo "*** failure elflint in-place"; status=1; }
Packit 032894
Packit 032894
exit $status