diff options
author | prasadv <prasadv@chromium.org> | 2015-04-27 14:54:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-27 21:54:15 +0000 |
commit | 3d3ed829fb2e178a0174f518096f553e591a2061 (patch) | |
tree | 826d65e30fd367d3d08aaf5c7024c38c8af45334 | |
parent | aa4471e8d1d5f728394458a31ff5f913702e612f (diff) | |
download | chromium_src-3d3ed829fb2e178a0174f518096f553e591a2061.zip chromium_src-3d3ed829fb2e178a0174f518096f553e591a2061.tar.gz chromium_src-3d3ed829fb2e178a0174f518096f553e591a2061.tar.bz2 |
Update CL description by adding CQ_EXTRA_TRYBOTS for Telemetry changes.
This CL adds a post upload hook to add 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.
BUG=462581
Review URL: https://codereview.chromium.org/1060763002
Cr-Commit-Position: refs/heads/master@{#327150}
-rw-r--r-- | codereview.settings | 1 | ||||
-rw-r--r-- | tools/perf/PRESUBMIT.py | 47 |
2 files changed, 48 insertions, 0 deletions
diff --git a/codereview.settings b/codereview.settings index 9789920c..31af4b3 100644 --- a/codereview.settings +++ b/codereview.settings @@ -10,3 +10,4 @@ GITCL_PREDCOMMIT: http://src.chromium.org/viewvc/trunk/tools/depot_tools/git-cl- LINT_IGNORE_REGEX: webkit/api/.* PROJECT: chromium PENDING_REF_PREFIX: refs/pending/ +RUN_POST_UPLOAD_HOOK: True diff --git a/tools/perf/PRESUBMIT.py b/tools/perf/PRESUBMIT.py index ad11c24..6d01991 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 @@ -76,3 +77,49 @@ def CheckChangeOnCommit(input_api, output_api): report = [] report.extend(_CommonChecks(input_api, output_api)) return report + + +def _IsBenchmarksModified(change): + """Checks whether CL contains any modification to Telemetry benchmarks.""" + 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): + return True + return False + + +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. + """ + benchmarks_modified = _IsBenchmarksModified(change) + rietveld_obj = cl.RpcServer() + issue = cl.issue + original_description = rietveld_obj.get_description(issue) + if not benchmarks_modified or re.search( + r'^CQ_EXTRA_TRYBOTS=.*', original_description, re.M | re.I): + return [] + + results = [] + 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_TRYBOTS=%s' % bots_string + 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 |