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

Side by Side Diff: PRESUBMIT.py

Issue 2392083002: Add --test to gen_tasks.go, add presubmit check (Closed)
Patch Set: Only on upload Created 4 years, 2 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 | « no previous file | infra/bots/gen_tasks.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 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 5
6 """Top-level presubmit script for Skia. 6 """Top-level presubmit script for Skia.
7 7
8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts 8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
9 for more details about the presubmit API built into gcl. 9 for more details about the presubmit API built into gcl.
10 """ 10 """
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 recipes_py = os.path.join('infra', 'bots', 'recipes.py') 177 recipes_py = os.path.join('infra', 'bots', 'recipes.py')
178 cmd = ['python', recipes_py, 'simulation_test'] 178 cmd = ['python', recipes_py, 'simulation_test']
179 try: 179 try:
180 subprocess.check_output(cmd) 180 subprocess.check_output(cmd)
181 except subprocess.CalledProcessError as e: 181 except subprocess.CalledProcessError as e:
182 results.append(output_api.PresubmitError( 182 results.append(output_api.PresubmitError(
183 '`%s` failed:\n%s' % (' '.join(cmd), e.output))) 183 '`%s` failed:\n%s' % (' '.join(cmd), e.output)))
184 return results 184 return results
185 185
186
187 def _GenTasksTest(input_api, output_api):
188 """Run gen_tasks.go test."""
189 results = []
190 if not any(f.LocalPath().startswith('infra')
191 for f in input_api.AffectedFiles()):
192 return results
193
194 gen_tasks = os.path.join('infra', 'bots', 'gen_tasks.go')
195 cmd = ['go', 'run', gen_tasks, '--test']
196 try:
197 subprocess.check_output(cmd)
198 except subprocess.CalledProcessError as e:
199 results.append(output_api.PresubmitError(
200 '`%s` failed:\n%s' % (' '.join(cmd), e.output)))
201 return results
202
203
186 def _CheckGNFormatted(input_api, output_api): 204 def _CheckGNFormatted(input_api, output_api):
187 """Make sure any .gn files we're changing have been formatted.""" 205 """Make sure any .gn files we're changing have been formatted."""
188 results = [] 206 results = []
189 for f in input_api.AffectedFiles(): 207 for f in input_api.AffectedFiles():
190 if not f.LocalPath().endswith('.gn'): 208 if not f.LocalPath().endswith('.gn'):
191 continue 209 continue
192 210
193 cmd = ['gn', 'format', '--dry-run', f.LocalPath()] 211 cmd = ['gn', 'format', '--dry-run', f.LocalPath()]
194 try: 212 try:
195 subprocess.check_output(cmd) 213 subprocess.check_output(cmd)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 245
228 def CheckChangeOnUpload(input_api, output_api): 246 def CheckChangeOnUpload(input_api, output_api):
229 """Presubmit checks for the change on upload. 247 """Presubmit checks for the change on upload.
230 248
231 The following are the presubmit checks: 249 The following are the presubmit checks:
232 * Check change has one and only one EOL. 250 * Check change has one and only one EOL.
233 """ 251 """
234 results = [] 252 results = []
235 results.extend(_CommonChecks(input_api, output_api)) 253 results.extend(_CommonChecks(input_api, output_api))
236 # Run on upload, not commit, since the presubmit bot apparently doesn't have 254 # Run on upload, not commit, since the presubmit bot apparently doesn't have
237 # coverage installed. 255 # coverage or Go installed.
238 results.extend(_RecipeSimulationTest(input_api, output_api)) 256 results.extend(_RecipeSimulationTest(input_api, output_api))
257 results.extend(_GenTasksTest(input_api, output_api))
borenet 2016/10/04 18:59:47 This is really unfortunate. We need to be able to
dogben 2016/10/04 19:16:23 Is there a reason skia_presubmit-Trybot doesn't ru
borenet 2016/10/04 19:26:55 That bot was brought up by chrome-infra after they
borenet 2016/10/04 19:32:22 Filed https://bugs.chromium.org/p/skia/issues/deta
258
239 results.extend(_CheckGNFormatted(input_api, output_api)) 259 results.extend(_CheckGNFormatted(input_api, output_api))
240 return results 260 return results
241 261
242 262
243 def _CheckTreeStatus(input_api, output_api, json_url): 263 def _CheckTreeStatus(input_api, output_api, json_url):
244 """Check whether to allow commit. 264 """Check whether to allow commit.
245 265
246 Args: 266 Args:
247 input_api: input related apis. 267 input_api: input related apis.
248 output_api: output related apis. 268 output_api: output related apis.
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 state and an error if it is in 'Closed' state. 624 state and an error if it is in 'Closed' state.
605 """ 625 """
606 results = [] 626 results = []
607 results.extend(_CommonChecks(input_api, output_api)) 627 results.extend(_CommonChecks(input_api, output_api))
608 results.extend( 628 results.extend(
609 _CheckTreeStatus(input_api, output_api, json_url=( 629 _CheckTreeStatus(input_api, output_api, json_url=(
610 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) 630 SKIA_TREE_STATUS_URL + '/banner-status?format=json')))
611 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) 631 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api))
612 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) 632 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api))
613 return results 633 return results
OLDNEW
« no previous file with comments | « no previous file | infra/bots/gen_tasks.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698