mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-18 12:06:08 +00:00
workloads: Update to better utilize cleanup_assets
and uninstall
Update the workload classes to attempt and standardize the use of the `cleanup_assets` parameter and the newly added `uninstall` parameter
This commit is contained in:
parent
f5d1a9e94a
commit
1108c5701e
@ -358,7 +358,8 @@ class ApkUIWorkload(ApkWorkload):
|
|||||||
@once_per_instance
|
@once_per_instance
|
||||||
def finalize(self, context):
|
def finalize(self, context):
|
||||||
super(ApkUIWorkload, self).finalize(context)
|
super(ApkUIWorkload, self).finalize(context)
|
||||||
self.gui.remove()
|
if self.cleanup_assets:
|
||||||
|
self.gui.remove()
|
||||||
|
|
||||||
|
|
||||||
class ApkUiautoWorkload(ApkUIWorkload):
|
class ApkUiautoWorkload(ApkUIWorkload):
|
||||||
@ -438,7 +439,8 @@ class UIWorkload(Workload):
|
|||||||
@once_per_instance
|
@once_per_instance
|
||||||
def finalize(self, context):
|
def finalize(self, context):
|
||||||
super(UIWorkload, self).finalize(context)
|
super(UIWorkload, self).finalize(context)
|
||||||
self.gui.remove()
|
if self.cleanup_assets:
|
||||||
|
self.gui.remove()
|
||||||
|
|
||||||
|
|
||||||
class UiautoWorkload(UIWorkload):
|
class UiautoWorkload(UIWorkload):
|
||||||
@ -634,12 +636,12 @@ class ReventGUI(object):
|
|||||||
if self.revent_teardown_file:
|
if self.revent_teardown_file:
|
||||||
self.revent_recorder.replay(self.on_target_teardown_revent,
|
self.revent_recorder.replay(self.on_target_teardown_revent,
|
||||||
timeout=self.teardown_timeout)
|
timeout=self.teardown_timeout)
|
||||||
|
|
||||||
|
def remove(self):
|
||||||
self.target.remove(self.on_target_setup_revent)
|
self.target.remove(self.on_target_setup_revent)
|
||||||
self.target.remove(self.on_target_run_revent)
|
self.target.remove(self.on_target_run_revent)
|
||||||
self.target.remove(self.on_target_extract_results_revent)
|
self.target.remove(self.on_target_extract_results_revent)
|
||||||
self.target.remove(self.on_target_teardown_revent)
|
self.target.remove(self.on_target_teardown_revent)
|
||||||
|
|
||||||
def remove(self):
|
|
||||||
self.revent_recorder.remove()
|
self.revent_recorder.remove()
|
||||||
|
|
||||||
def _check_revent_files(self):
|
def _check_revent_files(self):
|
||||||
|
@ -153,7 +153,8 @@ class Dhrystone(Workload):
|
|||||||
|
|
||||||
@once
|
@once
|
||||||
def finalize(self, context):
|
def finalize(self, context):
|
||||||
self.target.uninstall('dhrystone')
|
if self.uninstall:
|
||||||
|
self.target.uninstall('dhrystone')
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
if self.mloops and self.duration: # pylint: disable=E0203
|
if self.mloops and self.duration: # pylint: disable=E0203
|
||||||
|
@ -90,8 +90,10 @@ class Hackbench(Workload):
|
|||||||
context.add_metric(label, float(match.group(1)), units)
|
context.add_metric(label, float(match.group(1)), units)
|
||||||
|
|
||||||
def teardown(self, context):
|
def teardown(self, context):
|
||||||
self.target.execute('rm -f {}'.format(self.target_output_file))
|
if self.cleanup_assets:
|
||||||
|
self.target.execute('rm -f {}'.format(self.target_output_file))
|
||||||
|
|
||||||
@once
|
@once
|
||||||
def finalize(self, context):
|
def finalize(self, context):
|
||||||
self.target.uninstall(self.binary_name)
|
if self.uninstall:
|
||||||
|
self.target.uninstall(self.binary_name)
|
||||||
|
@ -120,5 +120,5 @@ class HWUITest(Workload):
|
|||||||
|
|
||||||
@once
|
@once
|
||||||
def finalize(self, context):
|
def finalize(self, context):
|
||||||
if self.target_exe:
|
if self.target_exe and self.uninstall:
|
||||||
self.target.uninstall(self.target_exe)
|
self.target.uninstall(self.target_exe)
|
||||||
|
@ -117,7 +117,8 @@ class Lmbench(Workload):
|
|||||||
context.add_artifact('lmbench-result', "lmbench.output", kind='raw')
|
context.add_artifact('lmbench-result', "lmbench.output", kind='raw')
|
||||||
|
|
||||||
def teardown(self, context):
|
def teardown(self, context):
|
||||||
self.target.uninstall(self.test)
|
if self.uninstall:
|
||||||
|
self.target.uninstall(self.test)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test setup routines
|
# Test setup routines
|
||||||
|
@ -286,7 +286,8 @@ class Meabo(Workload):
|
|||||||
int(match.group('duration')), units="ns")
|
int(match.group('duration')), units="ns")
|
||||||
|
|
||||||
def finalize(self, context):
|
def finalize(self, context):
|
||||||
self._uninstall_executable()
|
if self.uninstall:
|
||||||
|
self._uninstall_executable()
|
||||||
|
|
||||||
def _build_command(self):
|
def _build_command(self):
|
||||||
self.command = self.target_exe
|
self.command = self.target_exe
|
||||||
|
@ -86,4 +86,5 @@ class Memcpy(Workload):
|
|||||||
|
|
||||||
@once
|
@once
|
||||||
def finalize(self, context):
|
def finalize(self, context):
|
||||||
self.target.uninstall('memcpy')
|
if self.uninstall:
|
||||||
|
self.target.uninstall('memcpy')
|
||||||
|
@ -156,5 +156,5 @@ class Openssl(Workload):
|
|||||||
|
|
||||||
@once
|
@once
|
||||||
def finalize(self, context):
|
def finalize(self, context):
|
||||||
if not self.use_system_binary:
|
if not self.use_system_binary and self.uninstall:
|
||||||
self.target.uninstall('openssl')
|
self.target.uninstall('openssl')
|
||||||
|
@ -130,8 +130,8 @@ class RtApp(Workload):
|
|||||||
'''),
|
'''),
|
||||||
Parameter('cpus', kind=cpu_mask, default=0, aliases=['taskset_mask'],
|
Parameter('cpus', kind=cpu_mask, default=0, aliases=['taskset_mask'],
|
||||||
description='Constrain execution to specific CPUs.'),
|
description='Constrain execution to specific CPUs.'),
|
||||||
Parameter('uninstall_on_exit', kind=bool, default=False,
|
Parameter('uninstall', aliases=['uninstall_on_exit'], kind=bool, default=False,
|
||||||
description="""
|
override=True, description="""
|
||||||
If set to ``True``, rt-app binary will be uninstalled from the device
|
If set to ``True``, rt-app binary will be uninstalled from the device
|
||||||
at the end of the run.
|
at the end of the run.
|
||||||
"""),
|
"""),
|
||||||
@ -213,9 +213,10 @@ class RtApp(Workload):
|
|||||||
|
|
||||||
@once
|
@once
|
||||||
def finalize(self, context):
|
def finalize(self, context):
|
||||||
if self.uninstall_on_exit:
|
if self.uninstall:
|
||||||
self.target.uninstall(self.target_binary)
|
self.target.uninstall(self.target_binary)
|
||||||
self.target.execute('rm -rf {}'.format(self.target_working_directory))
|
if self.cleanup_assets:
|
||||||
|
self.target.execute('rm -rf {}'.format(self.target_working_directory))
|
||||||
|
|
||||||
def _deploy_rt_app_binary_if_necessary(self):
|
def _deploy_rt_app_binary_if_necessary(self):
|
||||||
# called from initialize() so gets invoked once per run
|
# called from initialize() so gets invoked once per run
|
||||||
|
@ -67,4 +67,5 @@ class ShellScript(Workload):
|
|||||||
wfh.write(self.output)
|
wfh.write(self.output)
|
||||||
|
|
||||||
def teardown(self, context):
|
def teardown(self, context):
|
||||||
self.target.remove(self.on_target_script_file)
|
if self.cleanup_assets:
|
||||||
|
self.target.remove(self.on_target_script_file)
|
||||||
|
@ -131,4 +131,5 @@ class StressNg(Workload):
|
|||||||
|
|
||||||
@once
|
@once
|
||||||
def finalize(self, context):
|
def finalize(self, context):
|
||||||
self.target.uninstall('stress-ng')
|
if self.uninstall:
|
||||||
|
self.target.uninstall('stress-ng')
|
||||||
|
@ -147,11 +147,13 @@ class Sysbench(Workload):
|
|||||||
extract_threads_fairness_metric('execution time', next(fh), context.output)
|
extract_threads_fairness_metric('execution time', next(fh), context.output)
|
||||||
|
|
||||||
def teardown(self, context):
|
def teardown(self, context):
|
||||||
self.target.remove(self.target_results_file)
|
if self.cleanup_assets:
|
||||||
|
self.target.remove(self.target_results_file)
|
||||||
|
|
||||||
@once
|
@once
|
||||||
def finalize(self, context):
|
def finalize(self, context):
|
||||||
self.target.uninstall('sysbench')
|
if self.uninstall:
|
||||||
|
self.target.uninstall('sysbench')
|
||||||
|
|
||||||
def _build_command(self, **parameters):
|
def _build_command(self, **parameters):
|
||||||
param_strings = ['--{}={}'.format(k.replace('_', '-'), v)
|
param_strings = ['--{}={}'.format(k.replace('_', '-'), v)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user