Bug 1300163 - Add a --adbpath argument to mochitest Android to allow explicitly setting the adb binary, r=gbrown

In mozdevice, it's possible to pass in the path to the adb binary (rather than requiring it to be on the path). The
mochitest android options don't provide any means to set this however (even though the b2g options do). This patch
adds that option in.

This will be used by the mach environment on interactive loaners.

MozReview-Commit-ID: 4lsKGpizfH7

--HG--
extra : rebase_source : 07ad43c8fff3eb83a1eaab9ad0532cd85c4532c7
This commit is contained in:
Andrew Halberstadt 2016-09-02 14:26:16 -04:00
parent aa78ee9e95
commit 0d41359cf5
2 changed files with 17 additions and 18 deletions

View File

@ -994,6 +994,12 @@ class AndroidArguments(ArgumentContainer):
"help": "The transport to use for communication with the device [default: adb].",
"suppress": True,
}],
[["--adbpath"],
{"dest": "adbPath",
"default": None,
"help": "Path to adb binary.",
"suppress": True,
}],
[["--devicePort"],
{"dest": "devicePort",
"type": int,
@ -1065,29 +1071,22 @@ class AndroidArguments(ArgumentContainer):
if build_obj:
options.log_mach = '-'
device_args = {'deviceRoot': options.remoteTestRoot}
if options.dm_trans == "adb":
device_args['adbPath'] = options.adbPath
if options.deviceIP:
options.dm = DroidADB(
options.deviceIP,
options.devicePort,
deviceRoot=options.remoteTestRoot)
device_args['host'] = options.deviceIP
device_args['port'] = options.devicePort
elif options.deviceSerial:
options.dm = DroidADB(
None,
None,
deviceSerial=options.deviceSerial,
deviceRoot=options.remoteTestRoot)
else:
options.dm = DroidADB(deviceRoot=options.remoteTestRoot)
device_args['deviceSerial'] = options.deviceSerial
options.dm = DroidADB(**device_args)
elif options.dm_trans == 'sut':
if options.deviceIP is None:
parser.error(
"If --dm_trans = sut, you must provide a device IP")
options.dm = DroidSUT(
options.deviceIP,
options.devicePort,
deviceRoot=options.remoteTestRoot)
device_args['host'] = options.deviceIP
device_args['port'] = options.devicePort
options.dm = DroidSUT(**device_args)
if not options.remoteTestRoot:
options.remoteTestRoot = options.dm.deviceRoot

View File

@ -35,7 +35,7 @@ class DeviceManagerADB(DeviceManager):
connected = False
def __init__(self, host=None, port=5555, retryLimit=5, packageName='fennec',
adbPath='adb', deviceSerial=None, deviceRoot=None,
adbPath=None, deviceSerial=None, deviceRoot=None,
logLevel=logging.ERROR, autoconnect=True, runAdbAsRoot=False,
serverHost=None, serverPort=None, **kwargs):
DeviceManager.__init__(self, logLevel=logLevel,
@ -48,7 +48,7 @@ class DeviceManagerADB(DeviceManager):
self._serverPort = serverPort
# the path to adb, or 'adb' to assume that it's on the PATH
self._adbPath = adbPath
self._adbPath = adbPath or 'adb'
# The serial number of the device to use with adb, used in cases
# where multiple devices are being managed by the same adb instance.