Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(905)

Unified Diff: tools/perf/PRESUBMIT.py

Issue 1060763002: Update CL description by adding CQ_EXTRA_TRYBOTS for Telemetry changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « codereview.settings ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/PRESUBMIT.py
diff --git a/tools/perf/PRESUBMIT.py b/tools/perf/PRESUBMIT.py
index 70aadd7a160aa9352d758ff2820c2fbca308e03e..91613c725585833dec4893e61dbbf58660a4dc80 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,49 @@ def CheckChangeOnCommit(input_api, output_api):
report = []
report.extend(_CommonChecks(input_api, output_api))
return report
+
+
+def _IsBenchmarksModified(change_list):
qyearsley 2015/04/08 00:07:13 Should the argument be called change or change_lis
prasadv 2015/04/08 00:15:48 Done.
+ """Checks whether CL contains any modification to Telemetry benchmarks."""
+ for affected_file in change_list.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
« no previous file with comments | « codereview.settings ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698