Bug 1101497 - Support connecting to a remote ADB host. r=mdas

This commit is contained in:
Dave Hunt 2014-12-11 09:44:00 -05:00
parent e1b1dcb792
commit c7de18fda5
4 changed files with 24 additions and 10 deletions

View File

@ -471,7 +471,8 @@ class Marionette(object):
emulator_binary=None, emulator_res=None, connect_to_running_emulator=False,
gecko_log=None, homedir=None, baseurl=None, no_window=False, logdir=None,
busybox=None, symbols_path=None, timeout=None, socket_timeout=360,
device_serial=None, adb_path=None, process_args=None):
device_serial=None, adb_path=None, process_args=None,
adb_host=None, adb_port=None):
self.host = host
self.port = self.local_port = port
self.bin = bin
@ -488,8 +489,10 @@ class Marionette(object):
self.no_window = no_window
self._test_name = None
self.timeout = timeout
self.socket_timeout=socket_timeout
self.socket_timeout = socket_timeout
self.device_serial = device_serial
self.adb_host = adb_host
self.adb_port = adb_port
if bin:
port = int(self.port)

View File

@ -290,6 +290,10 @@ class BaseMarionetteOptions(OptionParser):
dest='device_serial',
action='store',
help='serial ID of a device to use for adb / fastboot')
self.add_option('--adb-host',
help='host to use for adb connection')
self.add_option('--adb-port',
help='port to use for adb connection')
self.add_option('--type',
dest='type',
action='store',
@ -455,7 +459,7 @@ class BaseMarionetteTestRunner(object):
shuffle=False, shuffle_seed=random.randint(0, sys.maxint),
sdcard=None, this_chunk=1, total_chunks=1, sources=None,
server_root=None, gecko_log=None, result_callbacks=None,
**kwargs):
adb_host=None, adb_port=None, **kwargs):
self.address = address
self.emulator = emulator
self.emulator_binary = emulator_binary
@ -495,6 +499,8 @@ class BaseMarionetteTestRunner(object):
self.manifest_skipped_tests = []
self.tests = []
self.result_callbacks = result_callbacks if result_callbacks is not None else []
self._adb_host = adb_host
self._adb_port = adb_port
def gather_debug(test, status):
rv = {}
@ -605,6 +611,8 @@ class BaseMarionetteTestRunner(object):
'device_serial': self.device_serial,
'symbols_path': self.symbols_path,
'timeout': self.timeout,
'adb_host': self._adb_host,
'adb_port': self._adb_port,
}
if self.bin:
kwargs.update({
@ -728,7 +736,9 @@ setReq.onerror = function() {
version_info = mozversion.get_version(binary=self.bin,
sources=self.sources,
dm_type=os.environ.get('DM_TRANS', 'adb'),
device_serial=self.device_serial)
device_serial=self.device_serial,
adb_host=self.marionette.adb_host,
adb_port=self.marionette.adb_port)
device_info = None
if self.capabilities['device'] != 'desktop' and self.capabilities['browserName'] == 'B2G':

View File

@ -7,15 +7,16 @@ import os
import re
def get_dm(marionette=None,**kwargs):
def get_dm(marionette=None, **kwargs):
dm_type = os.environ.get('DM_TRANS', 'adb')
if marionette and hasattr(marionette.runner, 'device'):
return marionette.runner.app_ctx.dm
elif marionette and marionette.device_serial and dm_type == 'adb':
return mozdevice.DeviceManagerADB(deviceSerial=marionette.device_serial, **kwargs)
else:
if dm_type == 'adb':
return mozdevice.DeviceManagerADB(**kwargs)
return mozdevice.DeviceManagerADB(deviceSerial=marionette.device_serial,
serverHost=marionette.adb_host,
serverPort=marionette.adb_port,
**kwargs)
elif dm_type == 'sut':
host = os.environ.get('TEST_DEVICE')
if not host:

View File

@ -4,10 +4,10 @@ mozhttpd >= 0.5
mozinfo >= 0.7
mozprocess >= 0.9
mozrunner >= 6.2
mozdevice >= 0.37
mozdevice >= 0.44
mozlog >= 2.7
moznetwork >= 0.21
mozcrash >= 0.5
mozprofile >= 0.7
moztest >= 0.7
mozversion >= 0.2
mozversion >= 1.1