| 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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 all_diffs = expected_diffs + unexpected_diffs | 664 all_diffs = expected_diffs + unexpected_diffs |
| 665 diffs_to_investigate = sorted(set(all_diffs).difference(missing_files)) | 665 diffs_to_investigate = sorted(set(all_diffs).difference(missing_files)) |
| 666 compare_deps(first_dir, second_dir, diffs_to_investigate) | 666 compare_deps(first_dir, second_dir, diffs_to_investigate) |
| 667 | 667 |
| 668 if json_output: | 668 if json_output: |
| 669 try: | 669 try: |
| 670 out = { | 670 out = { |
| 671 'expected_diffs': expected_diffs, | 671 'expected_diffs': expected_diffs, |
| 672 'unexpected_diffs': unexpected_diffs, | 672 'unexpected_diffs': unexpected_diffs, |
| 673 } | 673 } |
| 674 with open(json_output) as f: | 674 with open(json_output, 'w') as f: |
| 675 json.dump(out, f) | 675 json.dump(out, f) |
| 676 except Exception as e: | 676 except Exception as e: |
| 677 print('failed to write json output: %s' % e) | 677 print('failed to write json output: %s' % e) |
| 678 | 678 |
| 679 return int(bool(unexpected_diffs)) | 679 return int(bool(unexpected_diffs)) |
| 680 | 680 |
| 681 | 681 |
| 682 def main(): | 682 def main(): |
| 683 parser = optparse.OptionParser(usage='%prog [options]') | 683 parser = optparse.OptionParser(usage='%prog [options]') |
| 684 parser.add_option( | 684 parser.add_option( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 704 | 704 |
| 705 return compare_build_artifacts(os.path.abspath(options.first_build_dir), | 705 return compare_build_artifacts(os.path.abspath(options.first_build_dir), |
| 706 os.path.abspath(options.second_build_dir), | 706 os.path.abspath(options.second_build_dir), |
| 707 options.target_platform, | 707 options.target_platform, |
| 708 options.json_output, | 708 options.json_output, |
| 709 options.recursive) | 709 options.recursive) |
| 710 | 710 |
| 711 | 711 |
| 712 if __name__ == '__main__': | 712 if __name__ == '__main__': |
| 713 sys.exit(main()) | 713 sys.exit(main()) |
| OLD | NEW |