1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-31 02:01:16 +00:00

uibench: Support taking a list of activities

It is desired to be able to run multiple activities with a single agenda
file. We can make the @activity parameter take a list of activities
separated by white space and run them all in one go. Each activity well
run for the specified @duration.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
This commit is contained in:
Qais Yousef 2022-04-15 01:57:11 +01:00
parent b109acac05
commit 345d9e0a0d

View File

@ -39,6 +39,8 @@ class Uibench(ApkWorkload):
recommend using the APK of UIBench corresponding to the recommend using the APK of UIBench corresponding to the
Android version, enforced through the ``version`` parameter to Android version, enforced through the ``version`` parameter to
this workload. this workload.
You can provide multiple activities to run by separating them
with white space.
"""), """),
Parameter('duration', kind=int, default=10, Parameter('duration', kind=int, default=10,
description=""" description="""
@ -47,6 +49,27 @@ class Uibench(ApkWorkload):
"""), """),
] ]
def run(self, context): def __init__(self, target, **kwargs):
super(Uibench, self).run(context) super(Uibench, self).__init__(target, **kwargs)
self.target.sleep(self.duration) if self.activity:
activities = self.activity.split()
self.activity = ''
for activity in activities:
if '.' not in activity:
# If we're receiving just the activity name, it's taken relative to
# the package namespace:
self.activity += ' .' + activity
else:
self.activity += ' ' + activity
def setup(self, context):
if self.activity:
activities = self.activity.split()
for activity in activities:
self.apk._activity = activity
self.logger.info("Starting {} for {} seconds".format(activity, self.duration))
super(Uibench, self).setup(context)
self.target.sleep(self.duration)
else:
super(Uibench, self).setup(context)
self.target.sleep(self.duration)