Chromium Code Reviews| 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 if expected_diffs or unexpected_diffs: |
| 629 diffs_to_investigate = set(unexpected_diffs).difference( | 629 all_diffs = expected_diffs + unexpected_diffs |
| 630 diffs_to_investigate = set(all_diffs).difference( | |
| 630 set(missing_files)) | 631 set(missing_files)) |
| 631 compare_deps(first_dir, second_dir, diffs_to_investigate) | 632 compare_deps(first_dir, second_dir, diffs_to_investigate) |
|
Dirk Pranke
2016/08/29 15:51:34
Nit: You don't actually need the `if` check on lin
Yoshisato Yanagisawa
2016/08/30 01:29:49
done.
also removed unnecessary set(), and make dif
| |
| 632 | 633 |
| 633 return int(bool(unexpected_diffs)) | 634 return int(bool(unexpected_diffs)) |
| 634 | 635 |
| 635 | 636 |
| 636 def main(): | 637 def main(): |
| 637 parser = optparse.OptionParser(usage='%prog [options]') | 638 parser = optparse.OptionParser(usage='%prog [options]') |
| 638 parser.add_option( | 639 parser.add_option( |
| 639 '-f', '--first-build-dir', help='The first build directory.') | 640 '-f', '--first-build-dir', help='The first build directory.') |
| 640 parser.add_option( | 641 parser.add_option( |
| 641 '-s', '--second-build-dir', help='The second build directory.') | 642 '-s', '--second-build-dir', help='The second build directory.') |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 656 parser.error('--target-platform is required') | 657 parser.error('--target-platform is required') |
| 657 | 658 |
| 658 return compare_build_artifacts(os.path.abspath(options.first_build_dir), | 659 return compare_build_artifacts(os.path.abspath(options.first_build_dir), |
| 659 os.path.abspath(options.second_build_dir), | 660 os.path.abspath(options.second_build_dir), |
| 660 options.target_platform, | 661 options.target_platform, |
| 661 options.recursive) | 662 options.recursive) |
| 662 | 663 |
| 663 | 664 |
| 664 if __name__ == '__main__': | 665 if __name__ == '__main__': |
| 665 sys.exit(main()) | 666 sys.exit(main()) |
| OLD | NEW |