diff --git a/testing/mozbase/mozrunner/mozrunner/application.py b/testing/mozbase/mozrunner/mozrunner/application.py index 744225f52180..744f975df82e 100644 --- a/testing/mozbase/mozrunner/mozrunner/application.py +++ b/testing/mozbase/mozrunner/mozrunner/application.py @@ -9,7 +9,7 @@ from distutils.spawn import find_executable import os import posixpath -from mozdevice import ADBDevice +from mozdevice import ADBDeviceFactory from mozprofile import ( Profile, ChromeProfile, @@ -117,7 +117,7 @@ class FennecContext(RemoteContext): if device_serial in devices: device = devices[device_serial] else: - device = ADBDevice(adb=adb_path, device=device_serial) + device = ADBDeviceFactory(adb=adb_path, device=device_serial) devices[device_serial] = device return device diff --git a/testing/mozbase/mozrunner/mozrunner/base/device.py b/testing/mozbase/mozrunner/mozrunner/base/device.py index 0c7d091f2855..999e46478d61 100644 --- a/testing/mozbase/mozrunner/mozrunner/base/device.py +++ b/testing/mozbase/mozrunner/mozrunner/base/device.py @@ -72,6 +72,7 @@ class DeviceRunner(BaseRunner): self.device.setup_profile(self.profile) app = self.app_ctx.remote_process + self.device.run_as_package = app args = ["-no-remote", "-profile", self.app_ctx.remote_profile] args.extend(self.cmdargs) env = self._device_env diff --git a/testing/mozbase/mozrunner/mozrunner/devices/android_device.py b/testing/mozbase/mozrunner/mozrunner/devices/android_device.py index 42dab6d9135c..cc9c6762d94c 100644 --- a/testing/mozbase/mozrunner/mozrunner/devices/android_device.py +++ b/testing/mozbase/mozrunner/mozrunner/devices/android_device.py @@ -19,7 +19,7 @@ from distutils.spawn import find_executable from enum import Enum from mozbuild.base import MozbuildObject -from mozdevice import ADBHost, ADBDevice +from mozdevice import ADBHost, ADBDeviceFactory from six.moves import input, urllib EMULATOR_HOME_DIR = os.path.join(os.path.expanduser('~'), '.mozbuild', 'android-device') @@ -35,7 +35,6 @@ MANIFEST_PATH = 'testing/config/tooltool-manifests' SHORT_TIMEOUT = 10 verbose_logging = False -devices = {} class InstallIntent(Enum): @@ -86,15 +85,11 @@ AVD_DICT = { def _get_device(substs, device_serial=None): - global devices - if device_serial in devices: - device = devices[device_serial] - else: - adb_path = _find_sdk_exe(substs, 'adb', False) - if not adb_path: - adb_path = 'adb' - device = ADBDevice(adb=adb_path, verbose=verbose_logging, device=device_serial) - devices[device_serial] = device + + adb_path = _find_sdk_exe(substs, 'adb', False) + if not adb_path: + adb_path = 'adb' + device = ADBDeviceFactory(adb=adb_path, verbose=verbose_logging, device=device_serial) return device @@ -282,6 +277,8 @@ def verify_android_device(build_obj, install=InstallIntent.NO, xre=False, debugg "but I don't know how to install it.\n" "Install it now, then hit Enter " % app) + device.run_as_package = app + if device_verified and xre: # Check whether MOZ_HOST_BIN has been set to a valid xre; if not, # prompt to install one. @@ -318,6 +315,7 @@ def verify_android_device(build_obj, install=InstallIntent.NO, xre=False, debugg serial = device_serial or os.environ.get('DEVICE_SERIAL') if not serial or ('emulator' not in serial): device = _get_device(build_obj.substs, serial) + device.run_as_package = app try: addr = device.get_ip_address() if not addr: @@ -349,6 +347,7 @@ def grant_runtime_permissions(build_obj, app, device_serial=None): (eg. org.mozilla.geckoview.test). """ device = _get_device(build_obj.substs, device_serial) + device.run_as_package = app device.grant_runtime_permissions(app) diff --git a/testing/mozbase/mozrunner/mozrunner/devices/base.py b/testing/mozbase/mozrunner/mozrunner/devices/base.py index 0baaa7650fbf..4b95a7d2afa7 100644 --- a/testing/mozbase/mozrunner/mozrunner/devices/base.py +++ b/testing/mozbase/mozrunner/mozrunner/devices/base.py @@ -74,7 +74,7 @@ class Device(object): print("WARNING: {}".format(e)) if os.listdir(local_dump_dir): self.device.rm(remote_dump_dir, recursive=True) - self.device.mkdir(remote_dump_dir) + self.device.mkdir(remote_dump_dir, parents=True) return local_dump_dir def setup_profile(self, profile): diff --git a/testing/mozbase/mozrunner/setup.py b/testing/mozbase/mozrunner/setup.py index 0bc1a74756e8..94d2d4e31c72 100644 --- a/testing/mozbase/mozrunner/setup.py +++ b/testing/mozbase/mozrunner/setup.py @@ -7,12 +7,12 @@ from __future__ import absolute_import from setuptools import setup, find_packages PACKAGE_NAME = 'mozrunner' -PACKAGE_VERSION = '8.0.1' +PACKAGE_VERSION = '8.0.2' desc = """Reliable start/stop/configuration of Mozilla Applications (Firefox, Thunderbird, etc.)""" deps = [ - 'mozdevice>=3.0.1,<4', + 'mozdevice>=4.0.0,<5', 'mozfile>=1.2', 'mozinfo>=0.7,<2', 'mozlog>=6.0',