1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-21 12:28:44 +00:00

Add new AndroidUxPerfWorkload class

Create a new workload class to encapsulate functionality common to all
uxperf workloads.
This commit is contained in:
John Richardson 2016-08-25 10:58:16 +01:00
parent 64860a2d1a
commit 67f418f79f
2 changed files with 60 additions and 2 deletions

View File

@ -29,7 +29,7 @@ from wlauto.common.linux.device import LinuxDevice # NOQA
from wlauto.common.android.device import AndroidDevice, BigLittleDevice # NOQA from wlauto.common.android.device import AndroidDevice, BigLittleDevice # NOQA
from wlauto.common.android.resources import ApkFile, JarFile from wlauto.common.android.resources import ApkFile, JarFile
from wlauto.common.android.workload import (UiAutomatorWorkload, ApkWorkload, AndroidBenchmark, # NOQA from wlauto.common.android.workload import (UiAutomatorWorkload, ApkWorkload, AndroidBenchmark, # NOQA
AndroidUiAutoBenchmark, GameWorkload) # NOQA AndroidUiAutoBenchmark, AndroidUxPerfWorkload, GameWorkload) # NOQA
from wlauto.core.version import get_wa_version from wlauto.core.version import get_wa_version

View File

@ -18,7 +18,7 @@ import sys
import time import time
from math import ceil from math import ceil
from wlauto.core.extension import Parameter from wlauto.core.extension import Parameter, ExtensionMeta, ListCollection
from wlauto.core.workload import Workload from wlauto.core.workload import Workload
from wlauto.core.resource import NO_ONE from wlauto.core.resource import NO_ONE
from wlauto.common.android.resources import ApkFile from wlauto.common.android.resources import ApkFile
@ -469,6 +469,64 @@ class AndroidUiAutoBenchmark(UiAutomatorWorkload, AndroidBenchmark):
raise WorkloadError(message.format(version, package)) raise WorkloadError(message.format(version, package))
class AndroidUxPerfWorkloadMeta(ExtensionMeta):
to_propagate = ExtensionMeta.to_propagate + [('deployable_assets', str, ListCollection)]
class AndroidUxPerfWorkload(AndroidUiAutoBenchmark):
__metaclass__ = AndroidUxPerfWorkloadMeta
deployable_assets = []
parameters = [
Parameter('markers_enabled', kind=bool, default=False,
description="""
If ``True``, UX_PERF action markers will be emitted to logcat during
the test run.
"""),
Parameter('clean_assets', kind=bool, default=False,
description="""
If ``True`` pushed assets will be deleted at the end of each iteration
"""),
Parameter('force_push_assets', kind=bool, default=False,
description="""
If ``True`` always push assets on each iteration, even if the
assets already exists in the device path
"""),
]
def _path_on_device(self, fpath, dirname=None):
if dirname is None:
dirname = self.device.working_directory
fname = os.path.basename(fpath)
return self.device.path.join(dirname, fname)
def push_assets(self, context):
for f in self.deployable_assets:
fpath = context.resolver.get(File(self, f))
device_path = self._path_on_device(fpath)
if self.force_push_assets or not self.device.file_exists(device_path):
self.device.push_file(fpath, device_path, timeout=300)
def delete_assets(self):
for f in self.deployable_assets:
self.device.delete_file(self._path_on_device(f))
def __init__(self, device, **kwargs):
super(AndroidUxPerfWorkload, self).__init__(device, **kwargs)
# Turn class attribute into instance attribute
self.deployable_assets = list(self.deployable_assets)
def setup(self, context):
super(AndroidUxPerfWorkload, self).setup(context)
self.push_assets(context)
self.uiauto_params['markers_enabled'] = self.markers_enabled
def teardown(self, context):
super(AndroidUxPerfWorkload, self).teardown(context)
if self.clean_assets:
self.delete_assets()
class GameWorkload(ApkWorkload, ReventWorkload): class GameWorkload(ApkWorkload, ReventWorkload):
""" """
GameWorkload is the base class for all the workload that use revent files to GameWorkload is the base class for all the workload that use revent files to