1
0
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:
Marc Bonnici 2019-06-20 11:43:33 +01:00
parent f5d1a9e94a
commit 1108c5701e
12 changed files with 33 additions and 20 deletions

View File

@ -358,7 +358,8 @@ class ApkUIWorkload(ApkWorkload):
@once_per_instance
def finalize(self, context):
super(ApkUIWorkload, self).finalize(context)
self.gui.remove()
if self.cleanup_assets:
self.gui.remove()
class ApkUiautoWorkload(ApkUIWorkload):
@ -438,7 +439,8 @@ class UIWorkload(Workload):
@once_per_instance
def finalize(self, context):
super(UIWorkload, self).finalize(context)
self.gui.remove()
if self.cleanup_assets:
self.gui.remove()
class UiautoWorkload(UIWorkload):
@ -634,12 +636,12 @@ class ReventGUI(object):
if self.revent_teardown_file:
self.revent_recorder.replay(self.on_target_teardown_revent,
timeout=self.teardown_timeout)
def remove(self):
self.target.remove(self.on_target_setup_revent)
self.target.remove(self.on_target_run_revent)
self.target.remove(self.on_target_extract_results_revent)
self.target.remove(self.on_target_teardown_revent)
def remove(self):
self.revent_recorder.remove()
def _check_revent_files(self):

View File

@ -153,7 +153,8 @@ class Dhrystone(Workload):
@once
def finalize(self, context):
self.target.uninstall('dhrystone')
if self.uninstall:
self.target.uninstall('dhrystone')
def validate(self):
if self.mloops and self.duration: # pylint: disable=E0203

View File

@ -90,8 +90,10 @@ class Hackbench(Workload):
context.add_metric(label, float(match.group(1)), units)
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
def finalize(self, context):
self.target.uninstall(self.binary_name)
if self.uninstall:
self.target.uninstall(self.binary_name)

View File

@ -120,5 +120,5 @@ class HWUITest(Workload):
@once
def finalize(self, context):
if self.target_exe:
if self.target_exe and self.uninstall:
self.target.uninstall(self.target_exe)

View File

@ -117,7 +117,8 @@ class Lmbench(Workload):
context.add_artifact('lmbench-result', "lmbench.output", kind='raw')
def teardown(self, context):
self.target.uninstall(self.test)
if self.uninstall:
self.target.uninstall(self.test)
#
# Test setup routines

View File

@ -286,7 +286,8 @@ class Meabo(Workload):
int(match.group('duration')), units="ns")
def finalize(self, context):
self._uninstall_executable()
if self.uninstall:
self._uninstall_executable()
def _build_command(self):
self.command = self.target_exe

View File

@ -86,4 +86,5 @@ class Memcpy(Workload):
@once
def finalize(self, context):
self.target.uninstall('memcpy')
if self.uninstall:
self.target.uninstall('memcpy')

View File

@ -156,5 +156,5 @@ class Openssl(Workload):
@once
def finalize(self, context):
if not self.use_system_binary:
if not self.use_system_binary and self.uninstall:
self.target.uninstall('openssl')

View File

@ -130,8 +130,8 @@ class RtApp(Workload):
'''),
Parameter('cpus', kind=cpu_mask, default=0, aliases=['taskset_mask'],
description='Constrain execution to specific CPUs.'),
Parameter('uninstall_on_exit', kind=bool, default=False,
description="""
Parameter('uninstall', aliases=['uninstall_on_exit'], kind=bool, default=False,
override=True, description="""
If set to ``True``, rt-app binary will be uninstalled from the device
at the end of the run.
"""),
@ -213,9 +213,10 @@ class RtApp(Workload):
@once
def finalize(self, context):
if self.uninstall_on_exit:
if self.uninstall:
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):
# called from initialize() so gets invoked once per run

View File

@ -67,4 +67,5 @@ class ShellScript(Workload):
wfh.write(self.output)
def teardown(self, context):
self.target.remove(self.on_target_script_file)
if self.cleanup_assets:
self.target.remove(self.on_target_script_file)

View File

@ -131,4 +131,5 @@ class StressNg(Workload):
@once
def finalize(self, context):
self.target.uninstall('stress-ng')
if self.uninstall:
self.target.uninstall('stress-ng')

View File

@ -147,11 +147,13 @@ class Sysbench(Workload):
extract_threads_fairness_metric('execution time', next(fh), context.output)
def teardown(self, context):
self.target.remove(self.target_results_file)
if self.cleanup_assets:
self.target.remove(self.target_results_file)
@once
def finalize(self, context):
self.target.uninstall('sysbench')
if self.uninstall:
self.target.uninstall('sysbench')
def _build_command(self, **parameters):
param_strings = ['--{}={}'.format(k.replace('_', '-'), v)