mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-20 20:09:11 +00:00
Add unsupported package check to AndroidUiAutoBenchmark
Add method to automatically check against a dictionary of known package versions that don't work well with AndroidUiAutoBenchmark workloads. Raises an exception if found.
This commit is contained in:
parent
0f579e18b3
commit
86f3066f56
@ -24,7 +24,7 @@ from wlauto.core.resource import NO_ONE
|
||||
from wlauto.common.android.resources import ApkFile
|
||||
from wlauto.common.resources import ExtensionAsset, Executable
|
||||
from wlauto.exceptions import WorkloadError, ResourceError, ConfigError, DeviceError
|
||||
from wlauto.utils.android import ApkInfo, ANDROID_NORMAL_PERMISSIONS
|
||||
from wlauto.utils.android import ApkInfo, ANDROID_NORMAL_PERMISSIONS, UNSUPPORTED_PACKAGES
|
||||
from wlauto.utils.types import boolean
|
||||
from wlauto.utils.revent import ReventParser
|
||||
from wlauto import File
|
||||
@ -428,6 +428,11 @@ class AndroidUiAutoBenchmark(UiAutomatorWorkload, AndroidBenchmark):
|
||||
UiAutomatorWorkload.__init__(self, device, **kwargs)
|
||||
AndroidBenchmark.__init__(self, device, _call_super=False, **kwargs)
|
||||
|
||||
def initialize(self, context):
|
||||
UiAutomatorWorkload.initialize(self, context)
|
||||
AndroidBenchmark.initialize(self, context)
|
||||
self._check_unsupported_packages()
|
||||
|
||||
def init_resources(self, context):
|
||||
UiAutomatorWorkload.init_resources(self, context)
|
||||
AndroidBenchmark.init_resources(self, context)
|
||||
@ -444,6 +449,24 @@ class AndroidUiAutoBenchmark(UiAutomatorWorkload, AndroidBenchmark):
|
||||
UiAutomatorWorkload.teardown(self, context)
|
||||
AndroidBenchmark.teardown(self, context)
|
||||
|
||||
def _check_unsupported_packages(self):
|
||||
"""
|
||||
Check for any unsupported package versions and raise an
|
||||
exception if detected.
|
||||
|
||||
"""
|
||||
for package in UNSUPPORTED_PACKAGES:
|
||||
version = self.device.get_installed_package_version(package)
|
||||
if version is None:
|
||||
continue
|
||||
|
||||
if '-' in version:
|
||||
version = version.split('-')[0] # ignore abi version
|
||||
|
||||
if version in UNSUPPORTED_PACKAGES[package]:
|
||||
message = 'This workload does not support version "{}" of package "{}"'
|
||||
raise WorkloadError(message.format(version, package))
|
||||
|
||||
|
||||
class GameWorkload(ApkWorkload, ReventWorkload):
|
||||
"""
|
||||
|
@ -100,6 +100,16 @@ ANDROID_NORMAL_PERMISSIONS = [
|
||||
'UNINSTALL_SHORTCUT',
|
||||
]
|
||||
|
||||
# Package versions that are known to have problems with AndroidUiAutoBenchmark workloads.
|
||||
# NOTE: ABI versions are not included.
|
||||
UNSUPPORTED_PACKAGES = {
|
||||
# Google Keyboard:
|
||||
# For some versions of the Google Keyboard package device key presses are
|
||||
# not registered correctly when running UiAutomator Workloads.
|
||||
'com.google.android.inputmethod.latin': ['5.0.25.122319759']
|
||||
}
|
||||
|
||||
|
||||
# TODO: these are set to their actual values near the bottom of the file. There
|
||||
# is some HACKery involved to ensure that ANDROID_HOME does not need to be set
|
||||
# or adb added to path for root when installing as root, and the whole
|
||||
|
Loading…
x
Reference in New Issue
Block a user