Bug 1486004 - Part 12 - [mozrunner 8.0.2] Update mozrunner requirements to support unrooted android devices using mozdevice 4.0.0, r=gbrown

Depends on D82754

Differential Revision: https://phabricator.services.mozilla.com/D82755
This commit is contained in:
Bob Clary 2020-07-16 21:32:55 +00:00
parent 197496dd07
commit 3dca103f53
5 changed files with 16 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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):

View File

@ -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',