| 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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 print('Unexpected diffs: %d' % len(unexpected_diffs)) | 618 print('Unexpected diffs: %d' % len(unexpected_diffs)) |
| 619 if unexpected_diffs: | 619 if unexpected_diffs: |
| 620 print('Unexpected files with diffs:\n') | 620 print('Unexpected files with diffs:\n') |
| 621 for u in unexpected_diffs: | 621 for u in unexpected_diffs: |
| 622 print(' %s' % u) | 622 print(' %s' % u) |
| 623 if unexpected_equals: | 623 if unexpected_equals: |
| 624 print('Unexpected files with no diffs:\n') | 624 print('Unexpected files with no diffs:\n') |
| 625 for u in unexpected_equals: | 625 for u in unexpected_equals: |
| 626 print(' %s' % u) | 626 print(' %s' % u) |
| 627 | 627 |
| 628 if unexpected_diffs: | 628 all_diffs = expected_diffs + unexpected_diffs |
| 629 diffs_to_investigate = set(unexpected_diffs).difference( | 629 diffs_to_investigate = sorted(set(all_diffs).difference(missing_files)) |
| 630 set(missing_files)) | 630 compare_deps(first_dir, second_dir, diffs_to_investigate) |
| 631 compare_deps(first_dir, second_dir, diffs_to_investigate) | |
| 632 | 631 |
| 633 return int(bool(unexpected_diffs)) | 632 return int(bool(unexpected_diffs)) |
| 634 | 633 |
| 635 | 634 |
| 636 def main(): | 635 def main(): |
| 637 parser = optparse.OptionParser(usage='%prog [options]') | 636 parser = optparse.OptionParser(usage='%prog [options]') |
| 638 parser.add_option( | 637 parser.add_option( |
| 639 '-f', '--first-build-dir', help='The first build directory.') | 638 '-f', '--first-build-dir', help='The first build directory.') |
| 640 parser.add_option( | 639 parser.add_option( |
| 641 '-s', '--second-build-dir', help='The second build directory.') | 640 '-s', '--second-build-dir', help='The second build directory.') |
| (...skipping 14 matching lines...) Expand all Loading... |
| 656 parser.error('--target-platform is required') | 655 parser.error('--target-platform is required') |
| 657 | 656 |
| 658 return compare_build_artifacts(os.path.abspath(options.first_build_dir), | 657 return compare_build_artifacts(os.path.abspath(options.first_build_dir), |
| 659 os.path.abspath(options.second_build_dir), | 658 os.path.abspath(options.second_build_dir), |
| 660 options.target_platform, | 659 options.target_platform, |
| 661 options.recursive) | 660 options.recursive) |
| 662 | 661 |
| 663 | 662 |
| 664 if __name__ == '__main__': | 663 if __name__ == '__main__': |
| 665 sys.exit(main()) | 664 sys.exit(main()) |
| OLD | NEW |