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 os | 5 import os |
6 import re | 6 import re |
7 import urllib | 7 import urllib |
8 | 8 |
9 from infra.libs.infra_types import freeze | 9 from infra.libs.infra_types import freeze |
10 from slave import recipe_api | 10 from slave import recipe_api |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 286 |
287 def spawn_logcat_monitor(self): | 287 def spawn_logcat_monitor(self): |
288 self.m.step( | 288 self.m.step( |
289 'spawn_logcat_monitor', | 289 'spawn_logcat_monitor', |
290 [self.m.path['build'].join('scripts', 'slave', 'daemonizer.py'), | 290 [self.m.path['build'].join('scripts', 'slave', 'daemonizer.py'), |
291 '--', self.c.cr_build_android.join('adb_logcat_monitor.py'), | 291 '--', self.c.cr_build_android.join('adb_logcat_monitor.py'), |
292 self.m.chromium.c.build_dir.join('logcat')], | 292 self.m.chromium.c.build_dir.join('logcat')], |
293 env=self.m.chromium.get_env(), | 293 env=self.m.chromium.get_env(), |
294 infra_step=True) | 294 infra_step=True) |
295 | 295 |
| 296 |
| 297 def authorize_adb_devices(self): |
| 298 script = self.m.path['build'].join('scripts', 'slave', 'android', |
| 299 'authorize_adb_devices.py') |
| 300 args = ['--adb-path', self.m.path['checkout'].join('third_party', |
| 301 'android_tools', 'sdk', 'platform-tools', 'adb')] |
| 302 return self.m.python('authorize_adb_devices', script, args, infra_step=True, |
| 303 env=self.m.chromium.get_env()) |
| 304 |
| 305 |
296 def detect_and_setup_devices(self, restart_usb=False, skip_wipe=False, | 306 def detect_and_setup_devices(self, restart_usb=False, skip_wipe=False, |
297 disable_location=False, min_battery_level=None, | 307 disable_location=False, min_battery_level=None, |
298 disable_network=False, disable_java_debug=False, | 308 disable_network=False, disable_java_debug=False, |
299 reboot_timeout=None): | 309 reboot_timeout=None): |
| 310 self.authorize_adb_devices() |
300 self.device_status_check(restart_usb=restart_usb) | 311 self.device_status_check(restart_usb=restart_usb) |
301 self.provision_devices( | 312 self.provision_devices( |
302 skip_wipe=skip_wipe, disable_location=disable_location, | 313 skip_wipe=skip_wipe, disable_location=disable_location, |
303 min_battery_level=min_battery_level, disable_network=disable_network, | 314 min_battery_level=min_battery_level, disable_network=disable_network, |
304 disable_java_debug=disable_java_debug, reboot_timeout=reboot_timeout) | 315 disable_java_debug=disable_java_debug, reboot_timeout=reboot_timeout) |
305 | 316 |
306 def device_status_check(self, restart_usb=False, **kwargs): | 317 def device_status_check(self, restart_usb=False, **kwargs): |
307 args = ['--json-output', self.m.json.output()] | 318 args = ['--json-output', self.m.json.output()] |
308 if restart_usb: | 319 if restart_usb: |
309 args += ['--restart-usb'] | 320 args += ['--restart-usb'] |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 os.remove(report) | 627 os.remove(report) |
617 """, | 628 """, |
618 args=[self.m.path['checkout'].join('out', | 629 args=[self.m.path['checkout'].join('out', |
619 self.m.chromium.c.BUILD_CONFIG, | 630 self.m.chromium.c.BUILD_CONFIG, |
620 'test_logs', | 631 'test_logs', |
621 '*.log')], | 632 '*.log')], |
622 ) | 633 ) |
623 | 634 |
624 def common_tests_setup_steps(self, perf_setup=False): | 635 def common_tests_setup_steps(self, perf_setup=False): |
625 self.spawn_logcat_monitor() | 636 self.spawn_logcat_monitor() |
| 637 self.authorize_adb_devices() |
626 self.device_status_check() | 638 self.device_status_check() |
627 if perf_setup: | 639 if perf_setup: |
628 kwargs = { | 640 kwargs = { |
629 'min_battery_level': 95, | 641 'min_battery_level': 95, |
630 'disable_network': True, | 642 'disable_network': True, |
631 'disable_java_debug': True} | 643 'disable_java_debug': True} |
632 else: | 644 else: |
633 kwargs = {} | 645 kwargs = {} |
634 self.provision_devices(**kwargs) | 646 self.provision_devices(**kwargs) |
635 | 647 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 return step_result | 763 return step_result |
752 except self.m.step.StepFailure as f: | 764 except self.m.step.StepFailure as f: |
753 step_result = f.result | 765 step_result = f.result |
754 raise | 766 raise |
755 finally: | 767 finally: |
756 if (step_result.retcode == EXIT_CODES['error']): | 768 if (step_result.retcode == EXIT_CODES['error']): |
757 step_result.presentation.status = self.m.step.FAILURE | 769 step_result.presentation.status = self.m.step.FAILURE |
758 elif (step_result.retcode == EXIT_CODES['infra']): | 770 elif (step_result.retcode == EXIT_CODES['infra']): |
759 step_result.presentation.status = self.m.step.EXCEPTION | 771 step_result.presentation.status = self.m.step.EXCEPTION |
760 elif (step_result.retcode == EXIT_CODES['warning']): | 772 elif (step_result.retcode == EXIT_CODES['warning']): |
761 step_result.presentation.status = self.m.step.WARNING | 773 step_result.presentation.status = self.m.step.WARNING |
OLD | NEW |