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 |
11 import os | 11 import os |
12 import re | |
12 import sys | 13 import sys |
13 | 14 |
14 PYLINT_BLACKLIST = [] | 15 PYLINT_BLACKLIST = [] |
15 PYLINT_DISABLED_WARNINGS = [ | 16 PYLINT_DISABLED_WARNINGS = [ |
16 'R0923', # Interface not implemented | 17 'R0923', # Interface not implemented |
17 'R0201', # Method could be a function | 18 'R0201', # Method could be a function |
18 'E1101', # Non-existent member is accessed. | 19 'E1101', # Non-existent member is accessed. |
19 ] | 20 ] |
20 | 21 |
21 | 22 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 def CheckChangeOnUpload(input_api, output_api): | 79 def CheckChangeOnUpload(input_api, output_api): |
79 report = [] | 80 report = [] |
80 report.extend(_CommonChecks(input_api, output_api)) | 81 report.extend(_CommonChecks(input_api, output_api)) |
81 return report | 82 return report |
82 | 83 |
83 | 84 |
84 def CheckChangeOnCommit(input_api, output_api): | 85 def CheckChangeOnCommit(input_api, output_api): |
85 report = [] | 86 report = [] |
86 report.extend(_CommonChecks(input_api, output_api)) | 87 report.extend(_CommonChecks(input_api, output_api)) |
87 return report | 88 return report |
89 | |
90 | |
91 def PostUploadHook(cl, change, output_api): | |
92 """git cl upload will call this hook after the issue is created/modified. | |
93 | |
94 This hook adds extra try bots list to the CL description in order to run | |
95 Telemetry benchmarks on Perf trybots in addtion to CQ trybots if the CL | |
96 contains any changes to Telemetry benchmarks. | |
97 """ | |
98 results = [] | |
99 | |
100 rietveld_obj = cl.RpcServer() | |
101 issue = cl.issue | |
102 | |
103 benchmarks_modified = False | |
104 for affected_file in change.AffectedFiles(): | |
105 affected_file_path = affected_file.LocalPath() | |
106 file_path, _ = os.path.splitext(affected_file_path) | |
107 | |
108 if (os.path.join('tools', 'perf', 'benchmarks') in file_path or | |
109 os.path.join('tools', 'perf', 'measurements') in file_path): | |
110 benchmarks_modified = True | |
qyearsley
2015/04/07 17:55:53
[Optional] The above block could be extracted to a
prasadv
2015/04/08 00:00:16
Done.
| |
111 | |
112 original_description = rietveld_obj.get_description(issue) | |
113 if benchmarks_modified and not re.search( | |
114 r'^CQ_EXTRA_TRYBOYS=.*', original_description, re.M | re.I): | |
qyearsley
2015/04/07 17:55:53
TRYBOYS -> TRYBOTS
qyearsley
2015/04/07 17:55:53
[Optional] If you want to avoid having a long if s
prasadv
2015/04/08 00:00:16
Done.
prasadv
2015/04/08 00:00:16
Done.
| |
115 bots = [ | |
116 'linux_perf_bisect', | |
117 'mac_perf_bisect', | |
118 'win_perf_bisect', | |
119 'android_nexus5_perf_bisect' | |
120 ] | |
121 bots = ['tryserver.chromium.perf:%s' % s for s in bots] | |
122 bots_string = ';'.join(bots) | |
123 description = original_description | |
124 description += '\nCQ_EXTRA_TRYBOYS=%s' % bots_string | |
qyearsley
2015/04/07 17:55:53
TRYBOYS -> TRYBOTS
prasadv
2015/04/08 00:00:16
Done.
| |
125 results.append(output_api.PresubmitNotifyResult( | |
126 'Automatically added Perf trybots to run Telemetry benchmarks on CQ.')) | |
127 | |
128 if description != original_description: | |
129 rietveld_obj.update_description(issue, description) | |
130 | |
131 return results | |
OLD | NEW |