Chromium Code Reviews| Index: third_party/WebKit/PRESUBMIT.py |
| diff --git a/third_party/WebKit/PRESUBMIT.py b/third_party/WebKit/PRESUBMIT.py |
| index cee4638e6e81de47436fa975eb0c69f3a02cc65c..f410c426c2913ebb4b981094b96f249ed6a494bd 100644 |
| --- a/third_party/WebKit/PRESUBMIT.py |
| +++ b/third_party/WebKit/PRESUBMIT.py |
| @@ -8,6 +8,7 @@ See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| for more details about the presubmit API built into gcl. |
| """ |
| +import os |
| import re |
| import sys |
| @@ -320,3 +321,47 @@ def CheckChangeOnCommit(input_api, output_api): |
| results.extend(input_api.canned_checks.CheckChangeHasDescription( |
| input_api, output_api)) |
| return results |
| + |
| + |
| +def _ArePaintDirectoriesModified(change): # pylint: disable=C0103 |
| + """Checks whether CL contains changes to paint-related directories.""" |
| + for affected_file in change.AffectedFiles(): |
| + file_path = affected_file.LocalPath() |
| + if (os.path.join('third_party', 'WebKit', 'Source', 'platform', 'graphics', 'compositing') in file_path or |
| + os.path.join('third_party', 'WebKit', 'Source', 'platform', 'graphics', 'paint') in file_path or |
| + os.path.join('third_party', 'WebKit', 'Source', 'core', 'paint') in file_path): |
|
chrishtr
2016/08/01 23:44:35
Also: Source/core/layout/compositing/
|
| + return True |
| + return False |
| + |
| + |
| +def PostUploadHook(cl, change, output_api): # pylint: disable=C0103 |
| + """git cl upload will call this hook after the issue is created/modified. |
| + |
| + This hook adds extra try bots to the CL description in order to run slimming |
| + paint v2 tests in addition to the CQ try bots if the change contains paint- |
| + related changes (see: _ArePaintDirectoriesModified). For more information, |
| + about slimming-paint-v2 tests, see https://crbug.com/601275. |
| + """ |
| + if not _ArePaintDirectoriesModified(change): |
| + return [] |
| + |
| + rietveld_obj = cl.RpcServer() |
| + issue = cl.issue |
| + description = rietveld_obj.get_description(issue) |
| + if re.search(r'^CQ_INCLUDE_TRYBOTS=.*', description, re.M | re.I): |
| + return [] |
| + |
| + bots = [ |
| + 'master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2', |
| + ] |
| + |
| + results = [] |
| + new_description = description |
| + new_description += '\nCQ_INCLUDE_TRYBOTS=%s' % ';'.join(bots) |
| + results.append(output_api.PresubmitNotifyResult( |
| + 'Automatically added slimming-paint-v2 tests to run on CQ due to changes in paint-related directories.')) |
| + |
| + if new_description != description: |
| + rietveld_obj.update_description(issue, new_description) |
| + |
| + return results |