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

Side by Side Diff: scripts/slave/recipe_modules/chromium_android/api.py

Issue 2486923002: Use devil's adb with each bisect iteration, also start/stop daemons. (Closed)
Patch Set: Rebase and address comments. 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
OLDNEW
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
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
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'):
1167 @contextlib.contextmanager
1168 def wrapper(bisect_obj):
jbudorick 2016/11/09 23:51:46 nit: This shouldn't be "bisect_obj" if it's here.
jbudorick 2016/11/10 01:17:37 (and once ensure_checkout moves into bisect, this
ghost stip (do not use) 2016/11/11 01:08:17 Done.
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(
jbudorick 2016/11/09 23:51:45 When doing something like with android_build_wr
1175 perf_setup=True, remove_system_webview=True)
1176 bisect_obj.m.chromium.runhooks()
1177
1178 yield
1179 finally:
1180 bisect_obj.ensure_checkout()
jbudorick 2016/11/09 23:51:45 ...?
ghost stip (do not use) 2016/11/10 00:51:57 so we're in chromium_android. ensure_checkout is p
jbudorick 2016/11/10 01:00:29 Not following you here.
ghost stip (do not use) 2016/11/10 01:05:33 if we're okay with ensure_checkout coming after co
1181 bisect_obj.m.chromium_android.common_tests_final_steps(
1182 logcat_gs_bucket=logcat_gs_bucket)
1183 return wrapper
1184
1185 def android_test_wrapper(self, logcat_gs_bucket='chromium-android'):
1186 @contextlib.contextmanager
1187 def wrapper(_bisect_obj):
jbudorick 2016/11/09 23:51:45 nit: same
1188 """A context manager for running android test steps."""
1189 try:
1190 self.spawn_logcat_monitor()
1191 self.spawn_device_monitor()
1192
1193 yield
1194 finally:
1195 self.shutdown_device_monitor()
1196 self.logcat_dump(gs_bucket=logcat_gs_bucket)
1197 self.stack_tool_steps()
1198 return wrapper
1199
1164 def run_bisect_script(self, extra_src='', path_to_config='', **kwargs): 1200 def run_bisect_script(self, extra_src='', path_to_config='', **kwargs):
1165 self.m.step('prepare bisect perf regression', 1201 self.m.step('prepare bisect perf regression',
1166 [self.m.path['checkout'].join('tools', 1202 [self.m.path['checkout'].join('tools',
1167 'prepare-bisect-perf-regression.py'), 1203 'prepare-bisect-perf-regression.py'),
1168 '-w', self.m.path['slave_build']]) 1204 '-w', self.m.path['slave_build']])
1169 1205
1170 args = [] 1206 args = []
1171 if extra_src: 1207 if extra_src:
1172 args = args + ['--extra_src', extra_src] 1208 args = args + ['--extra_src', extra_src]
1173 if path_to_config: 1209 if path_to_config:
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 script = self.c.test_runner 1650 script = self.c.test_runner
1615 if wrapper_script_suite_name: 1651 if wrapper_script_suite_name:
1616 script = self.m.chromium.output_dir.join('bin', 'run_%s' % 1652 script = self.m.chromium.output_dir.join('bin', 'run_%s' %
1617 wrapper_script_suite_name) 1653 wrapper_script_suite_name)
1618 else: 1654 else:
1619 env = kwargs.get('env', {}) 1655 env = kwargs.get('env', {})
1620 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR', 1656 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR',
1621 self.m.chromium.output_dir) 1657 self.m.chromium.output_dir)
1622 kwargs['env'] = env 1658 kwargs['env'] = env
1623 return self.m.python(step_name, script, args, **kwargs) 1659 return self.m.python(step_name, script, args, **kwargs)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698