OLD | NEW |
---|---|
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 Loading... | |
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 try: | |
177 subprocess.check_output(['python', recipes_py, 'simulation_test']) | |
178 except subprocess.CalledProcessError as e: | |
179 results.append(e.output) | |
180 return results | |
181 | |
182 | |
172 def _CommonChecks(input_api, output_api): | 183 def _CommonChecks(input_api, output_api): |
173 """Presubmit checks common to upload and commit.""" | 184 """Presubmit checks common to upload and commit.""" |
174 results = [] | 185 results = [] |
175 sources = lambda x: (x.LocalPath().endswith('.h') or | 186 sources = lambda x: (x.LocalPath().endswith('.h') or |
176 x.LocalPath().endswith('.gypi') or | 187 x.LocalPath().endswith('.gypi') or |
177 x.LocalPath().endswith('.gyp') or | 188 x.LocalPath().endswith('.gyp') or |
178 x.LocalPath().endswith('.py') or | 189 x.LocalPath().endswith('.py') or |
179 x.LocalPath().endswith('.sh') or | 190 x.LocalPath().endswith('.sh') or |
180 x.LocalPath().endswith('.m') or | 191 x.LocalPath().endswith('.m') or |
181 x.LocalPath().endswith('.mm') or | 192 x.LocalPath().endswith('.mm') or |
182 x.LocalPath().endswith('.go') or | 193 x.LocalPath().endswith('.go') or |
183 x.LocalPath().endswith('.c') or | 194 x.LocalPath().endswith('.c') or |
184 x.LocalPath().endswith('.cc') or | 195 x.LocalPath().endswith('.cc') or |
185 x.LocalPath().endswith('.cpp')) | 196 x.LocalPath().endswith('.cpp')) |
186 results.extend( | 197 results.extend( |
187 _CheckChangeHasEol( | 198 _CheckChangeHasEol( |
188 input_api, output_api, source_file_filter=sources)) | 199 input_api, output_api, source_file_filter=sources)) |
189 results.extend(_PythonChecks(input_api, output_api)) | 200 results.extend(_PythonChecks(input_api, output_api)) |
190 results.extend(_IfDefChecks(input_api, output_api)) | 201 results.extend(_IfDefChecks(input_api, output_api)) |
191 results.extend(_CopyrightChecks(input_api, output_api, | 202 results.extend(_CopyrightChecks(input_api, output_api, |
192 source_file_filter=sources)) | 203 source_file_filter=sources)) |
193 results.extend(_ToolFlags(input_api, output_api)) | 204 results.extend(_ToolFlags(input_api, output_api)) |
205 results.extend(_RecipeSimulationTest(input_api, output_api)) | |
rmistry
2016/07/26 18:00:38
How long does this take to run? should this only r
borenet
2016/07/26 18:08:45
< 5 seconds. I didn't notice a difference.
| |
194 return results | 206 return results |
195 | 207 |
196 | 208 |
197 def CheckChangeOnUpload(input_api, output_api): | 209 def CheckChangeOnUpload(input_api, output_api): |
198 """Presubmit checks for the change on upload. | 210 """Presubmit checks for the change on upload. |
199 | 211 |
200 The following are the presubmit checks: | 212 The following are the presubmit checks: |
201 * Check change has one and only one EOL. | 213 * Check change has one and only one EOL. |
202 """ | 214 """ |
203 results = [] | 215 results = [] |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
516 state and an error if it is in 'Closed' state. | 528 state and an error if it is in 'Closed' state. |
517 """ | 529 """ |
518 results = [] | 530 results = [] |
519 results.extend(_CommonChecks(input_api, output_api)) | 531 results.extend(_CommonChecks(input_api, output_api)) |
520 results.extend( | 532 results.extend( |
521 _CheckTreeStatus(input_api, output_api, json_url=( | 533 _CheckTreeStatus(input_api, output_api, json_url=( |
522 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) | 534 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) |
523 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) | 535 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) |
524 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) | 536 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) |
525 return results | 537 return results |
OLD | NEW |