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

Side by Side Diff: build/android/pylib/device/device_utils.py

Issue 950893004: Add exit code for infra failures to testrunner script. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nits. Created 5 years, 9 months 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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 """Provides a variety of device interactions based on adb. 5 """Provides a variety of device interactions based on adb.
6 6
7 Eventually, this will be based on adb_wrapper. 7 Eventually, this will be based on adb_wrapper.
8 """ 8 """
9 # pylint: disable=unused-argument 9 # pylint: disable=unused-argument
10 10
(...skipping 11 matching lines...) Expand all
22 import pylib.android_commands 22 import pylib.android_commands
23 from pylib import cmd_helper 23 from pylib import cmd_helper
24 from pylib import constants 24 from pylib import constants
25 from pylib.device import adb_wrapper 25 from pylib.device import adb_wrapper
26 from pylib.device import decorators 26 from pylib.device import decorators
27 from pylib.device import device_errors 27 from pylib.device import device_errors
28 from pylib.device import intent 28 from pylib.device import intent
29 from pylib.device import logcat_monitor 29 from pylib.device import logcat_monitor
30 from pylib.device.commands import install_commands 30 from pylib.device.commands import install_commands
31 from pylib.utils import apk_helper 31 from pylib.utils import apk_helper
32 from pylib.utils import base_error
32 from pylib.utils import device_temp_file 33 from pylib.utils import device_temp_file
33 from pylib.utils import host_utils 34 from pylib.utils import host_utils
34 from pylib.utils import md5sum 35 from pylib.utils import md5sum
35 from pylib.utils import parallelizer 36 from pylib.utils import parallelizer
36 from pylib.utils import timeout_retry 37 from pylib.utils import timeout_retry
37 from pylib.utils import zip_utils 38 from pylib.utils import zip_utils
38 39
39 _DEFAULT_TIMEOUT = 30 40 _DEFAULT_TIMEOUT = 30
40 _DEFAULT_RETRIES = 3 41 _DEFAULT_RETRIES = 3
41 42
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 retries: number of retries 153 retries: number of retries
153 154
154 Returns: 155 Returns:
155 True if the device is online, False otherwise. 156 True if the device is online, False otherwise.
156 157
157 Raises: 158 Raises:
158 CommandTimeoutError on timeout. 159 CommandTimeoutError on timeout.
159 """ 160 """
160 try: 161 try:
161 return self.adb.GetState() == 'device' 162 return self.adb.GetState() == 'device'
162 except device_errors.BaseError as exc: 163 except base_error.BaseError as exc:
163 logging.info('Failed to get state: %s', exc) 164 logging.info('Failed to get state: %s', exc)
164 return False 165 return False
165 166
166 @decorators.WithTimeoutAndRetriesFromInstance() 167 @decorators.WithTimeoutAndRetriesFromInstance()
167 def HasRoot(self, timeout=None, retries=None): 168 def HasRoot(self, timeout=None, retries=None):
168 """Checks whether or not adbd has root privileges. 169 """Checks whether or not adbd has root privileges.
169 170
170 Args: 171 Args:
171 timeout: timeout in seconds 172 timeout: timeout in seconds
172 retries: number of retries 173 retries: number of retries
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 """ 1429 """
1429 if not devices: 1430 if not devices:
1430 devices = adb_wrapper.AdbWrapper.GetDevices() 1431 devices = adb_wrapper.AdbWrapper.GetDevices()
1431 if not devices: 1432 if not devices:
1432 raise device_errors.NoDevicesError() 1433 raise device_errors.NoDevicesError()
1433 devices = [d if isinstance(d, cls) else cls(d) for d in devices] 1434 devices = [d if isinstance(d, cls) else cls(d) for d in devices]
1434 if async: 1435 if async:
1435 return parallelizer.Parallelizer(devices) 1436 return parallelizer.Parallelizer(devices)
1436 else: 1437 else:
1437 return parallelizer.SyncParallelizer(devices) 1438 return parallelizer.SyncParallelizer(devices)
OLDNEW
« no previous file with comments | « build/android/pylib/device/device_errors.py ('k') | build/android/pylib/remote/device/remote_device_environment.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698