Chromium Code Reviews| 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 """Top-level presubmit script for Blink. | 5 """Top-level presubmit script for Blink. |
| 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 gcl. | 8 for more details about the presubmit API built into gcl. |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 import os | |
| 11 import re | 12 import re |
| 12 import sys | 13 import sys |
| 13 | 14 |
| 14 | 15 |
| 15 _EXCLUDED_PATHS = () | 16 _EXCLUDED_PATHS = () |
| 16 | 17 |
| 17 | 18 |
| 18 def _CheckForNonBlinkVariantMojomIncludes(input_api, output_api): | 19 def _CheckForNonBlinkVariantMojomIncludes(input_api, output_api): |
| 19 pattern = input_api.re.compile(r'#include\s+.+\.mojom(.*)\.h[>"]') | 20 pattern = input_api.re.compile(r'#include\s+.+\.mojom(.*)\.h[>"]') |
| 20 errors = [] | 21 errors = [] |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 | 314 |
| 314 def CheckChangeOnCommit(input_api, output_api): | 315 def CheckChangeOnCommit(input_api, output_api): |
| 315 results = [] | 316 results = [] |
| 316 results.extend(_CommonChecks(input_api, output_api)) | 317 results.extend(_CommonChecks(input_api, output_api)) |
| 317 results.extend(input_api.canned_checks.CheckTreeIsOpen( | 318 results.extend(input_api.canned_checks.CheckTreeIsOpen( |
| 318 input_api, output_api, | 319 input_api, output_api, |
| 319 json_url='http://chromium-status.appspot.com/current?format=json')) | 320 json_url='http://chromium-status.appspot.com/current?format=json')) |
| 320 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 321 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
| 321 input_api, output_api)) | 322 input_api, output_api)) |
| 322 return results | 323 return results |
| 324 | |
| 325 | |
| 326 def _ArePaintOrCompositingDirectoriesModified(change): # pylint: disable=C0103 | |
| 327 """Checks whether CL has changes to paint or compositing directories.""" | |
| 328 for affected_file in change.AffectedFiles(): | |
| 329 file_path = affected_file.LocalPath() | |
| 330 if (os.path.join('third_party', 'WebKit', 'Source', 'platform', 'graphic s', 'compositing') in file_path or | |
|
tandrii(chromium)
2016/08/02 13:52:37
nit: 80 char limit here and below.
| |
| 331 os.path.join('third_party', 'WebKit', 'Source', 'platform', 'gra phics', 'paint') in file_path or | |
| 332 os.path.join('third_party', 'WebKit', 'Source', 'core', 'layout' , 'compositing') in file_path or | |
| 333 os.path.join('third_party', 'WebKit', 'Source', 'core', 'paint') in file_path): | |
| 334 return True | |
| 335 return False | |
| 336 | |
| 337 | |
| 338 def PostUploadHook(cl, change, output_api): # pylint: disable=C0103 | |
|
tandrii(chromium)
2016/08/02 13:52:37
frankly, i don't understand why this should happen
| |
| 339 """git cl upload will call this hook after the issue is created/modified. | |
| 340 | |
| 341 This hook adds extra try bots to the CL description in order to run slimming | |
| 342 paint v2 tests in addition to the CQ try bots if the change contains paint | |
| 343 or compositing changes (see: _ArePaintOrCompositingDirectoriesModified). For | |
| 344 more information about slimming-paint-v2 tests see https://crbug.com/601275. | |
| 345 """ | |
| 346 if not _ArePaintOrCompositingDirectoriesModified(change): | |
| 347 return [] | |
| 348 | |
| 349 rietveld_obj = cl.RpcServer() | |
| 350 issue = cl.issue | |
| 351 description = rietveld_obj.get_description(issue) | |
| 352 if re.search(r'^CQ_INCLUDE_TRYBOTS=.*', description, re.M | re.I): | |
| 353 return [] | |
| 354 | |
| 355 bots = [ | |
| 356 'master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2', | |
| 357 ] | |
| 358 | |
| 359 results = [] | |
| 360 new_description = description | |
| 361 new_description += '\nCQ_INCLUDE_TRYBOTS=%s' % ';'.join(bots) | |
| 362 results.append(output_api.PresubmitNotifyResult( | |
| 363 'Automatically added slimming-paint-v2 tests to run on CQ due to changes in paint or compositing directories.')) | |
| 364 | |
| 365 if new_description != description: | |
| 366 rietveld_obj.update_description(issue, new_description) | |
| 367 | |
| 368 return results | |
| OLD | NEW |