Bug 800102 - Retry adb push if it times out while installing gecko, r=jgriffin

This commit is contained in:
Andrew Halberstadt 2012-11-06 13:06:38 -08:00
parent a18342882f
commit e0ed6ab143

View File

@ -4,7 +4,7 @@
import datetime
from errors import *
from mozdevice import devicemanagerADB
from mozdevice import devicemanagerADB, DMError
from mozprocess import ProcessHandlerMixin
import multiprocessing
import os
@ -378,28 +378,30 @@ waitFor(
Install gecko into the emulator using adb push. Restart b2g after the
installation.
"""
print 'installing gecko binaries...'
# need to remount so we can write to /system/b2g
self._run_adb(['remount'])
# See bug 800102. We use this particular method of installing
# gecko in order to avoid an adb bug in which adb will sometimes
# hang indefinitely while copying large files to the system
# partition.
push_attempts = 10
print 'installing gecko binaries...'
# need to remount so we can write to /system/b2g
self._run_adb(['remount'])
for root, dirs, files in os.walk(gecko_path):
for filename in files:
data_local_file = os.path.join('/data/local', filename)
print 'pushing', data_local_file
self.dm.pushFile(os.path.join(root, filename), data_local_file)
self.dm.shellCheckOutput(['stop', 'b2g'])
for root, dirs, files in os.walk(gecko_path):
for filename in files:
data_local_file = os.path.join('/data/local', filename)
rel_file = os.path.relpath(os.path.join(root, filename), gecko_path)
system_file = os.path.join('/system/b2g', rel_file)
print 'copying', data_local_file, 'to', system_file
self.dm.shellCheckOutput(['dd', 'if=%s' % data_local_file,
'of=%s' % system_file])
rel_path = os.path.relpath(os.path.join(root, filename), gecko_path)
system_b2g_file = os.path.join('/system/b2g', rel_path)
for retry in range(1, push_attempts+1):
print 'pushing', system_b2g_file, '(attempt %s of %s)' % (retry, push_attempts)
try:
self.dm.pushFile(os.path.join(root, filename), system_b2g_file)
break
except DMError:
if retry == push_attempts:
raise
print 'restarting B2G'
self.dm.shellCheckOutput(['stop', 'b2g'])
self.dm.shellCheckOutput(['start', 'b2g'])
self.wait_for_port()
self.wait_for_system_message(marionette)