Commit 021265ed authored by navabi@google.com's avatar navabi@google.com

If device does not come back after provisioning, add to bad devices.

BUG=391071

Review URL: https://codereview.chromium.org/442173002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287910 0039d316-1c4b-4281-b951-d872f2087c98
parent f1ecca7b
...@@ -21,6 +21,7 @@ import time ...@@ -21,6 +21,7 @@ import time
from pylib import android_commands from pylib import android_commands
from pylib import constants from pylib import constants
from pylib import device_settings from pylib import device_settings
from pylib.device import device_blacklist
from pylib.device import device_errors from pylib.device import device_errors
from pylib.device import device_utils from pylib.device import device_utils
...@@ -154,26 +155,12 @@ def WipeDevicesIfPossible(devices): ...@@ -154,26 +155,12 @@ def WipeDevicesIfPossible(devices):
device.WaitUntilFullyBooted(timeout=90) device.WaitUntilFullyBooted(timeout=90)
def ProvisionDevices(options): def ProvisionDevice(device_serial, is_perf, disable_location):
is_perf = 'perf' in os.environ.get('BUILDBOT_BUILDERNAME', '').lower()
# TODO(jbudorick): Parallelize provisioning of all attached devices after
# switching from AndroidCommands.
if options.device is not None:
devices = [options.device]
else:
devices = android_commands.GetAttachedDevices()
# Wipe devices (unless --skip-wipe was specified)
if not options.skip_wipe:
WipeDevicesIfPossible(devices)
# Provision devices
for device_serial in devices:
device = device_utils.DeviceUtils(device_serial) device = device_utils.DeviceUtils(device_serial)
device.old_interface.EnableAdbRoot() device.old_interface.EnableAdbRoot()
_ConfigureLocalProperties(device, is_perf) _ConfigureLocalProperties(device, is_perf)
device_settings_map = device_settings.DETERMINISTIC_DEVICE_SETTINGS device_settings_map = device_settings.DETERMINISTIC_DEVICE_SETTINGS
if options.disable_location: if disable_location:
device_settings_map.update(device_settings.DISABLE_LOCATION_SETTING) device_settings_map.update(device_settings.DISABLE_LOCATION_SETTING)
else: else:
device_settings_map.update(device_settings.ENABLE_LOCATION_SETTING) device_settings_map.update(device_settings.ENABLE_LOCATION_SETTING)
...@@ -206,16 +193,63 @@ def ProvisionDevices(options): ...@@ -206,16 +193,63 @@ def ProvisionDevices(options):
time.sleep(60) time.sleep(60)
battery_info = device.old_interface.GetBatteryInfo() battery_info = device.old_interface.GetBatteryInfo()
device.RunShellCommand('date -u %f' % time.time(), as_root=True) device.RunShellCommand('date -u %f' % time.time(), as_root=True)
def ProvisionDevices(options):
is_perf = 'perf' in os.environ.get('BUILDBOT_BUILDERNAME', '').lower()
# TODO(jbudorick): Parallelize provisioning of all attached devices after
# switching from AndroidCommands.
if options.device is not None:
devices = [options.device]
else:
devices = android_commands.GetAttachedDevices()
# Wipe devices (unless --skip-wipe was specified)
if not options.skip_wipe:
WipeDevicesIfPossible(devices)
bad_devices = []
# Provision devices
for device_serial in devices:
try:
ProvisionDevice(device_serial, is_perf, options.disable_location)
except errors.WaitForResponseTimedOutError:
logging.info('Timed out waiting for device %s. Adding to blacklist.',
device_serial)
bad_devices.append(device_serial)
# Device black list is reset by bb_device_status_check.py per build.
device_blacklist.ExtendBlacklist([device_serial])
devices = [device for device in devices if device not in bad_devices]
# If there are no good devices
if not devices:
raise device_errors.NoDevicesError
try: try:
device_utils.DeviceUtils.parallel(devices).Reboot(True) device_utils.DeviceUtils.parallel(devices).Reboot(True)
except errors.DeviceUnresponsiveError: except errors.DeviceUnresponsiveError:
pass pass
bad_devices = []
for device_serial in devices: for device_serial in devices:
device = device_utils.DeviceUtils(device_serial) device = device_utils.DeviceUtils(device_serial)
try:
device.WaitUntilFullyBooted(timeout=90) device.WaitUntilFullyBooted(timeout=90)
(_, props) = device.old_interface.GetShellCommandStatusAndOutput('getprop') (_, prop) = device.old_interface.GetShellCommandStatusAndOutput('getprop')
for prop in props: for p in prop:
print prop print p
except errors.WaitForResponseTimedOutError:
logging.info('Timed out waiting for device %s. Adding to blacklist.',
device_serial)
bad_devices.append(device_serial)
# Device black list is reset by bb_device_status_check.py per build.
device_blacklist.ExtendBlacklist([device_serial])
devices = [device for device in devices if device not in bad_devices]
# If there are no good devices
if not devices:
raise device_errors.NoDevicesError
if options.auto_reconnect: if options.auto_reconnect:
PushAndLaunchAdbReboot(devices, options.target) PushAndLaunchAdbReboot(devices, options.target)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment