OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 ''' | 3 ''' |
4 Copyright 2013 Google Inc. | 4 Copyright 2013 Google Inc. |
5 | 5 |
6 Use of this source code is governed by a BSD-style license that can be | 6 Use of this source code is governed by a BSD-style license that can be |
7 found in the LICENSE file. | 7 found in the LICENSE file. |
8 ''' | 8 ''' |
9 | 9 |
10 ''' | 10 ''' |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 Any tests which violate those assumptions will cause an exception to | 74 Any tests which violate those assumptions will cause an exception to |
75 be raised. | 75 be raised. |
76 | 76 |
77 Any tests for which we have no expectations will be left out of the | 77 Any tests for which we have no expectations will be left out of the |
78 returned dictionary. | 78 returned dictionary. |
79 """ | 79 """ |
80 result_dict = {} | 80 result_dict = {} |
81 json_dict = gm_json.LoadFromString(contents) | 81 json_dict = gm_json.LoadFromString(contents) |
82 all_expectations = json_dict[gm_json.JSONKEY_EXPECTEDRESULTS] | 82 all_expectations = json_dict[gm_json.JSONKEY_EXPECTEDRESULTS] |
| 83 |
| 84 # Prevent https://code.google.com/p/skia/issues/detail?id=1588 |
| 85 # ('svndiff.py: 'NoneType' object has no attribute 'keys'') |
| 86 if not all_expectations: |
| 87 return result_dict |
| 88 |
83 for test_name in all_expectations.keys(): | 89 for test_name in all_expectations.keys(): |
84 test_expectations = all_expectations[test_name] | 90 test_expectations = all_expectations[test_name] |
85 allowed_digests = test_expectations[ | 91 allowed_digests = test_expectations[ |
86 gm_json.JSONKEY_EXPECTEDRESULTS_ALLOWEDDIGESTS] | 92 gm_json.JSONKEY_EXPECTEDRESULTS_ALLOWEDDIGESTS] |
87 if allowed_digests: | 93 if allowed_digests: |
88 num_allowed_digests = len(allowed_digests) | 94 num_allowed_digests = len(allowed_digests) |
89 if num_allowed_digests > 1: | 95 if num_allowed_digests > 1: |
90 raise ValueError( | 96 raise ValueError( |
91 'test %s has %d allowed digests' % ( | 97 'test %s has %d allowed digests' % ( |
92 test_name, num_allowed_digests)) | 98 test_name, num_allowed_digests)) |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 'ACTUAL results from the "old" JSON file. This can be a ' + | 192 'ACTUAL results from the "old" JSON file. This can be a ' + |
187 'filepath on local storage, or a URL.') | 193 'filepath on local storage, or a URL.') |
188 args = parser.parse_args() | 194 args = parser.parse_args() |
189 differ = GMDiffer() | 195 differ = GMDiffer() |
190 diffs = differ.GenerateDiffDict(oldfile=args.old, newfile=args.new) | 196 diffs = differ.GenerateDiffDict(oldfile=args.old, newfile=args.new) |
191 json.dump(diffs, sys.stdout, sort_keys=True, indent=2) | 197 json.dump(diffs, sys.stdout, sort_keys=True, indent=2) |
192 | 198 |
193 | 199 |
194 if __name__ == '__main__': | 200 if __name__ == '__main__': |
195 _Main() | 201 _Main() |
OLD | NEW |