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

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

Issue 2337013002: .o could be COFF object. (Closed)
Patch Set: rebase + changed .o and .obj order 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 # 2 - 3: # sections. 450 # 2 - 3: # sections.
451 # 4 - 7: timestamp. 451 # 4 - 7: timestamp.
452 # .... 452 # ....
453 # 453 #
454 # COFF BigObj header: 454 # COFF BigObj header:
455 # 0 - 3: signature (0000 FFFF) 455 # 0 - 3: signature (0000 FFFF)
456 # 4 - 5: version 456 # 4 - 5: version
457 # 6 - 7: machine 457 # 6 - 7: machine
458 # 8 - 11: timestamp. 458 # 8 - 11: timestamp.
459 COFF_HEADER_TO_COMPARE_SIZE = 12 459 COFF_HEADER_TO_COMPARE_SIZE = 12
460 if (sys.platform == 'win32' and first_filepath.endswith('.obj') 460 if (sys.platform == 'win32'
461 and os.path.splitext(first_filepath)[1] in ('.o', '.obj')
461 and file_len > COFF_HEADER_TO_COMPARE_SIZE): 462 and file_len > COFF_HEADER_TO_COMPARE_SIZE):
462 rhs_data = rhs.read(COFF_HEADER_TO_COMPARE_SIZE) 463 rhs_data = rhs.read(COFF_HEADER_TO_COMPARE_SIZE)
463 lhs_data = lhs.read(COFF_HEADER_TO_COMPARE_SIZE) 464 lhs_data = lhs.read(COFF_HEADER_TO_COMPARE_SIZE)
464 if (lhs_data[0:4] == rhs_data[0:4] and lhs_data[4:8] != rhs_data[4:8] 465 if (lhs_data[0:4] == rhs_data[0:4] and lhs_data[4:8] != rhs_data[4:8]
465 and lhs_data[8:12] == rhs_data[8:12]): 466 and lhs_data[8:12] == rhs_data[8:12]):
466 offset += COFF_HEADER_TO_COMPARE_SIZE 467 offset += COFF_HEADER_TO_COMPARE_SIZE
467 elif (lhs_data[0:4] == '\x00\x00\xff\xff' and 468 elif (lhs_data[0:4] == '\x00\x00\xff\xff' and
468 lhs_data[0:8] == rhs_data[0:8] and 469 lhs_data[0:8] == rhs_data[0:8] and
469 lhs_data[8:12] != rhs_data[8:12]): 470 lhs_data[8:12] != rhs_data[8:12]):
470 offset += COFF_HEADER_TO_COMPARE_SIZE 471 offset += COFF_HEADER_TO_COMPARE_SIZE
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 parser.error('--target-platform is required') 686 parser.error('--target-platform is required')
686 687
687 return compare_build_artifacts(os.path.abspath(options.first_build_dir), 688 return compare_build_artifacts(os.path.abspath(options.first_build_dir),
688 os.path.abspath(options.second_build_dir), 689 os.path.abspath(options.second_build_dir),
689 options.target_platform, 690 options.target_platform,
690 options.recursive) 691 options.recursive)
691 692
692 693
693 if __name__ == '__main__': 694 if __name__ == '__main__':
694 sys.exit(main()) 695 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