Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: components/cronet/PRESUBMIT.py

Issue 2514653004: [Cronet] Add Cronet trybot to list of CQ bots for Cronet CLs. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 def _PyLintChecks(input_api, output_api): 14 def _PyLintChecks(input_api, output_api):
12 pylint_checks = input_api.canned_checks.GetPylint(input_api, output_api, 15 pylint_checks = input_api.canned_checks.GetPylint(input_api, output_api,
13 extra_paths_list=_GetPathsToPrepend(input_api), pylintrc='pylintrc') 16 extra_paths_list=_GetPathsToPrepend(input_api), pylintrc='pylintrc')
14 return input_api.RunTests(pylint_checks) 17 return input_api.RunTests(pylint_checks)
15 18
19
16 def _GetPathsToPrepend(input_api): 20 def _GetPathsToPrepend(input_api):
17 current_dir = input_api.PresubmitLocalPath() 21 current_dir = input_api.PresubmitLocalPath()
18 chromium_src_dir = input_api.os_path.join(current_dir, '..', '..') 22 chromium_src_dir = input_api.os_path.join(current_dir, '..', '..')
19 return [ 23 return [
20 input_api.os_path.join(current_dir, 'tools'), 24 input_api.os_path.join(current_dir, 'tools'),
21 input_api.os_path.join(current_dir, 'android', 'test', 'javaperftests'), 25 input_api.os_path.join(current_dir, 'android', 'test', 'javaperftests'),
22 input_api.os_path.join(chromium_src_dir, 'tools', 'perf'), 26 input_api.os_path.join(chromium_src_dir, 'tools', 'perf'),
23 input_api.os_path.join(chromium_src_dir, 'build', 'android'), 27 input_api.os_path.join(chromium_src_dir, 'build', 'android'),
24 input_api.os_path.join(chromium_src_dir, 'build', 'android', 'gyp', 'util'), 28 input_api.os_path.join(chromium_src_dir, 'build', 'android', 'gyp', 'util'),
25 input_api.os_path.join(chromium_src_dir, 'net', 'tools', 'net_docs'), 29 input_api.os_path.join(chromium_src_dir, 'net', 'tools', 'net_docs'),
26 input_api.os_path.join(chromium_src_dir, 'tools'), 30 input_api.os_path.join(chromium_src_dir, 'tools'),
27 input_api.os_path.join(chromium_src_dir, 'third_party'), 31 input_api.os_path.join(chromium_src_dir, 'third_party'),
28 input_api.os_path.join(chromium_src_dir, 32 input_api.os_path.join(chromium_src_dir,
29 'third_party', 'catapult', 'telemetry'), 33 'third_party', 'catapult', 'telemetry'),
30 input_api.os_path.join(chromium_src_dir, 34 input_api.os_path.join(chromium_src_dir,
31 'third_party', 'catapult', 'devil'), 35 'third_party', 'catapult', 'devil'),
32 ] 36 ]
33 37
38
34 def _PackageChecks(input_api, output_api): 39 def _PackageChecks(input_api, output_api):
35 """Verify API classes are in org.chromium.net package, and implementation 40 """Verify API classes are in org.chromium.net package, and implementation
36 classes are not in org.chromium.net package.""" 41 classes are not in org.chromium.net package."""
37 api_file_pattern = input_api.re.compile( 42 api_file_pattern = input_api.re.compile(
38 r'^components/cronet/android/api/.*\.(java|template)$') 43 r'^components/cronet/android/api/.*\.(java|template)$')
39 impl_file_pattern = input_api.re.compile( 44 impl_file_pattern = input_api.re.compile(
40 r'^components/cronet/android/java/.*\.(java|template)$') 45 r'^components/cronet/android/java/.*\.(java|template)$')
41 api_package_pattern = input_api.re.compile(r'^package (?!org.chromium.net;)') 46 api_package_pattern = input_api.re.compile(r'^package (?!org.chromium.net;)')
42 impl_package_pattern = input_api.re.compile(r'^package org.chromium.net;') 47 impl_package_pattern = input_api.re.compile(r'^package org.chromium.net;')
43 48
(...skipping 14 matching lines...) Expand all
58 '%s:%d\n %s' % (local_path, line_number, line.strip())) 63 '%s:%d\n %s' % (local_path, line_number, line.strip()))
59 64
60 if problems: 65 if problems:
61 return [output_api.PresubmitError( 66 return [output_api.PresubmitError(
62 'API classes must be in org.chromium.net package, and implementation\n' 67 'API classes must be in org.chromium.net package, and implementation\n'
63 'classes must not be in org.chromium.net package.', 68 'classes must not be in org.chromium.net package.',
64 problems)] 69 problems)]
65 else: 70 else:
66 return [] 71 return []
67 72
73
68 def CheckChangeOnUpload(input_api, output_api): 74 def CheckChangeOnUpload(input_api, output_api):
69 results = [] 75 results = []
70 results.extend(_PyLintChecks(input_api, output_api)) 76 results.extend(_PyLintChecks(input_api, output_api))
71 results.extend( 77 results.extend(
72 input_api.canned_checks.CheckPatchFormatted(input_api, output_api)) 78 input_api.canned_checks.CheckPatchFormatted(input_api, output_api))
73 results.extend(_PackageChecks(input_api, output_api)) 79 results.extend(_PackageChecks(input_api, output_api))
74 return results 80 return results
81
82
83 def _GetTryMasters(project, change):
84 return {
85 'master.tryserver.chromium.android': {
86 'android_cronet_tester': [],
87 },
88 }
89
90
91 def GetPreferredTryMasters(project, change):
92 # TODO(nick, dcheng): Using the value of _GetTryMasters() instead of an empty
93 # value here would cause 'git cl try' to include the Cronet trybot,
94 # which would be nice. But it has the side effect of replacing, rather than
95 # augmenting, the default set of try servers. Re-enable this when we figure
96 # out a way to augment the default set.
97 return {}
98
99
100 def PostUploadHook(cl, change, output_api):
101 """git cl upload will call this hook after the issue is created/modified.
102
103 This hook adds an extra try bot to the CL description in order to run Cronet
104 tests in addition to CQ try bots.
105 """
106 rietveld_obj = cl.RpcServer()
107 issue = cl.issue
108 description = rietveld_obj.get_description(issue)
109 if re.search(r'^CQ_INCLUDE_TRYBOTS=.*', description, re.M | re.I):
110 return []
111
112 masters = _GetTryMasters(None, change)
113 results = []
114 new_description = description
115 new_description += '\nCQ_INCLUDE_TRYBOTS=%s' % ';'.join(
116 '%s:%s' % (master, ','.join(bots))
117 for master, bots in masters.iteritems())
118 results.append(output_api.PresubmitNotifyResult(
119 'Automatically added Cronet trybot to run tests on CQ.'))
120
121 rietveld_obj.update_description(issue, new_description)
122
123 return results
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698