mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 772687 - Add ability to specify deviceRoot when instantiating DeviceManager, r=jmaher
This commit is contained in:
parent
dc7e672f62
commit
8ddc986030
@ -12,7 +12,7 @@ import tempfile
|
||||
class DeviceManagerADB(DeviceManager):
|
||||
|
||||
def __init__(self, host=None, port=20701, retrylimit=5, packageName='fennec',
|
||||
adbPath='adb', deviceSerial=None):
|
||||
adbPath='adb', deviceSerial=None, deviceRoot=None):
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.retrylimit = retrylimit
|
||||
@ -24,7 +24,7 @@ class DeviceManagerADB(DeviceManager):
|
||||
self.useZip = False
|
||||
self.packageName = None
|
||||
self.tempDir = None
|
||||
self.deviceRoot = None
|
||||
self.deviceRoot = deviceRoot
|
||||
|
||||
# the path to adb, or 'adb' to assume that it's on the PATH
|
||||
self.adbPath = adbPath
|
||||
@ -537,6 +537,13 @@ class DeviceManagerADB(DeviceManager):
|
||||
|
||||
# Internal method to setup the device root and cache its value
|
||||
def setupDeviceRoot(self):
|
||||
# if self.deviceRoot is already set, create it if necessary, and use it
|
||||
if self.deviceRoot:
|
||||
if not self.dirExists(self.deviceRoot):
|
||||
if not self.mkDir(self.deviceRoot):
|
||||
raise DMError("Unable to create device root %s" % self.deviceRoot)
|
||||
return
|
||||
|
||||
# /mnt/sdcard/tests is preferred to /data/local/tests, but this can be
|
||||
# over-ridden by creating /data/local/tests
|
||||
testRoot = "/data/local/tests"
|
||||
|
@ -44,12 +44,13 @@ class DeviceManagerSUT(DeviceManager):
|
||||
# The error would be set where appropriate--so sendCMD() could set socket errors,
|
||||
# pushFile() and other file-related commands could set filesystem errors, etc.
|
||||
|
||||
def __init__(self, host, port = 20701, retrylimit = 5):
|
||||
def __init__(self, host, port = 20701, retrylimit = 5, deviceRoot = None):
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.retrylimit = retrylimit
|
||||
self.retries = 0
|
||||
self._sock = None
|
||||
self.deviceRoot = deviceRoot
|
||||
if self.getDeviceRoot() == None:
|
||||
raise BaseException("Failed to connect to SUT Agent and retrieve the device root.")
|
||||
|
||||
@ -838,18 +839,22 @@ class DeviceManagerSUT(DeviceManager):
|
||||
# success: path for device root
|
||||
# failure: None
|
||||
def getDeviceRoot(self):
|
||||
try:
|
||||
data = self.runCmds([{ 'cmd': 'testroot' }])
|
||||
except:
|
||||
return None
|
||||
if self.deviceRoot:
|
||||
deviceRoot = self.deviceRoot
|
||||
else:
|
||||
try:
|
||||
data = self.runCmds([{ 'cmd': 'testroot' }])
|
||||
except:
|
||||
return None
|
||||
|
||||
deviceRoot = data.strip() + '/tests'
|
||||
deviceRoot = data.strip() + '/tests'
|
||||
|
||||
if (not self.dirExists(deviceRoot)):
|
||||
if (self.mkDir(deviceRoot) == None):
|
||||
return None
|
||||
|
||||
return deviceRoot
|
||||
self.deviceRoot = deviceRoot
|
||||
return self.deviceRoot
|
||||
|
||||
def getAppRoot(self, packageName):
|
||||
try:
|
||||
|
@ -183,6 +183,7 @@ class B2GMochitest(Mochitest):
|
||||
_automation = None
|
||||
_dm = None
|
||||
localProfile = None
|
||||
testDir = '/data/local/tests'
|
||||
|
||||
def __init__(self, automation, devmgr, options):
|
||||
self._automation = automation
|
||||
@ -193,7 +194,6 @@ class B2GMochitest(Mochitest):
|
||||
self._automation.setRemoteProfile(self.remoteProfile)
|
||||
self.remoteLog = options.remoteLogFile
|
||||
self.userJS = '/data/local/user.js'
|
||||
self.testDir = '/data/local/tests'
|
||||
self.remoteMozillaPath = '/data/b2g/mozilla'
|
||||
self.remoteProfilesIniPath = os.path.join(self.remoteMozillaPath, 'profiles.ini')
|
||||
self.originalProfilesIni = None
|
||||
@ -405,7 +405,8 @@ def main():
|
||||
auto.marionette = marionette
|
||||
|
||||
# create the DeviceManager
|
||||
kwargs = {'adbPath': options.adbPath}
|
||||
kwargs = {'adbPath': options.adbPath,
|
||||
'deviceRoot': B2GMochitest.testDir}
|
||||
if options.deviceIP:
|
||||
kwargs.update({'host': options.deviceIP,
|
||||
'port': options.devicePort})
|
||||
@ -421,10 +422,6 @@ def main():
|
||||
|
||||
mochitest = B2GMochitest(auto, dm, options)
|
||||
|
||||
# Create /data/local/tests, to force its use by DeviceManagerADB;
|
||||
# B2G won't run correctly with the profile installed to /mnt/sdcard.
|
||||
dm.mkDirs(mochitest.testDir)
|
||||
|
||||
options = parser.verifyOptions(options, mochitest)
|
||||
if (options == None):
|
||||
sys.exit(1)
|
||||
|
Loading…
Reference in New Issue
Block a user