OLD | NEW |
---|---|
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 import contextlib | 5 import contextlib |
6 import datetime | 6 import datetime |
7 import json | 7 import json |
8 import os | 8 import os |
9 import pipes | 9 import pipes |
10 import re | 10 import re |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
311 def use_devil_adb(self): | 311 def use_devil_adb(self): |
312 # TODO(jbudorick): Remove this after resolving | 312 # TODO(jbudorick): Remove this after resolving |
313 # https://github.com/catapult-project/catapult/issues/2901 | 313 # https://github.com/catapult-project/catapult/issues/2901 |
314 devil_path = self.m.path['checkout'].join('third_party', 'catapult', 'devil' ) | 314 devil_path = self.m.path['checkout'].join('third_party', 'catapult', 'devil' ) |
315 self.m.python.inline( | 315 self.m.python.inline( |
316 'initialize devil', | 316 'initialize devil', |
317 """ | 317 """ |
318 import sys | 318 import sys |
319 sys.path.append(sys.argv[1]) | 319 sys.path.append(sys.argv[1]) |
320 from devil import devil_env | 320 from devil import devil_env |
321 from devil.android.sdk import adb_wrapper | |
321 devil_env.config.Initialize() | 322 devil_env.config.Initialize() |
322 devil_env.config.PrefetchPaths(dependencies=['adb']) | 323 devil_env.config.PrefetchPaths(dependencies=['adb']) |
324 adb_wrapper.AdbWrapper.StartServer() | |
323 """, | 325 """, |
324 args=[devil_path]) | 326 args=[devil_path]) |
325 self.m.adb.set_adb_path( | 327 self.m.adb.set_adb_path( |
326 devil_path.join('bin', 'deps', 'linux2', 'x86_64', 'bin', 'adb')) | 328 devil_path.join('bin', 'deps', 'linux2', 'x86_64', 'bin', 'adb')) |
327 | 329 |
328 def create_adb_symlink(self): | 330 def create_adb_symlink(self): |
329 # Creates a sym link to the adb executable in the home dir | 331 # Creates a sym link to the adb executable in the home dir |
330 self.m.python( | 332 self.m.python( |
331 'create adb symlink', | 333 'create adb symlink', |
332 self.m.path['checkout'].join('build', 'symlink.py'), | 334 self.m.path['checkout'].join('build', 'symlink.py'), |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1154 self.asan_device_setup() | 1156 self.asan_device_setup() |
1155 | 1157 |
1156 def common_tests_final_steps(self, logcat_gs_bucket='chromium-android'): | 1158 def common_tests_final_steps(self, logcat_gs_bucket='chromium-android'): |
1157 self.shutdown_device_monitor() | 1159 self.shutdown_device_monitor() |
1158 self.logcat_dump(gs_bucket=logcat_gs_bucket) | 1160 self.logcat_dump(gs_bucket=logcat_gs_bucket) |
1159 self.stack_tool_steps() | 1161 self.stack_tool_steps() |
1160 if self.m.chromium.c.gyp_env.GYP_DEFINES.get('asan', 0) == 1: | 1162 if self.m.chromium.c.gyp_env.GYP_DEFINES.get('asan', 0) == 1: |
1161 self.asan_device_teardown() | 1163 self.asan_device_teardown() |
1162 self.test_report() | 1164 self.test_report() |
1163 | 1165 |
1166 def android_build_wrapper(self, logcat_gs_bucket='chromium-android'): | |
ghost stip (do not use)
2016/11/09 01:55:56
this wacky construction of a contextmanager-genera
jbudorick
2016/11/09 14:32:36
On looking at this, a config setting probably woul
| |
1167 @contextlib.contextmanager | |
1168 def wrapper(bisect_obj): | |
1169 """A context manager for use as auto_bisect's build_context_mgr. | |
1170 | |
1171 This wraps every overall bisect run. | |
1172 """ | |
1173 try: | |
1174 bisect_obj.m.chromium_android.common_tests_setup_steps( | |
1175 perf_setup=True, remove_system_webview=True) | |
1176 bisect_obj.m.chromium.runhooks() | |
1177 | |
1178 yield | |
1179 finally: | |
1180 bisect_obj.ensure_checkout() | |
1181 bisect_obj.m.chromium_android.common_tests_final_steps( | |
1182 logcat_gs_bucket=logcat_gs_bucket) | |
1183 return wrapper | |
1184 | |
1185 def android_bisect_test_wrapper(self, logcat_gs_bucket='chromium-android'): | |
1186 @contextlib.contextmanager | |
1187 def wrapper(bisect_obj): | |
1188 """A context manager for use as auto_bisect's test_context_mgr. | |
1189 | |
1190 This wraps each individual bisect test. | |
1191 """ | |
1192 self.use_devil_adb() | |
1193 with self.android_test_wrapper(logcat_gs_bucket)(bisect_obj): | |
ghost stip (do not use)
2016/11/09 01:55:56
this split is so android_test_wrapper can be used
jbudorick
2016/11/09 14:32:36
I think this belongs in the bisect modules rather
RobertoCN
2016/11/09 22:10:31
+1
ghost stip (do not use)
2016/11/09 23:05:37
Done.
| |
1194 yield | |
1195 return wrapper | |
1196 | |
1197 def android_test_wrapper(self, logcat_gs_bucket='chromium-android'): | |
1198 @contextlib.contextmanager | |
1199 def wrapper(_bisect_obj): | |
1200 """A context manager for running android test steps.""" | |
1201 try: | |
1202 self.spawn_logcat_monitor() | |
1203 self.spawn_device_monitor() | |
1204 | |
1205 yield | |
1206 finally: | |
1207 self.shutdown_device_monitor() | |
1208 self.logcat_dump(gs_bucket=logcat_gs_bucket) | |
1209 self.stack_tool_steps() | |
1210 return wrapper | |
1211 | |
1164 def run_bisect_script(self, extra_src='', path_to_config='', **kwargs): | 1212 def run_bisect_script(self, extra_src='', path_to_config='', **kwargs): |
1165 self.m.step('prepare bisect perf regression', | 1213 self.m.step('prepare bisect perf regression', |
1166 [self.m.path['checkout'].join('tools', | 1214 [self.m.path['checkout'].join('tools', |
1167 'prepare-bisect-perf-regression.py'), | 1215 'prepare-bisect-perf-regression.py'), |
1168 '-w', self.m.path['slave_build']]) | 1216 '-w', self.m.path['slave_build']]) |
1169 | 1217 |
1170 args = [] | 1218 args = [] |
1171 if extra_src: | 1219 if extra_src: |
1172 args = args + ['--extra_src', extra_src] | 1220 args = args + ['--extra_src', extra_src] |
1173 if path_to_config: | 1221 if path_to_config: |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1614 script = self.c.test_runner | 1662 script = self.c.test_runner |
1615 if wrapper_script_suite_name: | 1663 if wrapper_script_suite_name: |
1616 script = self.m.chromium.output_dir.join('bin', 'run_%s' % | 1664 script = self.m.chromium.output_dir.join('bin', 'run_%s' % |
1617 wrapper_script_suite_name) | 1665 wrapper_script_suite_name) |
1618 else: | 1666 else: |
1619 env = kwargs.get('env', {}) | 1667 env = kwargs.get('env', {}) |
1620 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR', | 1668 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR', |
1621 self.m.chromium.output_dir) | 1669 self.m.chromium.output_dir) |
1622 kwargs['env'] = env | 1670 kwargs['env'] = env |
1623 return self.m.python(step_name, script, args, **kwargs) | 1671 return self.m.python(step_name, script, args, **kwargs) |
OLD | NEW |