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 |
11 import sys | 11 import sys |
12 import textwrap | 12 import textwrap |
13 import urllib | 13 import urllib |
14 | 14 |
15 from recipe_engine.types import freeze | 15 from recipe_engine.types import freeze |
16 from recipe_engine import recipe_api | 16 from recipe_engine import recipe_api |
17 | 17 |
18 def _TimestampToIsoFormat(timestamp): | 18 def _TimestampToIsoFormat(timestamp): |
19 return datetime.datetime.utcfromtimestamp(timestamp).strftime('%Y%m%dT%H%M%S') | 19 return datetime.datetime.utcfromtimestamp(timestamp).strftime('%Y%m%dT%H%M%S') |
20 | 20 |
21 | 21 |
22 class AndroidApi(recipe_api.RecipeApi): | 22 class AndroidApi(recipe_api.RecipeApi): |
23 def __init__(self, **kwargs): | 23 def __init__(self, **kwargs): |
24 super(AndroidApi, self).__init__(**kwargs) | 24 super(AndroidApi, self).__init__(**kwargs) |
25 self._devices = None | 25 self._devices = None |
26 self._file_changes_path = None | 26 self._file_changes_path = None |
27 self.logcat_gs_bucket = 'chromium-android' | |
27 | 28 |
28 def get_config_defaults(self): | 29 def get_config_defaults(self): |
29 return { | 30 return { |
30 'REVISION': self.m.properties.get('revision', ''), | 31 'REVISION': self.m.properties.get('revision', ''), |
31 'CHECKOUT_PATH': self.m.path['checkout'], | 32 'CHECKOUT_PATH': self.m.path['checkout'], |
32 } | 33 } |
33 | 34 |
34 @property | 35 @property |
35 def devices(self): | 36 def devices(self): |
36 assert self._devices is not None,\ | 37 assert self._devices is not None,\ |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
312 # TODO(jbudorick): Remove this after resolving | 313 # TODO(jbudorick): Remove this after resolving |
313 # https://github.com/catapult-project/catapult/issues/2901 | 314 # https://github.com/catapult-project/catapult/issues/2901 |
314 devil_path = self.m.path['checkout'].join('third_party', 'catapult', 'devil' ) | 315 devil_path = self.m.path['checkout'].join('third_party', 'catapult', 'devil' ) |
315 self.m.python.inline( | 316 self.m.python.inline( |
316 'initialize devil', | 317 'initialize devil', |
317 """ | 318 """ |
318 import sys | 319 import sys |
319 sys.path.append(sys.argv[1]) | 320 sys.path.append(sys.argv[1]) |
320 from devil import devil_env | 321 from devil import devil_env |
321 devil_env.config.Initialize() | 322 devil_env.config.Initialize() |
322 devil_env.config.PrefetchPaths(dependencies=['adb']) | 323 devil_env.config.PrefetchPaths(dependencies=['adb']) |
jbudorick
2016/11/08 00:18:31
We might want to modify this to also start the adb
| |
323 """, | 324 """, |
324 args=[devil_path]) | 325 args=[devil_path]) |
325 self.m.adb.set_adb_path( | 326 self.m.adb.set_adb_path( |
326 devil_path.join('bin', 'deps', 'linux2', 'x86_64', 'bin', 'adb')) | 327 devil_path.join('bin', 'deps', 'linux2', 'x86_64', 'bin', 'adb')) |
327 | 328 |
328 def create_adb_symlink(self): | 329 def create_adb_symlink(self): |
329 # Creates a sym link to the adb executable in the home dir | 330 # Creates a sym link to the adb executable in the home dir |
330 self.m.python( | 331 self.m.python( |
331 'create adb symlink', | 332 'create adb symlink', |
332 self.m.path['checkout'].join('build', 'symlink.py'), | 333 self.m.path['checkout'].join('build', 'symlink.py'), |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1146 else: | 1147 else: |
1147 kwargs = {} | 1148 kwargs = {} |
1148 if skip_wipe: | 1149 if skip_wipe: |
1149 kwargs['skip_wipe'] = True | 1150 kwargs['skip_wipe'] = True |
1150 self.provision_devices(remove_system_webview=remove_system_webview, | 1151 self.provision_devices(remove_system_webview=remove_system_webview, |
1151 **kwargs) | 1152 **kwargs) |
1152 self.device_status() | 1153 self.device_status() |
1153 if self.m.chromium.c.gyp_env.GYP_DEFINES.get('asan', 0) == 1: | 1154 if self.m.chromium.c.gyp_env.GYP_DEFINES.get('asan', 0) == 1: |
1154 self.asan_device_setup() | 1155 self.asan_device_setup() |
1155 | 1156 |
1156 def common_tests_final_steps(self, logcat_gs_bucket='chromium-android'): | 1157 def common_tests_final_steps(self): |
ghost stip (do not use)
2016/11/07 23:57:48
I had to pull this out so that we could make the l
jbudorick
2016/11/08 00:18:31
You could also do something like
def create_and
ghost stip (do not use)
2016/11/08 20:56:33
logcat_dump might be called outside of it though,
jbudorick
2016/11/08 21:37:08
At that point, I think it's on the caller.
We cou
| |
1157 self.shutdown_device_monitor() | 1158 self.shutdown_device_monitor() |
1158 self.logcat_dump(gs_bucket=logcat_gs_bucket) | 1159 self.logcat_dump(gs_bucket=self.logcat_gs_bucket) |
1159 self.stack_tool_steps() | 1160 self.stack_tool_steps() |
1160 if self.m.chromium.c.gyp_env.GYP_DEFINES.get('asan', 0) == 1: | 1161 if self.m.chromium.c.gyp_env.GYP_DEFINES.get('asan', 0) == 1: |
1161 self.asan_device_teardown() | 1162 self.asan_device_teardown() |
1162 self.test_report() | 1163 self.test_report() |
1163 | 1164 |
1165 @contextlib.contextmanager | |
1166 def android_build_wrapper(self, api): | |
1167 """A context manager for use as auto_bisect's build_context_mgr. | |
1168 | |
1169 This wraps every overall bisect run. | |
1170 """ | |
1171 try: | |
1172 api.chromium_android.common_tests_setup_steps( | |
1173 perf_setup=True, remove_system_webview=True) | |
1174 api.chromium.runhooks() | |
1175 | |
1176 yield | |
1177 finally: | |
1178 api.auto_bisect.ensure_checkout() | |
1179 api.chromium_android.common_tests_final_steps() | |
1180 | |
1181 @contextlib.contextmanager | |
1182 def android_test_wrapper(self, api): | |
1183 """A context manager for use as auto_bisect's test_context_mgr. | |
1184 | |
1185 This wraps each individual bisect test. | |
1186 """ | |
1187 try: | |
1188 self.use_devil_adb() | |
ghost stip (do not use)
2016/11/07 23:57:48
this is the "new logic" of the CL. does it look ok
jbudorick
2016/11/08 00:18:31
I'm not sure that we'll want to do this every time
ghost stip (do not use)
2016/11/08 20:56:32
isn't that the whole point of doing this work?
jbudorick
2016/11/08 21:37:08
For bisect, yes. I would be interested in using th
| |
1189 self.spawn_logcat_monitor() | |
1190 self.spawn_device_monitor() | |
1191 | |
1192 yield | |
1193 finally: | |
1194 self.shutdown_device_monitor() | |
1195 self.logcat_dump(gs_bucket=self.logcat_gs_bucket) | |
1196 self.stack_tool_steps() | |
ghost stip (do not use)
2016/11/07 23:57:48
do we need this? do we want it?
jbudorick
2016/11/08 00:18:31
Yes and yes. Us not having stack symbolization on
ghost stip (do not use)
2016/11/08 20:56:32
ok, I wasn't sure if I was duplicating some other
| |
1197 | |
1164 def run_bisect_script(self, extra_src='', path_to_config='', **kwargs): | 1198 def run_bisect_script(self, extra_src='', path_to_config='', **kwargs): |
1165 self.m.step('prepare bisect perf regression', | 1199 self.m.step('prepare bisect perf regression', |
1166 [self.m.path['checkout'].join('tools', | 1200 [self.m.path['checkout'].join('tools', |
1167 'prepare-bisect-perf-regression.py'), | 1201 'prepare-bisect-perf-regression.py'), |
1168 '-w', self.m.path['slave_build']]) | 1202 '-w', self.m.path['slave_build']]) |
1169 | 1203 |
1170 args = [] | 1204 args = [] |
1171 if extra_src: | 1205 if extra_src: |
1172 args = args + ['--extra_src', extra_src] | 1206 args = args + ['--extra_src', extra_src] |
1173 if path_to_config: | 1207 if path_to_config: |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1614 script = self.c.test_runner | 1648 script = self.c.test_runner |
1615 if wrapper_script_suite_name: | 1649 if wrapper_script_suite_name: |
1616 script = self.m.chromium.output_dir.join('bin', 'run_%s' % | 1650 script = self.m.chromium.output_dir.join('bin', 'run_%s' % |
1617 wrapper_script_suite_name) | 1651 wrapper_script_suite_name) |
1618 else: | 1652 else: |
1619 env = kwargs.get('env', {}) | 1653 env = kwargs.get('env', {}) |
1620 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR', | 1654 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR', |
1621 self.m.chromium.output_dir) | 1655 self.m.chromium.output_dir) |
1622 kwargs['env'] = env | 1656 kwargs['env'] = env |
1623 return self.m.python(step_name, script, args, **kwargs) | 1657 return self.m.python(step_name, script, args, **kwargs) |
OLD | NEW |