mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-20 20:09:11 +00:00
framework/workload: Add rerun infrastructure
This commit is contained in:
parent
dfa55c1322
commit
6cc1ac147c
@ -171,6 +171,10 @@ class ApkWorkload(Workload):
|
||||
package_names = []
|
||||
view = None
|
||||
|
||||
# Set this to True to mark that this workload requires the target apk to be run
|
||||
# for initialisation purposes before the main run is performed.
|
||||
requires_rerun = False
|
||||
|
||||
parameters = [
|
||||
Parameter('package_name', kind=str,
|
||||
description="""
|
||||
@ -261,8 +265,18 @@ class ApkWorkload(Workload):
|
||||
def setup(self, context):
|
||||
super(ApkWorkload, self).setup(context)
|
||||
self.apk.setup(context)
|
||||
if self.requires_rerun:
|
||||
self.setup_rerun()
|
||||
self.apk.restart_activity()
|
||||
time.sleep(self.loading_time)
|
||||
|
||||
def setup_rerun(self):
|
||||
"""
|
||||
Perform the setup necessary to rerun the workload. Only called if
|
||||
``requires_rerun`` is set.
|
||||
"""
|
||||
pass
|
||||
|
||||
def teardown(self, context):
|
||||
super(ApkWorkload, self).teardown(context)
|
||||
self.apk.teardown()
|
||||
@ -786,6 +800,10 @@ class PackageHandler(object):
|
||||
raise WorkloadError(output)
|
||||
self.logger.debug(output)
|
||||
|
||||
def restart_activity(self):
|
||||
self.target.execute('am force-stop {}'.format(self.apk_info.package))
|
||||
self.start_activity()
|
||||
|
||||
def reset(self, context): # pylint: disable=W0613
|
||||
self.target.execute('am force-stop {}'.format(self.apk_info.package))
|
||||
self.target.execute('pm clear {}'.format(self.apk_info.package))
|
||||
|
Loading…
x
Reference in New Issue
Block a user