- 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 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 Name: build-compare
Summary: Build Result Compare Script Summary: Build Result Compare Script
License: GPL-2.0+ License: GPL-2.0+
Group: Development/Tools/Building Group: Development/Tools/Building
Url: https://github.com/openSUSE/build-compare Url: https://github.com/openSUSE/build-compare
Version: 20160406T155640.b74db7f Version: 20160805T154520.57bb571
Release: 0 Release: 0
Source1: COPYING Source1: COPYING
Source2: same-build-result.sh Source2: same-build-result.sh

View File

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