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

Side by Side Diff: PRESUBMIT.py

Issue 2175373002: Move Skia recipes from build repo (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address more comments Created 4 years, 4 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 | « .gitignore ('k') | infra/bots/compile_skia.isolate » ('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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 """Make sure `{dm,nanobench}_flags.py test` passes if modified.""" 162 """Make sure `{dm,nanobench}_flags.py test` passes if modified."""
163 results = [] 163 results = []
164 sources = lambda x: ('dm_flags.py' in x.LocalPath() or 164 sources = lambda x: ('dm_flags.py' in x.LocalPath() or
165 'nanobench_flags.py' in x.LocalPath()) 165 'nanobench_flags.py' in x.LocalPath())
166 for f in input_api.AffectedSourceFiles(sources): 166 for f in input_api.AffectedSourceFiles(sources):
167 if 0 != subprocess.call(['python', f.LocalPath(), 'test']): 167 if 0 != subprocess.call(['python', f.LocalPath(), 'test']):
168 results.append(output_api.PresubmitError('`python %s test` failed' % f)) 168 results.append(output_api.PresubmitError('`python %s test` failed' % f))
169 return results 169 return results
170 170
171 171
172 def _RecipeSimulationTest(input_api, output_api):
173 """Run the recipe simulation test."""
174 results = []
175 recipes_py = os.path.join('infra', 'bots', 'recipes.py')
176 cmd = ['python', recipes_py, 'simulation_test']
177 try:
178 subprocess.check_output(cmd)
179 except subprocess.CalledProcessError as e:
180 results.append(output_api.PresubmitError(
181 '`%s` failed:\n%s' % (' '.join(cmd), e.output)))
182 return results
183
184
172 def _CommonChecks(input_api, output_api): 185 def _CommonChecks(input_api, output_api):
173 """Presubmit checks common to upload and commit.""" 186 """Presubmit checks common to upload and commit."""
174 results = [] 187 results = []
175 sources = lambda x: (x.LocalPath().endswith('.h') or 188 sources = lambda x: (x.LocalPath().endswith('.h') or
176 x.LocalPath().endswith('.gypi') or 189 x.LocalPath().endswith('.gypi') or
177 x.LocalPath().endswith('.gyp') or 190 x.LocalPath().endswith('.gyp') or
178 x.LocalPath().endswith('.py') or 191 x.LocalPath().endswith('.py') or
179 x.LocalPath().endswith('.sh') or 192 x.LocalPath().endswith('.sh') or
180 x.LocalPath().endswith('.m') or 193 x.LocalPath().endswith('.m') or
181 x.LocalPath().endswith('.mm') or 194 x.LocalPath().endswith('.mm') or
(...skipping 13 matching lines...) Expand all
195 208
196 209
197 def CheckChangeOnUpload(input_api, output_api): 210 def CheckChangeOnUpload(input_api, output_api):
198 """Presubmit checks for the change on upload. 211 """Presubmit checks for the change on upload.
199 212
200 The following are the presubmit checks: 213 The following are the presubmit checks:
201 * Check change has one and only one EOL. 214 * Check change has one and only one EOL.
202 """ 215 """
203 results = [] 216 results = []
204 results.extend(_CommonChecks(input_api, output_api)) 217 results.extend(_CommonChecks(input_api, output_api))
218 # Run on upload, not commit, since the presubmit bot apparently doesn't have
219 # coverage installed.
220 results.extend(_RecipeSimulationTest(input_api, output_api))
205 return results 221 return results
206 222
207 223
208 def _CheckTreeStatus(input_api, output_api, json_url): 224 def _CheckTreeStatus(input_api, output_api, json_url):
209 """Check whether to allow commit. 225 """Check whether to allow commit.
210 226
211 Args: 227 Args:
212 input_api: input related apis. 228 input_api: input related apis.
213 output_api: output related apis. 229 output_api: output related apis.
214 json_url: url to download json style status. 230 json_url: url to download json style status.
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 state and an error if it is in 'Closed' state. 532 state and an error if it is in 'Closed' state.
517 """ 533 """
518 results = [] 534 results = []
519 results.extend(_CommonChecks(input_api, output_api)) 535 results.extend(_CommonChecks(input_api, output_api))
520 results.extend( 536 results.extend(
521 _CheckTreeStatus(input_api, output_api, json_url=( 537 _CheckTreeStatus(input_api, output_api, json_url=(
522 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) 538 SKIA_TREE_STATUS_URL + '/banner-status?format=json')))
523 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) 539 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api))
524 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) 540 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api))
525 return results 541 return results
OLDNEW
« no previous file with comments | « .gitignore ('k') | infra/bots/compile_skia.isolate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698