OLD | NEW |
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 Loading... |
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 Loading... |
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()) |
OLD | NEW |