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

Side by Side 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: rebasing 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 unified diff | Download patch
« no previous file with comments | « codereview.settings ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 15
15 def _CommonChecks(input_api, output_api): 16 def _CommonChecks(input_api, output_api):
16 """Performs common checks, which includes running pylint.""" 17 """Performs common checks, which includes running pylint."""
17 results = [] 18 results = []
18 old_sys_path = sys.path 19 old_sys_path = sys.path
19 try: 20 try:
20 # Modules in tools/perf depend on telemetry. 21 # Modules in tools/perf depend on telemetry.
21 sys.path = [os.path.join(os.pardir, 'telemetry')] + sys.path 22 sys.path = [os.path.join(os.pardir, 'telemetry')] + sys.path
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 def CheckChangeOnUpload(input_api, output_api): 70 def CheckChangeOnUpload(input_api, output_api):
70 report = [] 71 report = []
71 report.extend(_CommonChecks(input_api, output_api)) 72 report.extend(_CommonChecks(input_api, output_api))
72 return report 73 return report
73 74
74 75
75 def CheckChangeOnCommit(input_api, output_api): 76 def CheckChangeOnCommit(input_api, output_api):
76 report = [] 77 report = []
77 report.extend(_CommonChecks(input_api, output_api)) 78 report.extend(_CommonChecks(input_api, output_api))
78 return report 79 return report
80
81
82 def _IsBenchmarksModified(change):
83 """Checks whether CL contains any modification to Telemetry benchmarks."""
84 for affected_file in change.AffectedFiles():
85 affected_file_path = affected_file.LocalPath()
86 file_path, _ = os.path.splitext(affected_file_path)
87 if (os.path.join('tools', 'perf', 'benchmarks') in file_path or
88 os.path.join('tools', 'perf', 'measurements') in file_path):
89 return True
90 return False
91
92
93 def PostUploadHook(cl, change, output_api):
94 """git cl upload will call this hook after the issue is created/modified.
95
96 This hook adds extra try bots list to the CL description in order to run
97 Telemetry benchmarks on Perf trybots in addtion to CQ trybots if the CL
98 contains any changes to Telemetry benchmarks.
99 """
100 benchmarks_modified = _IsBenchmarksModified(change)
101 rietveld_obj = cl.RpcServer()
102 issue = cl.issue
103 original_description = rietveld_obj.get_description(issue)
104 if not benchmarks_modified or re.search(
105 r'^CQ_EXTRA_TRYBOTS=.*', original_description, re.M | re.I):
106 return []
107
108 results = []
109 bots = [
110 'linux_perf_bisect',
111 'mac_perf_bisect',
112 'win_perf_bisect',
113 'android_nexus5_perf_bisect'
114 ]
115 bots = ['tryserver.chromium.perf:%s' % s for s in bots]
116 bots_string = ';'.join(bots)
117 description = original_description
118 description += '\nCQ_EXTRA_TRYBOTS=%s' % bots_string
119 results.append(output_api.PresubmitNotifyResult(
120 'Automatically added Perf trybots to run Telemetry benchmarks on CQ.'))
121
122 if description != original_description:
123 rietveld_obj.update_description(issue, description)
124
125 return results
OLDNEW
« 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