Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: tools/determinism/compare_build_artifacts.py

Issue 2337013002: .o could be COFF object. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Compare the artifacts from two builds.""" 6 """Compare the artifacts from two builds."""
7 7
8 import difflib 8 import difflib
9 import json 9 import json
10 import optparse 10 import optparse
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 with open(first_filepath, 'rb') as lhs: 445 with open(first_filepath, 'rb') as lhs:
446 with open(second_filepath, 'rb') as rhs: 446 with open(second_filepath, 'rb') as rhs:
447 # Skip part of Win32 COFF header if timestamps are different. 447 # Skip part of Win32 COFF header if timestamps are different.
448 # 448 #
449 # COFF header: 449 # COFF header:
450 # 0 - 1: magic. 450 # 0 - 1: magic.
451 # 2 - 3: # sections. 451 # 2 - 3: # sections.
452 # 4 - 7: timestamp. 452 # 4 - 7: timestamp.
453 # .... 453 # ....
454 COFF_HEADER_TO_COMPARE_SIZE = 8 454 COFF_HEADER_TO_COMPARE_SIZE = 8
455 if (sys.platform == 'win32' and first_filepath.endswith('.obj') 455 if (sys.platform == 'win32'
456 and os.path.splitext(first_filepath)[1] in ('.obj', '.o')
M-A Ruel 2016/09/13 14:20:22 I would prefer '.o', '.obj' so they are in order.
Yoshisato Yanagisawa 2016/09/14 01:04:36 Done.
456 and file_len > COFF_HEADER_TO_COMPARE_SIZE): 457 and file_len > COFF_HEADER_TO_COMPARE_SIZE):
457 rhs_data = rhs.read(COFF_HEADER_TO_COMPARE_SIZE) 458 rhs_data = rhs.read(COFF_HEADER_TO_COMPARE_SIZE)
458 lhs_data = lhs.read(COFF_HEADER_TO_COMPARE_SIZE) 459 lhs_data = lhs.read(COFF_HEADER_TO_COMPARE_SIZE)
459 if lhs_data[0:4] == rhs_data[0:4] and lhs_data[4:8] != rhs_data[4:8]: 460 if lhs_data[0:4] == rhs_data[0:4] and lhs_data[4:8] != rhs_data[4:8]:
460 offset += COFF_HEADER_TO_COMPARE_SIZE 461 offset += COFF_HEADER_TO_COMPARE_SIZE
461 else: 462 else:
462 lhs.seek(0) 463 lhs.seek(0)
463 rhs.seek(0) 464 rhs.seek(0)
464 465
465 while True: 466 while True:
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 parser.error('--target-platform is required') 676 parser.error('--target-platform is required')
676 677
677 return compare_build_artifacts(os.path.abspath(options.first_build_dir), 678 return compare_build_artifacts(os.path.abspath(options.first_build_dir),
678 os.path.abspath(options.second_build_dir), 679 os.path.abspath(options.second_build_dir),
679 options.target_platform, 680 options.target_platform,
680 options.recursive) 681 options.recursive)
681 682
682 683
683 if __name__ == '__main__': 684 if __name__ == '__main__':
684 sys.exit(main()) 685 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698