Commit 968e6183 authored by yyanagisawa's avatar yyanagisawa Committed by Commit bot

Skip COFF timestamp difference.

Current deps diffs shows lots of files differs only first certain bytes on Windows.  They are COFF timestamp difference, and we do not usually need to check.  Let me skip showing them.

BUG=314403

Review-Url: https://codereview.chromium.org/2303063003
Cr-Commit-Position: refs/heads/master@{#417179}
parent 18144abd
......@@ -444,6 +444,24 @@ def diff_binary(first_filepath, second_filepath, file_len):
offset = 0
with open(first_filepath, 'rb') as lhs:
with open(second_filepath, 'rb') as rhs:
# Skip part of Win32 COFF header if timestamps are different.
#
# COFF header:
# 0 - 1: magic.
# 2 - 3: # sections.
# 4 - 7: timestamp.
# ....
COFF_HEADER_TO_COMPARE_SIZE = 8
if (sys.platform == 'win32' and first_filepath.endswith('.obj')
and file_len > COFF_HEADER_TO_COMPARE_SIZE):
rhs_data = rhs.read(COFF_HEADER_TO_COMPARE_SIZE)
lhs_data = lhs.read(COFF_HEADER_TO_COMPARE_SIZE)
if lhs_data[0:4] == rhs_data[0:4] and lhs_data[4:8] != rhs_data[4:8]:
offset += COFF_HEADER_TO_COMPARE_SIZE
else:
lhs.seek(0)
rhs.seek(0)
while True:
lhs_data = lhs.read(CHUNK_SIZE)
rhs_data = rhs.read(CHUNK_SIZE)
......@@ -558,7 +576,7 @@ def compare_deps(first_dir, second_dir, targets):
second_file = os.path.join(second_dir, d)
result = compare_files(first_file, second_file)
if result:
print('%-*s: %s' % (max_filepath_len, d, result))
print(' %-*s: %s' % (max_filepath_len, d, result))
def compare_build_artifacts(first_dir, second_dir, target_platform,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment