OLD | NEW |
1 # Copyright 2012 The Chromium Authors. All rights reserved. | 1 # Copyright 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Presubmit script for changes affecting tools/perf/. | 5 """Presubmit script for changes affecting tools/perf/. |
6 | 6 |
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
8 for more details about the presubmit API built into depot_tools. | 8 for more details about the presubmit API built into depot_tools. |
9 """ | 9 """ |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 input_api, output_api, black_list=[], pylintrc='pylintrc')) | 24 input_api, output_api, black_list=[], pylintrc='pylintrc')) |
25 results.extend(_CheckJson(input_api, output_api)) | 25 results.extend(_CheckJson(input_api, output_api)) |
26 results.extend(_CheckWprShaFiles(input_api, output_api)) | 26 results.extend(_CheckWprShaFiles(input_api, output_api)) |
27 finally: | 27 finally: |
28 sys.path = old_sys_path | 28 sys.path = old_sys_path |
29 return results | 29 return results |
30 | 30 |
31 | 31 |
32 def _CheckWprShaFiles(input_api, output_api): | 32 def _CheckWprShaFiles(input_api, output_api): |
33 """Check whether the wpr sha files have matching URLs.""" | 33 """Check whether the wpr sha files have matching URLs.""" |
34 from telemetry.util import cloud_storage | 34 from catapult_base import cloud_storage |
35 results = [] | 35 results = [] |
36 for affected_file in input_api.AffectedFiles(include_deletes=False): | 36 for affected_file in input_api.AffectedFiles(include_deletes=False): |
37 filename = affected_file.AbsoluteLocalPath() | 37 filename = affected_file.AbsoluteLocalPath() |
38 if not filename.endswith('wpr.sha1'): | 38 if not filename.endswith('wpr.sha1'): |
39 continue | 39 continue |
40 expected_hash = cloud_storage.ReadHash(filename) | 40 expected_hash = cloud_storage.ReadHash(filename) |
41 is_wpr_file_uploaded = any( | 41 is_wpr_file_uploaded = any( |
42 cloud_storage.Exists(bucket, expected_hash) | 42 cloud_storage.Exists(bucket, expected_hash) |
43 for bucket in cloud_storage.BUCKET_ALIASES.itervalues()) | 43 for bucket in cloud_storage.BUCKET_ALIASES.itervalues()) |
44 if not is_wpr_file_uploaded: | 44 if not is_wpr_file_uploaded: |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 bots_string = ';'.join(bots) | 116 bots_string = ';'.join(bots) |
117 description = original_description | 117 description = original_description |
118 description += '\nCQ_EXTRA_TRYBOTS=%s' % bots_string | 118 description += '\nCQ_EXTRA_TRYBOTS=%s' % bots_string |
119 results.append(output_api.PresubmitNotifyResult( | 119 results.append(output_api.PresubmitNotifyResult( |
120 'Automatically added Perf trybots to run Telemetry benchmarks on CQ.')) | 120 'Automatically added Perf trybots to run Telemetry benchmarks on CQ.')) |
121 | 121 |
122 if description != original_description: | 122 if description != original_description: |
123 rietveld_obj.update_description(issue, description) | 123 rietveld_obj.update_description(issue, description) |
124 | 124 |
125 return results | 125 return results |
OLD | NEW |