Chromium Code Reviews| Index: tools/perf/PRESUBMIT.py |
| diff --git a/tools/perf/PRESUBMIT.py b/tools/perf/PRESUBMIT.py |
| index 70aadd7a160aa9352d758ff2820c2fbca308e03e..4311ead02abd16e220286ec62d39d031a283cc93 100644 |
| --- a/tools/perf/PRESUBMIT.py |
| +++ b/tools/perf/PRESUBMIT.py |
| @@ -9,6 +9,7 @@ for more details about the presubmit API built into depot_tools. |
| """ |
| import os |
| +import re |
| import sys |
| PYLINT_BLACKLIST = [] |
| @@ -85,3 +86,46 @@ def CheckChangeOnCommit(input_api, output_api): |
| report = [] |
| report.extend(_CommonChecks(input_api, output_api)) |
| return report |
| + |
| + |
| +def PostUploadHook(cl, change, output_api): |
| + """git cl upload will call this hook after the issue is created/modified. |
| + |
| + This hook adds extra try bots list to the CL description in order to run |
| + Telemetry benchmarks on Perf trybots in addtion to CQ trybots if the CL |
| + contains any changes to Telemetry benchmarks. |
| + """ |
| + results = [] |
| + |
| + rietveld_obj = cl.RpcServer() |
| + issue = cl.issue |
| + |
| + benchmarks_modified = False |
| + for affected_file in change.AffectedFiles(): |
| + affected_file_path = affected_file.LocalPath() |
| + file_path, _ = os.path.splitext(affected_file_path) |
| + |
| + if (os.path.join('tools', 'perf', 'benchmarks') in file_path or |
| + os.path.join('tools', 'perf', 'measurements') in file_path): |
| + 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.
|
| + |
| + original_description = rietveld_obj.get_description(issue) |
| + if benchmarks_modified and not re.search( |
| + 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.
|
| + bots = [ |
| + 'linux_perf_bisect', |
| + 'mac_perf_bisect', |
| + 'win_perf_bisect', |
| + 'android_nexus5_perf_bisect' |
| + ] |
| + bots = ['tryserver.chromium.perf:%s' % s for s in bots] |
| + bots_string = ';'.join(bots) |
| + description = original_description |
| + description += '\nCQ_EXTRA_TRYBOYS=%s' % bots_string |
|
qyearsley
2015/04/07 17:55:53
TRYBOYS -> TRYBOTS
prasadv
2015/04/08 00:00:16
Done.
|
| + results.append(output_api.PresubmitNotifyResult( |
| + 'Automatically added Perf trybots to run Telemetry benchmarks on CQ.')) |
| + |
| + if description != original_description: |
| + rietveld_obj.update_description(issue, description) |
| + |
| + return results |