Bug 1486004 - Part 5 - Update reftests to support unrooted android devices using mozdevice 4.0.0, ? r=jmaher

Depends on D82747

Differential Revision: https://phabricator.services.mozilla.com/D82748
This commit is contained in:
Bob Clary 2020-07-15 20:58:02 +00:00
Родитель 113ed2405d
Коммит 0dca9b22c0
3 изменённых файлов: 22 добавлений и 14 удалений

Просмотреть файл

@ -238,7 +238,12 @@ class MachCommands(MachCommandBase):
if conditions.is_android(self):
from mozrunner.devices.android_device import (verify_android_device, InstallIntent)
install = InstallIntent.NO if kwargs.get('no_install') else InstallIntent.YES
verbose = False
if kwargs.get('log_mach_verbose') or kwargs.get('log_tbpl_level') == 'debug' or \
kwargs.get('log_mach_level') == 'debug' or kwargs.get('log_raw_level') == 'debug':
verbose = True
verify_android_device(self, install=install, xre=True, network=True,
app=kwargs["app"], device_serial=kwargs["deviceSerial"])
app=kwargs["app"], device_serial=kwargs["deviceSerial"],
verbose=verbose)
return reftest.run_android_test(**kwargs)
return reftest.run_desktop_test(**kwargs)

Просмотреть файл

@ -489,7 +489,7 @@ class RemoteArgumentsParser(ReftestArgumentsParser):
type=str,
dest="remoteTestRoot",
help="Remote directory to use as test root "
"(eg. /mnt/sdcard/tests or /data/local/tests).")
"(eg. /data/local/tmp/test_root).")
self.add_argument("--httpd-path",
action="store",

Просмотреть файл

@ -16,7 +16,7 @@ from contextlib import closing
from six.moves.urllib_request import urlopen
from mozdevice import ADBDevice, ADBTimeoutError
from mozdevice import ADBDeviceFactory, ADBTimeoutError
from remoteautomation import RemoteAutomation, fennecLogcatFilters
from output import OutputHandler
@ -164,13 +164,16 @@ class RemoteReftest(RefTest):
self.localLogName = options.localLogName
verbose = False
if options.log_tbpl_level == 'debug' or options.log_mach_level == 'debug':
if options.log_mach_verbose or options.log_tbpl_level == 'debug' or \
options.log_mach_level == 'debug' or options.log_raw_level == 'debug':
verbose = True
print("set verbose!")
self.device = ADBDevice(adb=options.adb_path or 'adb',
device=options.deviceSerial,
test_root=options.remoteTestRoot,
verbose=verbose)
expected = options.app.split('/')[-1]
self.device = ADBDeviceFactory(adb=options.adb_path or 'adb',
device=options.deviceSerial,
test_root=options.remoteTestRoot,
verbose=verbose,
run_as_package=expected)
if options.remoteTestRoot is None:
options.remoteTestRoot = posixpath.join(self.device.test_root, "reftest")
options.remoteProfile = posixpath.join(options.remoteTestRoot, "profile")
@ -210,10 +213,10 @@ class RemoteReftest(RefTest):
expected = options.app.split('/')[-1]
if not self.device.is_app_installed(expected):
raise Exception("%s is not installed on this device" % expected)
self.device.run_as_package = expected
self.device.clear_logcat()
self.device.rm(self.remoteCache, force=True, recursive=True, root=True)
self.device.rm(self.remoteCache, force=True, recursive=True)
procName = options.app.split('/')[-1]
self.device.stop_application(procName)
@ -327,7 +330,7 @@ class RemoteReftest(RefTest):
# make sure the parent directories of the profile which
# may have been created by the push, also have their
# permissions set to allow access.
self.device.chmod(options.remoteTestRoot, recursive=True, root=True)
self.device.chmod(options.remoteTestRoot, recursive=True)
except Exception:
print("Automation Error: Failed to copy profiledir to device")
raise
@ -398,9 +401,9 @@ class RemoteReftest(RefTest):
return status
def cleanup(self, profileDir):
self.device.rm(self.remoteTestRoot, force=True, recursive=True, root=True)
self.device.rm(self.remoteProfile, force=True, recursive=True, root=True)
self.device.rm(self.remoteCache, force=True, recursive=True, root=True)
self.device.rm(self.remoteTestRoot, force=True, recursive=True)
self.device.rm(self.remoteProfile, force=True, recursive=True)
self.device.rm(self.remoteCache, force=True, recursive=True)
RefTest.cleanup(self, profileDir)