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

Side by Side Diff: scripts/slave/recipes/android/tester.py

Issue 591333002: [Android] Run java unit tests on the android tester bots. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: rebase Created 6 years, 2 months 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 DEPS = [ 5 DEPS = [
6 'adb', 6 'adb',
7 'bot_update', 7 'bot_update',
8 'chromium', 8 'chromium',
9 'chromium_android', 9 'chromium_android',
10 'filter', 10 'filter',
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 [ 'media_unittests', None ], 71 [ 'media_unittests', None ],
72 [ 'net_unittests', None ], 72 [ 'net_unittests', None ],
73 [ 'sandbox_linux_unittests', None ], 73 [ 'sandbox_linux_unittests', None ],
74 [ 'sql_unittests', None ], 74 [ 'sql_unittests', None ],
75 [ 'sync_unit_tests', None ], 75 [ 'sync_unit_tests', None ],
76 [ 'ui_unittests', None ], 76 [ 'ui_unittests', None ],
77 [ 'unit_tests', None ], 77 [ 'unit_tests', None ],
78 [ 'webkit_unit_tests', None ], 78 [ 'webkit_unit_tests', None ],
79 ] 79 ]
80 80
81 JAVA_UNIT_TESTS = [
82 'junit_unit_tests',
83 ]
84
81 TELEMETRY_UNIT_TESTS = [ 85 TELEMETRY_UNIT_TESTS = [
82 [ 'telemetry_unittests', None ], 86 [ 'telemetry_unittests', None ],
83 [ 'telemetry_perf_unittests', None ], 87 [ 'telemetry_perf_unittests', None ],
84 ] 88 ]
85 89
86 BUILDERS = { 90 BUILDERS = {
87 'tryserver.chromium.linux': { 91 'tryserver.chromium.linux': {
88 'android_dbg_tests_recipe': { 92 'android_dbg_tests_recipe': {
89 'config': 'main_builder', 93 'config': 'main_builder',
90 'instrumentation_tests': INSTRUMENTATION_TESTS, 94 'instrumentation_tests': INSTRUMENTATION_TESTS,
91 'unittests': UNIT_TESTS, 95 'unittests': UNIT_TESTS,
96 'java_unittests': JAVA_UNIT_TESTS,
92 'target': 'Debug', 97 'target': 'Debug',
93 'try': True, 98 'try': True,
94 }, 99 },
95 'android_rel_tests_recipe': { 100 'android_rel_tests_recipe': {
96 'config': 'main_builder', 101 'config': 'main_builder',
97 'instrumentation_tests': INSTRUMENTATION_TESTS, 102 'instrumentation_tests': INSTRUMENTATION_TESTS,
98 'unittests': TELEMETRY_UNIT_TESTS, 103 'unittests': TELEMETRY_UNIT_TESTS,
104 'java_unittests': JAVA_UNIT_TESTS,
99 'target': 'Release', 105 'target': 'Release',
100 'try': True, 106 'try': True,
101 }, 107 },
102 } 108 }
103 } 109 }
104 110
105 def GenSteps(api): 111 def GenSteps(api):
106 # Required for us to be able to use filter. 112 # Required for us to be able to use filter.
107 api.chromium_android.set_config('base_config') 113 api.chromium_android.set_config('base_config')
108 114
(...skipping 12 matching lines...) Expand all
121 api.gclient.apply_config('android') 127 api.gclient.apply_config('android')
122 api.gclient.apply_config('chrome_internal') 128 api.gclient.apply_config('chrome_internal')
123 129
124 api.bot_update.ensure_checkout() 130 api.bot_update.ensure_checkout()
125 api.chromium_android.clean_local_files() 131 api.chromium_android.clean_local_files()
126 api.chromium_android.runhooks() 132 api.chromium_android.runhooks()
127 133
128 compile_targets = None 134 compile_targets = None
129 instrumentation_tests = bot_config.get('instrumentation_tests', []) 135 instrumentation_tests = bot_config.get('instrumentation_tests', [])
130 unittests = bot_config.get('unittests', []) 136 unittests = bot_config.get('unittests', [])
137 java_unittests = bot_config.get('java_unittests', [])
131 is_trybot = bot_config.get('try', False) 138 is_trybot = bot_config.get('try', False)
132 if is_trybot: 139 if is_trybot:
133 api.tryserver.maybe_apply_issue() 140 api.tryserver.maybe_apply_issue()
134 141
135 # Early out if we haven't changed any relevant code. 142 # Early out if we haven't changed any relevant code.
136 test_names = [] 143 test_names = []
137 test_names.extend([suite['gyp_target'] for suite in instrumentation_tests]) 144 test_names.extend([suite['gyp_target'] for suite in instrumentation_tests])
138 test_names.extend([suite for suite, _ in unittests]) 145 test_names.extend([suite for suite, _ in unittests])
146 test_names.extend(java_unittests)
139 147
140 compile_targets = api.chromium.c.compile_py.default_targets 148 compile_targets = api.chromium.c.compile_py.default_targets
141 api.filter.does_patch_require_compile( 149 api.filter.does_patch_require_compile(
142 exes=test_names, 150 exes=test_names,
143 compile_targets=compile_targets, 151 compile_targets=compile_targets,
144 additional_name='chromium', 152 additional_name='chromium',
145 config_file_name='trybot_analyze_config.json') 153 config_file_name='trybot_analyze_config.json')
146 if not api.filter.result: 154 if not api.filter.result:
147 return 155 return
148 compile_targets = list(set(compile_targets) & 156 compile_targets = list(set(compile_targets) &
149 set(api.filter.compile_targets)) if \ 157 set(api.filter.compile_targets)) if \
150 compile_targets else api.filter.compile_targets 158 compile_targets else api.filter.compile_targets
151 instrumentation_tests = [i for i in instrumentation_tests if \ 159 instrumentation_tests = [i for i in instrumentation_tests if \
152 i['gyp_target'] in api.filter.matching_exes] 160 i['gyp_target'] in api.filter.matching_exes]
153 unittests = [i for i in unittests if i[0] in api.filter.matching_exes] 161 unittests = [i for i in unittests if i[0] in api.filter.matching_exes]
162 java_unittests = [i for i in java_unittests
163 if i in api.filter.matching_exes]
154 164
155 api.chromium_android.run_tree_truth() 165 api.chromium_android.run_tree_truth()
156 api.chromium_android.compile(targets=compile_targets) 166 api.chromium_android.compile(targets=compile_targets)
157 167
158 if not instrumentation_tests and not unittests: 168 if not instrumentation_tests and not unittests and not java_unittests:
159 return 169 return
160 170
161 api.adb.root_devices() 171 api.adb.root_devices()
162 172
163 api.chromium_android.spawn_logcat_monitor() 173 api.chromium_android.spawn_logcat_monitor()
164 api.chromium_android.detect_and_setup_devices() 174 api.chromium_android.detect_and_setup_devices()
165 175
166 with api.step.defer_results(): 176 with api.step.defer_results():
167 for suite in instrumentation_tests: 177 for suite in instrumentation_tests:
168 api.chromium_android.run_instrumentation_suite( 178 api.chromium_android.run_instrumentation_suite(
169 suite['test'], verbose=True, **suite.get('kwargs', {})) 179 suite['test'], verbose=True, **suite.get('kwargs', {}))
170 180
171 for suite, isolate_path in unittests: 181 for suite, isolate_path in unittests:
172 if isolate_path: 182 if isolate_path:
173 isolate_path = api.path['checkout'].join(*isolate_path) 183 isolate_path = api.path['checkout'].join(*isolate_path)
174 api.chromium_android.run_test_suite( 184 api.chromium_android.run_test_suite(
175 suite, 185 suite,
176 isolate_file_path=isolate_path) 186 isolate_file_path=isolate_path)
177 187
188 for suite in java_unittests:
189 api.chromium_android.run_java_unit_test_suite(suite)
190
178 api.chromium_android.logcat_dump(gs_bucket='chromium-android') 191 api.chromium_android.logcat_dump(gs_bucket='chromium-android')
179 api.chromium_android.stack_tool_steps() 192 api.chromium_android.stack_tool_steps()
180 api.chromium_android.test_report() 193 api.chromium_android.test_report()
181 194
182 def GenTests(api): 195 def GenTests(api):
183 for mastername in BUILDERS: 196 for mastername in BUILDERS:
184 for buildername in BUILDERS[mastername]: 197 for buildername in BUILDERS[mastername]:
185 yield ( 198 yield (
186 api.test(buildername) + 199 api.test(buildername) +
187 api.properties.generic( 200 api.properties.generic(
188 revision='4f4b02f6b7fa20a3a25682c457bbc8ad589c8a00', 201 revision='4f4b02f6b7fa20a3a25682c457bbc8ad589c8a00',
189 parent_buildername='parent_buildername', 202 parent_buildername='parent_buildername',
190 parent_buildnumber='1729', 203 parent_buildnumber='1729',
191 mastername=mastername, 204 mastername=mastername,
192 buildername=buildername, 205 buildername=buildername,
193 slavename='slavename', 206 slavename='slavename',
194 buildnumber='1337') + 207 buildnumber='1337') +
195 api.override_step_data( 208 api.override_step_data(
196 'analyze', 209 'analyze',
197 api.json.output({'status': 'Found dependency', 210 api.json.output({'status': 'Found dependency',
198 'targets': ['breakpad_unittests', 211 'targets': ['breakpad_unittests',
199 'chrome_shell_test_apk'], 212 'chrome_shell_test_apk',
213 'junit_unit_tests'],
200 'build_targets': ['breakpad_unittests', 214 'build_targets': ['breakpad_unittests',
201 'chrome_shell_test_apk']})) 215 'chrome_shell_test_apk',
216 'junit_unit_tests']}))
202 ) 217 )
203 218
204 yield ( 219 yield (
205 api.test('android_dbg_tests_recipe__content_browsertests_failure') + 220 api.test('android_dbg_tests_recipe__content_browsertests_failure') +
206 api.properties.generic( 221 api.properties.generic(
207 mastername='tryserver.chromium.linux', 222 mastername='tryserver.chromium.linux',
208 buildername='android_dbg_tests_recipe', 223 buildername='android_dbg_tests_recipe',
209 slavename='slavename') + 224 slavename='slavename') +
210 api.override_step_data( 225 api.override_step_data(
211 'analyze', 226 'analyze',
(...skipping 20 matching lines...) Expand all
232 yield ( 247 yield (
233 api.test('no_compile_because_of_analyze') + 248 api.test('no_compile_because_of_analyze') +
234 api.properties.generic( 249 api.properties.generic(
235 mastername='tryserver.chromium.linux', 250 mastername='tryserver.chromium.linux',
236 buildername='android_dbg_tests_recipe', 251 buildername='android_dbg_tests_recipe',
237 slavename='slavename') + 252 slavename='slavename') +
238 api.override_step_data( 253 api.override_step_data(
239 'analyze', 254 'analyze',
240 api.json.output({'status': 'No compile necessary'})) 255 api.json.output({'status': 'No compile necessary'}))
241 ) 256 )
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698