Skip to content

Commit

Permalink
run_dwarfdump_test.py: add a comment to explain the special case.
Browse files Browse the repository at this point in the history
  • Loading branch information
Noam Yorav-Raphael committed Sep 4, 2023
1 parent b9b449d commit 38da969
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/run_dwarfdump_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,16 @@ def compare_output(s1, s2):
and errmsg is empty. Otherwise success is False and errmsg holds a
description of the mismatch.
"""
def remove_zero_address_symbol(s):
return s.replace('(0x0000000000000000 ".text")', '(0x0000000000000000)')
# llvm-dwarfdump sometimes adds a comment to addresses. We still haven't invested the
# effort to understand exactly when. For now, removing the section comment helps us pass
# the test.
s1 = s1.replace('(0x0000000000000000 ".text")', '(0x0000000000000000)')

def prepare_lines(s):
return [line for line in s.lower().splitlines() if line.strip() != '']

lines1 = prepare_lines(remove_zero_address_symbol(s1))
lines2 = prepare_lines(remove_zero_address_symbol(s2))
lines1 = prepare_lines(s1)
lines2 = prepare_lines(s2)

if len(lines1) != len(lines2):
return False, 'Number of lines different: %s vs %s' % (
Expand Down

0 comments on commit 38da969

Please sign in to comment.