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 cmd = [self.m.path['build'].join('scripts', 'slave', 'android', | |
299 'authorize_adb_devices')] | |
Vadim Sh.
2015/03/05 05:20:26
authorize_adb_devices.py
| |
300 return self.m.step('authorize_adb_devices', cmd, infra_step=True, | |
301 env=self.m.chromium.get_env()) | |
302 | |
303 | |
296 def detect_and_setup_devices(self, restart_usb=False, skip_wipe=False, | 304 def detect_and_setup_devices(self, restart_usb=False, skip_wipe=False, |
297 disable_location=False, min_battery_level=None, | 305 disable_location=False, min_battery_level=None, |
298 disable_network=False, disable_java_debug=False, | 306 disable_network=False, disable_java_debug=False, |
299 reboot_timeout=None): | 307 reboot_timeout=None): |
308 self.authorize_adb_devices() | |
300 self.device_status_check(restart_usb=restart_usb) | 309 self.device_status_check(restart_usb=restart_usb) |
301 self.provision_devices( | 310 self.provision_devices( |
302 skip_wipe=skip_wipe, disable_location=disable_location, | 311 skip_wipe=skip_wipe, disable_location=disable_location, |
303 min_battery_level=min_battery_level, disable_network=disable_network, | 312 min_battery_level=min_battery_level, disable_network=disable_network, |
304 disable_java_debug=disable_java_debug, reboot_timeout=reboot_timeout) | 313 disable_java_debug=disable_java_debug, reboot_timeout=reboot_timeout) |
305 | 314 |
306 def device_status_check(self, restart_usb=False, **kwargs): | 315 def device_status_check(self, restart_usb=False, **kwargs): |
307 args = ['--json-output', self.m.json.output()] | 316 args = ['--json-output', self.m.json.output()] |
308 if restart_usb: | 317 if restart_usb: |
309 args += ['--restart-usb'] | 318 args += ['--restart-usb'] |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
615 os.remove(report) | 624 os.remove(report) |
616 """, | 625 """, |
617 args=[self.m.path['checkout'].join('out', | 626 args=[self.m.path['checkout'].join('out', |
618 self.m.chromium.c.BUILD_CONFIG, | 627 self.m.chromium.c.BUILD_CONFIG, |
619 'test_logs', | 628 'test_logs', |
620 '*.log')], | 629 '*.log')], |
621 ) | 630 ) |
622 | 631 |
623 def common_tests_setup_steps(self, perf_setup=False): | 632 def common_tests_setup_steps(self, perf_setup=False): |
624 self.spawn_logcat_monitor() | 633 self.spawn_logcat_monitor() |
634 self.authorize_adb_devices() | |
625 self.device_status_check() | 635 self.device_status_check() |
626 if perf_setup: | 636 if perf_setup: |
627 kwargs = { | 637 kwargs = { |
628 'min_battery_level': 95, | 638 'min_battery_level': 95, |
629 'disable_network': True, | 639 'disable_network': True, |
630 'disable_java_debug': True} | 640 'disable_java_debug': True} |
631 else: | 641 else: |
632 kwargs = {} | 642 kwargs = {} |
633 self.provision_devices(**kwargs) | 643 self.provision_devices(**kwargs) |
634 | 644 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
750 return step_result | 760 return step_result |
751 except self.m.step.StepFailure as f: | 761 except self.m.step.StepFailure as f: |
752 step_result = f.result | 762 step_result = f.result |
753 raise | 763 raise |
754 finally: | 764 finally: |
755 if (step_result.retcode == EXIT_CODES['error']): | 765 if (step_result.retcode == EXIT_CODES['error']): |
756 step_result.presentation.status = self.m.step.FAILURE | 766 step_result.presentation.status = self.m.step.FAILURE |
757 elif (step_result.retcode == EXIT_CODES['infra']): | 767 elif (step_result.retcode == EXIT_CODES['infra']): |
758 step_result.presentation.status = self.m.step.EXCEPTION | 768 step_result.presentation.status = self.m.step.EXCEPTION |
759 elif (step_result.retcode == EXIT_CODES['warning']): | 769 elif (step_result.retcode == EXIT_CODES['warning']): |
760 step_result.presentation.status = self.m.step.WARNING | 770 step_result.presentation.status = self.m.step.WARNING |
OLD | NEW |