OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 src/components/cronet. | 5 """Top-level presubmit script for src/components/cronet. |
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 depot_tools. | 8 for more details about the presubmit API built into depot_tools. |
9 """ | 9 """ |
10 | 10 |
11 import re | |
12 | |
13 | |
14 def _PyLintChecks(input_api, output_api): | 11 def _PyLintChecks(input_api, output_api): |
15 pylint_checks = input_api.canned_checks.GetPylint(input_api, output_api, | 12 pylint_checks = input_api.canned_checks.GetPylint(input_api, output_api, |
16 extra_paths_list=_GetPathsToPrepend(input_api), pylintrc='pylintrc') | 13 extra_paths_list=_GetPathsToPrepend(input_api), pylintrc='pylintrc') |
17 return input_api.RunTests(pylint_checks) | 14 return input_api.RunTests(pylint_checks) |
18 | 15 |
19 | 16 |
20 def _GetPathsToPrepend(input_api): | 17 def _GetPathsToPrepend(input_api): |
21 current_dir = input_api.PresubmitLocalPath() | 18 current_dir = input_api.PresubmitLocalPath() |
22 chromium_src_dir = input_api.os_path.join(current_dir, '..', '..') | 19 chromium_src_dir = input_api.os_path.join(current_dir, '..', '..') |
23 return [ | 20 return [ |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 # out a way to augment the default set. | 101 # out a way to augment the default set. |
105 return {} | 102 return {} |
106 | 103 |
107 | 104 |
108 def PostUploadHook(cl, change, output_api): | 105 def PostUploadHook(cl, change, output_api): |
109 """git cl upload will call this hook after the issue is created/modified. | 106 """git cl upload will call this hook after the issue is created/modified. |
110 | 107 |
111 This hook adds an extra try bot to the CL description in order to run Cronet | 108 This hook adds an extra try bot to the CL description in order to run Cronet |
112 tests in addition to CQ try bots. | 109 tests in addition to CQ try bots. |
113 """ | 110 """ |
114 rietveld_obj = cl.RpcServer() | 111 return output_api.EnsureCQIncludeTrybotsAreAdded( |
115 issue = cl.issue | 112 cl, |
116 description = rietveld_obj.get_description(issue) | 113 [ |
117 if re.search(r'^CQ_INCLUDE_TRYBOTS=.*', description, re.M | re.I): | 114 'master.tryserver.chromium.android:android_cronet_tester', |
118 return [] | 115 ], |
119 | 116 'Automatically added Cronet trybot to run tests on CQ.') |
120 masters = _GetTryMasters(None, change) | |
121 results = [] | |
122 new_description = description | |
123 new_description += '\nCQ_INCLUDE_TRYBOTS=%s' % ';'.join( | |
124 '%s:%s' % (master, ','.join(bots)) | |
125 for master, bots in masters.iteritems()) | |
126 results.append(output_api.PresubmitNotifyResult( | |
127 'Automatically added Cronet trybot to run tests on CQ.')) | |
128 | |
129 rietveld_obj.update_description(issue, new_description) | |
130 | |
131 return results | |
OLD | NEW |