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 _ArePaintDirectoriesModified(change): # pylint: disable=C0103 | |
| 327 """Checks whether CL contains changes to paint-related 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 | |
| 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', 'paint') in file_path): | |
|
chrishtr
2016/08/01 23:44:35
Also: Source/core/layout/compositing/
| |
| 333 return True | |
| 334 return False | |
| 335 | |
| 336 | |
| 337 def PostUploadHook(cl, change, output_api): # pylint: disable=C0103 | |
| 338 """git cl upload will call this hook after the issue is created/modified. | |
| 339 | |
| 340 This hook adds extra try bots to the CL description in order to run slimming | |
| 341 paint v2 tests in addition to the CQ try bots if the change contains paint- | |
| 342 related changes (see: _ArePaintDirectoriesModified). For more information, | |
| 343 about slimming-paint-v2 tests, see https://crbug.com/601275. | |
| 344 """ | |
| 345 if not _ArePaintDirectoriesModified(change): | |
| 346 return [] | |
| 347 | |
| 348 rietveld_obj = cl.RpcServer() | |
| 349 issue = cl.issue | |
| 350 description = rietveld_obj.get_description(issue) | |
| 351 if re.search(r'^CQ_INCLUDE_TRYBOTS=.*', description, re.M | re.I): | |
| 352 return [] | |
| 353 | |
| 354 bots = [ | |
| 355 'master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2', | |
| 356 ] | |
| 357 | |
| 358 results = [] | |
| 359 new_description = description | |
| 360 new_description += '\nCQ_INCLUDE_TRYBOTS=%s' % ';'.join(bots) | |
| 361 results.append(output_api.PresubmitNotifyResult( | |
| 362 'Automatically added slimming-paint-v2 tests to run on CQ due to changes in paint-related directories.')) | |
| 363 | |
| 364 if new_description != description: | |
| 365 rietveld_obj.update_description(issue, new_description) | |
| 366 | |
| 367 return results | |
| OLD | NEW |