зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
9bc3a3e24f
Коммит
9cafc708a0
|
@ -238,7 +238,12 @@ class MachCommands(MachCommandBase):
|
||||||
if conditions.is_android(self):
|
if conditions.is_android(self):
|
||||||
from mozrunner.devices.android_device import (verify_android_device, InstallIntent)
|
from mozrunner.devices.android_device import (verify_android_device, InstallIntent)
|
||||||
install = InstallIntent.NO if kwargs.get('no_install') else InstallIntent.YES
|
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,
|
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_android_test(**kwargs)
|
||||||
return reftest.run_desktop_test(**kwargs)
|
return reftest.run_desktop_test(**kwargs)
|
||||||
|
|
|
@ -489,7 +489,7 @@ class RemoteArgumentsParser(ReftestArgumentsParser):
|
||||||
type=str,
|
type=str,
|
||||||
dest="remoteTestRoot",
|
dest="remoteTestRoot",
|
||||||
help="Remote directory to use as test root "
|
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",
|
self.add_argument("--httpd-path",
|
||||||
action="store",
|
action="store",
|
||||||
|
|
|
@ -16,7 +16,7 @@ from contextlib import closing
|
||||||
|
|
||||||
from six.moves.urllib_request import urlopen
|
from six.moves.urllib_request import urlopen
|
||||||
|
|
||||||
from mozdevice import ADBDevice, ADBTimeoutError
|
from mozdevice import ADBDeviceFactory, ADBTimeoutError
|
||||||
from remoteautomation import RemoteAutomation, fennecLogcatFilters
|
from remoteautomation import RemoteAutomation, fennecLogcatFilters
|
||||||
|
|
||||||
from output import OutputHandler
|
from output import OutputHandler
|
||||||
|
@ -164,13 +164,16 @@ class RemoteReftest(RefTest):
|
||||||
self.localLogName = options.localLogName
|
self.localLogName = options.localLogName
|
||||||
|
|
||||||
verbose = False
|
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
|
verbose = True
|
||||||
print("set verbose!")
|
print("set verbose!")
|
||||||
self.device = ADBDevice(adb=options.adb_path or 'adb',
|
expected = options.app.split('/')[-1]
|
||||||
|
self.device = ADBDeviceFactory(adb=options.adb_path or 'adb',
|
||||||
device=options.deviceSerial,
|
device=options.deviceSerial,
|
||||||
test_root=options.remoteTestRoot,
|
test_root=options.remoteTestRoot,
|
||||||
verbose=verbose)
|
verbose=verbose,
|
||||||
|
run_as_package=expected)
|
||||||
if options.remoteTestRoot is None:
|
if options.remoteTestRoot is None:
|
||||||
options.remoteTestRoot = posixpath.join(self.device.test_root, "reftest")
|
options.remoteTestRoot = posixpath.join(self.device.test_root, "reftest")
|
||||||
options.remoteProfile = posixpath.join(options.remoteTestRoot, "profile")
|
options.remoteProfile = posixpath.join(options.remoteTestRoot, "profile")
|
||||||
|
@ -210,10 +213,10 @@ class RemoteReftest(RefTest):
|
||||||
expected = options.app.split('/')[-1]
|
expected = options.app.split('/')[-1]
|
||||||
if not self.device.is_app_installed(expected):
|
if not self.device.is_app_installed(expected):
|
||||||
raise Exception("%s is not installed on this device" % expected)
|
raise Exception("%s is not installed on this device" % expected)
|
||||||
|
self.device.run_as_package = expected
|
||||||
self.device.clear_logcat()
|
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]
|
procName = options.app.split('/')[-1]
|
||||||
self.device.stop_application(procName)
|
self.device.stop_application(procName)
|
||||||
|
@ -327,7 +330,7 @@ class RemoteReftest(RefTest):
|
||||||
# make sure the parent directories of the profile which
|
# make sure the parent directories of the profile which
|
||||||
# may have been created by the push, also have their
|
# may have been created by the push, also have their
|
||||||
# permissions set to allow access.
|
# permissions set to allow access.
|
||||||
self.device.chmod(options.remoteTestRoot, recursive=True, root=True)
|
self.device.chmod(options.remoteTestRoot, recursive=True)
|
||||||
except Exception:
|
except Exception:
|
||||||
print("Automation Error: Failed to copy profiledir to device")
|
print("Automation Error: Failed to copy profiledir to device")
|
||||||
raise
|
raise
|
||||||
|
@ -398,9 +401,9 @@ class RemoteReftest(RefTest):
|
||||||
return status
|
return status
|
||||||
|
|
||||||
def cleanup(self, profileDir):
|
def cleanup(self, profileDir):
|
||||||
self.device.rm(self.remoteTestRoot, force=True, recursive=True, root=True)
|
self.device.rm(self.remoteTestRoot, force=True, recursive=True)
|
||||||
self.device.rm(self.remoteProfile, force=True, recursive=True, root=True)
|
self.device.rm(self.remoteProfile, force=True, recursive=True)
|
||||||
self.device.rm(self.remoteCache, force=True, recursive=True, root=True)
|
self.device.rm(self.remoteCache, force=True, recursive=True)
|
||||||
RefTest.cleanup(self, profileDir)
|
RefTest.cleanup(self, profileDir)
|
||||||
|
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче