[android] Retry data pushes that fail due to device busy.

BUG=261436
TEST=None
NOTRY=True

Review URL: https://chromiumcodereview.appspot.com/19471007

git-svn-id: http://src.chromium.org/svn/trunk/src/build@212396 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
craigdh@chromium.org 2013-07-18 19:25:56 +00:00
Родитель 587ccd0597
Коммит 079482f51d
1 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -781,8 +781,21 @@ class AndroidCommands(object):
# 60 seconds which isn't sufficient for a lot of users of this method.
push_command = 'push %s %s' % (local_path, device_path)
self._LogShell(push_command)
output = self._adb.SendCommand(push_command, timeout_time=30 * 60)
assert _HasAdbPushSucceeded(output)
# Retry push with increasing backoff if the device is busy.
retry = 0
while True:
output = self._adb.SendCommand(push_command, timeout_time=30 * 60)
if _HasAdbPushSucceeded(output):
return
if 'resource busy' in output and retry < 3:
retry += 1
wait_time = 5 * retry
logging.error('Push failed, retrying in %d seconds: %s' %
(wait_time, output))
time.sleep(wait_time)
else:
raise Exception('Push failed: %s' % output)
def GetPushSizeInfo(self):
"""Get total size of pushes to the device done via PushIfNeeded()