more horrible hacks to run_readelf_tests to pass with a newer readelf on 32-bit
authorEli Bendersky <eliben@gmail.com>
Fri, 16 Dec 2011 09:08:45 +0000 (11:08 +0200)
committerEli Bendersky <eliben@gmail.com>
Fri, 16 Dec 2011 09:08:45 +0000 (11:08 +0200)
tests/run_readelf_tests.py

index ca3b656be5121ec7b30bbb0bc403baef5dc8cbf8..5a5fbd7fd4790cb7ed875d5655b857e9b319c31b 100755 (executable)
@@ -13,6 +13,7 @@ from difflib import SequenceMatcher
 import logging
 import subprocess
 import tempfile
+import platform
 
 
 # Create a global logger object
@@ -121,7 +122,9 @@ def compare_output(s1, s2):
             flag_after_symtable = True
 
         # Compare ignoring whitespace
-        if lines1[i].split() != lines2[i].split():
+        lines1_parts = lines1[i].split()
+        lines2_parts = lines2[i].split()
+        if ''.join(lines1_parts) != ''.join(lines2_parts):
             ok = False
             sm = SequenceMatcher()
             sm.set_seqs(lines1[i], lines2[i])
@@ -132,6 +135,15 @@ def compare_output(s1, s2):
                 if (    len(changes) == 2 and changes[1][0] == 'delete' and
                         lines1[i][changes[1][1]] == '@'):
                     ok = True
+            elif 'at_const_value' in lines1[i]:
+                # On 32-bit machines, readelf doesn't correctly represent
+                # some boundary LEB128 numbers
+                num2 = int(lines2_parts[-1])
+                if num2 <= -2**31 and '32' in platform.architecture()[0]:
+                    ok = True
+            elif 'os/abi' in lines1[i]:
+                if 'unix - gnu' in lines1[i] and 'unix - linux' in lines2[i]:
+                    ok = True
             else: 
                 for s in ('t (tls)', 'l (large)'):
                     if s in lines1[i] or s in lines2[i]: