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..f1d5aa7530bc615b48036c749ef140ab0ff9304d 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,48 @@ def CheckChangeOnCommit(input_api, output_api): |
| results.extend(input_api.canned_checks.CheckChangeHasDescription( |
| input_api, output_api)) |
| return results |
| + |
| + |
| +def _ArePaintOrCompositingDirectoriesModified(change): # pylint: disable=C0103 |
| + """Checks whether CL has changes to paint or compositing 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 |
|
tandrii(chromium)
2016/08/02 13:52:37
nit: 80 char limit here and below.
|
| + os.path.join('third_party', 'WebKit', 'Source', 'platform', 'graphics', 'paint') in file_path or |
| + os.path.join('third_party', 'WebKit', 'Source', 'core', 'layout', 'compositing') in file_path or |
| + os.path.join('third_party', 'WebKit', 'Source', 'core', 'paint') in file_path): |
| + return True |
| + return False |
| + |
| + |
| +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
|
| + """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 |
| + or compositing changes (see: _ArePaintOrCompositingDirectoriesModified). For |
| + more information about slimming-paint-v2 tests see https://crbug.com/601275. |
| + """ |
| + if not _ArePaintOrCompositingDirectoriesModified(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 or compositing directories.')) |
| + |
| + if new_description != description: |
| + rietveld_obj.update_description(issue, new_description) |
| + |
| + return results |