зеркало из https://github.com/mozilla/gecko-dev.git
Bug 552441 Update devicemanager to have better error reporting for failed file transactions r=ctalbert a=dholbert for CLOSED TREE landing, NPOTB
This commit is contained in:
Родитель
c9126117d9
Коммит
fe92dacd05
|
@ -45,6 +45,14 @@ from threading import Thread
|
|||
import traceback
|
||||
import sys
|
||||
|
||||
class FileError(Exception):
|
||||
" Signifies an error which occurs while doing a file operation."
|
||||
|
||||
def __init__(self, msg = ''):
|
||||
self.msg = msg
|
||||
|
||||
def __str__(self):
|
||||
return self.msg
|
||||
|
||||
class myProc(Thread):
|
||||
def __init__(self, hostip, hostport, cmd, new_line = True, sleeptime = 0):
|
||||
|
@ -228,7 +236,10 @@ class DeviceManager:
|
|||
print "files are validated"
|
||||
return ''
|
||||
|
||||
self.mkDirs(destname)
|
||||
if self.mkDirs(destname) == None:
|
||||
print "unable to make dirs: " + destname
|
||||
return None
|
||||
|
||||
if (self.debug >= 2):
|
||||
print "sending: push " + destname
|
||||
|
||||
|
@ -253,7 +264,7 @@ class DeviceManager:
|
|||
return retVal
|
||||
|
||||
def mkDir(self, name):
|
||||
return self.sendCMD(['mkdr ' + name, 'quit'])
|
||||
return self.sendCMD(['mkdr ' + name])
|
||||
|
||||
|
||||
# make directory structure on the device
|
||||
|
@ -265,8 +276,9 @@ class DeviceManager:
|
|||
if (part != ""):
|
||||
name += '/' + part
|
||||
if (self.mkDir(name) == None):
|
||||
print "failed making directory: " + str(name)
|
||||
return None
|
||||
|
||||
return ''
|
||||
|
||||
# push localDir from host to remoteDir on the device
|
||||
def pushDir(self, localDir, remoteDir):
|
||||
|
@ -573,9 +585,38 @@ class DeviceManager:
|
|||
return 0
|
||||
|
||||
def unpackFile(self, filename):
|
||||
self.sendCMD(['cd /tests', 'unzp ' + filename])
|
||||
|
||||
|
||||
dir = ''
|
||||
parts = filename.split('/')
|
||||
if (len(parts) > 1):
|
||||
if self.fileExists(filename):
|
||||
dir = '/'.join(parts[:-1])
|
||||
elif self.fileExists('/' + filename):
|
||||
dir = '/' + filename
|
||||
elif self.fileExists('/tests/' + filename):
|
||||
dir = '/tests/' + filename
|
||||
else:
|
||||
return None
|
||||
|
||||
return self.sendCMD(['cd ' + dir, 'unzp ' + filename])
|
||||
|
||||
|
||||
def reboot(self, wait = False):
|
||||
self.sendCMD(['rebt'])
|
||||
|
||||
if wait == True:
|
||||
time.sleep(30)
|
||||
timeout = 270
|
||||
done = False
|
||||
while (not done):
|
||||
if self.listFiles('/') != None:
|
||||
return ''
|
||||
print "sleeping another 10 seconds"
|
||||
time.sleep(10)
|
||||
timeout = timeout - 10
|
||||
if (timeout <= 0):
|
||||
return None
|
||||
return ''
|
||||
|
||||
# validate localDir from host to remoteDir on the device
|
||||
def validateDir(self, localDir, remoteDir):
|
||||
if (self.debug >= 2): print "validating directory: " + localDir + " to " + remoteDir
|
||||
|
|
Загрузка…
Ссылка в новой задаче