- Handle unknown ELF files as different.

OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=213
This commit is contained in:
Olaf Hering 2016-08-05 13:48:32 +00:00 committed by Git OBS Bridge
parent 3866a3faff
commit 5bf4ce3659
3 changed files with 23 additions and 14 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Fri Aug 5 13:44:51 UTC 2016 - olaf@aepfle.de
- Handle unknown ELF files as different.
-------------------------------------------------------------------
Wed Apr 6 07:06:58 UTC 2016 - olaf@aepfle.de

View File

@ -16,14 +16,12 @@
#
%define version_unconverted 20160406T155640.b74db7f
Name: build-compare
Summary: Build Result Compare Script
License: GPL-2.0+
Group: Development/Tools/Building
Url: https://github.com/openSUSE/build-compare
Version: 20160406T155640.b74db7f
Version: 20160805T154520.57bb571
Release: 0
Source1: COPYING
Source2: same-build-result.sh

View File

@ -20,6 +20,8 @@ if test "$#" != 2; then
exit 1
fi
test -z $OBJDUMP && OBJDUMP=objdump
# Always clean up on exit
local_tmpdir=`mktemp -d`
if test -z "${local_tmpdir}"
@ -111,7 +113,8 @@ function unjar_l()
filter_disasm()
{
sed -e 's/^ *[0-9a-f]\+://' -e 's/\$0x[0-9a-f]\+/$something/' -e 's/callq *[0-9a-f]\+/callq /' -e 's/# *[0-9a-f]\+/# /' -e 's/\(0x\)\?[0-9a-f]\+(/offset(/' -e 's/[0-9a-f]\+ </</' -e 's/^<\(.*\)>:/\1:/' -e 's/<\(.*\)+0x[0-9a-f]\+>/<\1 + ofs>/'
local file=$1
sed -i -e 's/^ *[0-9a-f]\+://' -e 's/\$0x[0-9a-f]\+/$something/' -e 's/callq *[0-9a-f]\+/callq /' -e 's/# *[0-9a-f]\+/# /' -e 's/\(0x\)\?[0-9a-f]\+(/offset(/' -e 's/[0-9a-f]\+ </</' -e 's/^<\(.*\)>:/\1:/' -e 's/<\(.*\)+0x[0-9a-f]\+>/<\1 + ofs>/' ${file}
}
echo "Comparing `basename $oldpkg` to `basename $newpkg`"
@ -715,18 +718,21 @@ check_single_file()
fi
;;
ELF*executable*|ELF*[LM]SB\ relocatable*|ELF*[LM]SB\ shared\ object*)
objdump -d --no-show-raw-insn old/$file | filter_disasm > $file1
if ! test -s $file1; then
$OBJDUMP -d --no-show-raw-insn old/$file > $file1
ret=$?
$OBJDUMP -d --no-show-raw-insn new/$file > $file2
if test ${ret}$? != 00 ; then
# objdump has no idea how to handle it
if ! diff_two_files; then
ret=1
break
return 1
fi
fi
elfdiff=
return 0
fi
filter_disasm $file1
filter_disasm $file2
sed -i -e "s,old/,," $file1
objdump -d --no-show-raw-insn new/$file | filter_disasm > $file2
sed -i -e "s,new/,," $file2
elfdiff=
if ! diff -u $file1 $file2 > $dfile; then
echo "$file differs in assembler output"
head -n 200 $dfile
@ -735,10 +741,10 @@ check_single_file()
echo "" >$file1
echo "" >$file2
# Don't compare .build-id and .gnu_debuglink sections
sections="$(objdump -s new/$file | grep "Contents of section .*:" | sed -r "s,.* (.*):,\1,g" | grep -v -e "\.build-id" -e "\.gnu_debuglink" | tr "\n" " ")"
sections="$($OBJDUMP -s new/$file | grep "Contents of section .*:" | sed -r "s,.* (.*):,\1,g" | grep -v -e "\.build-id" -e "\.gnu_debuglink" | tr "\n" " ")"
for section in $sections; do
objdump -s -j $section old/$file | sed "s,^old/,," > $file1
objdump -s -j $section new/$file | sed "s,^new/,," > $file2
$OBJDUMP -s -j $section old/$file | sed "s,^old/,," > $file1
$OBJDUMP -s -j $section new/$file | sed "s,^new/,," > $file2
if ! diff -u $file1 $file2 > $dfile; then
echo "$file differs in ELF section $section"
head -n 200 $dfile