From: eliben Date: Sun, 27 Nov 2011 08:22:08 +0000 (+0200) Subject: added some more exceptions to the test runner, to account for differences in readelf... X-Git-Tag: v0.10~64 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e6cd8a5cc77d43a35d70fadabef7404e5b3db344;p=pyelftools.git added some more exceptions to the test runner, to account for differences in readelf versions --- diff --git a/tests/run_readelf_tests.py b/tests/run_readelf_tests.py index 9142c1d..acb4964 100755 --- a/tests/run_readelf_tests.py +++ b/tests/run_readelf_tests.py @@ -105,6 +105,7 @@ def compare_output(s1, s2): # Compare ignoring whitespace if lines1[i].split() != lines2[i].split(): + ok = False sm = SequenceMatcher() sm.set_seqs(lines1[i], lines2[i]) changes = sm.get_opcodes() @@ -113,7 +114,7 @@ def compare_output(s1, s2): # symbol name. if ( len(changes) == 2 and changes[1][0] == 'delete' and lines1[i][changes[1][1]] == '@'): - continue + ok = True elif 'dw_op' in lines1[i] and 'reg' in lines1[i]: # readelf decodes register names, we don't do that. no_worries = False @@ -122,14 +123,16 @@ def compare_output(s1, s2): re.search('\(\w+', lines1[i][change[1]:change[2]])): no_worries = True if no_worries: - continue - - else: - print changes - print lines1[i][changes[3][1]:changes[3][2]] - errmsg = 'Mismatch on line #%s:\n>>%s<<\n>>%s<<\n' % ( + ok = True + else: + for s in ('t (tls)', 'l (large)'): + if s in lines1[i] or s in lines2[i]: + ok = True + break + if not ok: + errmsg = 'Mismatch on line #%s:\n>>%s<<\n>>%s<<\n' % ( i, lines1[i], lines2[i]) - return False, errmsg + return False, errmsg return True, '' @@ -182,6 +185,8 @@ def main(): if __name__ == '__main__': + import os + os.chdir('..') main() #testlog.info(list(discover_testfiles('tests/testfiles'))) #print run_exe('scripts/readelf.py', ['-h', 'tests/testfiles/z32.o.elf'])