зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1410714
- Help mach tests find adb when running Android tests; r=jmaher
This commit is contained in:
Родитель
b3cbfea12e
Коммит
5facbdc255
|
@ -136,9 +136,12 @@ class ReftestRunner(MozbuildObject):
|
|||
args.ignoreWindowSize = True
|
||||
args.printDeviceInfo = False
|
||||
|
||||
from mozrunner.devices.android_device import grant_runtime_permissions
|
||||
from mozrunner.devices.android_device import grant_runtime_permissions, get_adb_path
|
||||
grant_runtime_permissions(self)
|
||||
|
||||
if not args.adb_path:
|
||||
args.adb_path = get_adb_path(self)
|
||||
|
||||
# A symlink and some path manipulations are required so that test
|
||||
# manifests can be found both locally and remotely (via a url)
|
||||
# using the same relative path.
|
||||
|
|
|
@ -418,7 +418,7 @@ class RemoteArgumentsParser(ReftestArgumentsParser):
|
|||
action="store",
|
||||
type=str,
|
||||
dest="adb_path",
|
||||
default="adb",
|
||||
default=None,
|
||||
help="path to adb")
|
||||
|
||||
self.add_argument("--deviceIP",
|
||||
|
|
|
@ -396,6 +396,9 @@ class MachCommands(MachCommandBase):
|
|||
commandline.add_logging_group(parser)
|
||||
options, args = parser.parse_args()
|
||||
|
||||
if not options.adb_path:
|
||||
from mozrunner.devices.android_device import get_adb_path
|
||||
options.adb_path = get_adb_path(self)
|
||||
options.symbols_path = symbols_path
|
||||
options.manifest_path = manifest_path
|
||||
options.xre_path = self.bindir
|
||||
|
|
|
@ -172,6 +172,10 @@ class MochitestRunner(MozbuildObject):
|
|||
('.py', 'r', imp.PY_SOURCE))
|
||||
import runtestsremote
|
||||
|
||||
from mozrunner.devices.android_device import get_adb_path
|
||||
if not kwargs['adbPath']:
|
||||
kwargs['adbPath'] = get_adb_path(self)
|
||||
|
||||
options = Namespace(**kwargs)
|
||||
|
||||
from manifestparser import TestManifest
|
||||
|
@ -455,9 +459,12 @@ class RobocopCommands(MachCommandBase):
|
|||
sorted(list(test_paths)))))
|
||||
return 1
|
||||
|
||||
from mozrunner.devices.android_device import grant_runtime_permissions
|
||||
from mozrunner.devices.android_device import grant_runtime_permissions, get_adb_path
|
||||
grant_runtime_permissions(self)
|
||||
|
||||
if not kwargs['adbPath']:
|
||||
kwargs['adbPath'] = get_adb_path(self)
|
||||
|
||||
mochitest = self._spawn(MochitestRunner)
|
||||
return mochitest.run_robocop_test(self._mach_context, tests, 'robocop', **kwargs)
|
||||
|
||||
|
|
|
@ -246,6 +246,10 @@ def verify_android_device(build_obj, install=False, xre=False, debugger=False, v
|
|||
return device_verified
|
||||
|
||||
|
||||
def get_adb_path(build_obj):
|
||||
return _find_sdk_exe(build_obj.substs, 'adb', False)
|
||||
|
||||
|
||||
def run_firefox_for_android(build_obj, params):
|
||||
"""
|
||||
Launch Firefox for Android on the connected device.
|
||||
|
|
|
@ -178,6 +178,11 @@ class RemoteCPPUnittestOptions(cppunittests.CPPUnittestOptions):
|
|||
help="port of remote device to test")
|
||||
defaults["device_port"] = 20701
|
||||
|
||||
self.add_option("--adbPath", action="store",
|
||||
type="string", dest="adb_path",
|
||||
help="Path to adb")
|
||||
defaults["adb_path"] = None
|
||||
|
||||
self.add_option("--noSetup", action="store_false",
|
||||
dest="setup",
|
||||
help="do not copy any files to device (to be used only if "
|
||||
|
@ -238,6 +243,8 @@ def run_test_harness(options, args):
|
|||
if options.device_ip:
|
||||
dm_args['host'] = options.device_ip
|
||||
dm_args['port'] = options.device_port
|
||||
if options.adb_path:
|
||||
dm_args['adbPath'] = options.adb_path
|
||||
if options.log_tbpl_level == 'debug' or options.log_mach_level == 'debug':
|
||||
dm_args['logLevel'] = logging.DEBUG # noqa python 2 / 3
|
||||
dm = devicemanagerADB.DeviceManagerADB(**dm_args)
|
||||
|
|
|
@ -145,13 +145,13 @@ class XPCShellRunner(MozbuildObject):
|
|||
|
||||
class AndroidXPCShellRunner(MozbuildObject):
|
||||
"""Get specified DeviceManager"""
|
||||
def get_devicemanager(self, ip, port, remote_test_root):
|
||||
def get_devicemanager(self, ip, port, remote_test_root, adb_path):
|
||||
import mozdevice
|
||||
dm = None
|
||||
if ip:
|
||||
dm = mozdevice.DroidADB(ip, port, packageName=None, deviceRoot=remote_test_root)
|
||||
dm = mozdevice.DroidADB(ip, port, packageName=None, deviceRoot=remote_test_root, adbPath=adb_path)
|
||||
else:
|
||||
dm = mozdevice.DroidADB(packageName=None, deviceRoot=remote_test_root)
|
||||
dm = mozdevice.DroidADB(packageName=None, deviceRoot=remote_test_root, adbPath=adb_path)
|
||||
return dm
|
||||
|
||||
"""Run Android xpcshell tests."""
|
||||
|
@ -164,7 +164,7 @@ class AndroidXPCShellRunner(MozbuildObject):
|
|||
import remotexpcshelltests
|
||||
|
||||
dm = self.get_devicemanager(kwargs["deviceIP"], kwargs["devicePort"],
|
||||
kwargs["remoteTestRoot"])
|
||||
kwargs["remoteTestRoot"], kwargs["adbPath"])
|
||||
|
||||
log = kwargs.pop("log")
|
||||
self.log_manager.enable_unstructured()
|
||||
|
@ -255,8 +255,10 @@ class MachCommands(MachCommandBase):
|
|||
params['threadCount'] = int((cpu_count() * 3) / 2)
|
||||
|
||||
if conditions.is_android(self):
|
||||
from mozrunner.devices.android_device import verify_android_device
|
||||
from mozrunner.devices.android_device import verify_android_device, get_adb_path
|
||||
verify_android_device(self)
|
||||
if not params['adbPath']:
|
||||
params['adbPath'] = get_adb_path(self)
|
||||
xpcshell = self._spawn(AndroidXPCShellRunner)
|
||||
else:
|
||||
xpcshell = self._spawn(XPCShellRunner)
|
||||
|
|
|
@ -601,6 +601,8 @@ def main():
|
|||
dm_args['port'] = options['devicePort']
|
||||
if options['log_tbpl_level'] == 'debug' or options['log_mach_level'] == 'debug':
|
||||
dm_args['logLevel'] = logging.DEBUG
|
||||
if options['adbPath']:
|
||||
dm_args['adbPath'] = adbPath
|
||||
dm = mozdevice.DroidADB(**dm_args)
|
||||
|
||||
if options['interactive'] and not options['testPath']:
|
||||
|
|
|
@ -149,6 +149,9 @@ def add_remote_arguments(parser):
|
|||
parser.add_argument("--apk", action="store", type=str, dest="localAPK",
|
||||
help="local path to Fennec APK")
|
||||
|
||||
parser.add_argument("--adbPath", action="store", type=str, dest="adbPath",
|
||||
help="Path to adb")
|
||||
|
||||
parser.add_argument("--noSetup", action="store_false", dest="setup", default=True,
|
||||
help="do not copy any files to device (to be used only if "
|
||||
"device is already setup)")
|
||||
|
|
Загрузка…
Ссылка в новой задаче