mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-09-01 10:52:33 +01:00
BaseLinuxDevice: Tidied up the way binaries are handled
Added: get_binary_path: Checks binary_directory for the wanted binary, if if its not there, it will use which to find a system one. returns the full path install_if_needed: will install a binary only if it is not present. Changes: - Busybox is now deployed to non-rooted devices - is_installed has now been removed as the new functions supersede it - binaries will now always be installed to `binaries_directory` and not system folders. - updated workloads to use these new functions - rt-app and sysbench might still need work
This commit is contained in:
@@ -79,11 +79,8 @@ class Cyclictest(Workload):
|
||||
if not self.device.is_rooted:
|
||||
raise WorkloadError("This workload requires a device with root premissions to run")
|
||||
|
||||
if not self.device.is_installed('cyclictest'):
|
||||
host_binary = context.resolver.get(Executable(self, self.device.abi, 'cyclictest'))
|
||||
self.device_binary = self.device.install(host_binary)
|
||||
else:
|
||||
self.device_binary = 'cyclictest'
|
||||
host_binary = context.resolver.get(Executable(self, self.device.abi, 'cyclictest'))
|
||||
self.device_binary = self.device.install(host_binary)
|
||||
|
||||
self.cyclictest_command = self.cyclictest_command.format(self.device_binary,
|
||||
0 if self.clock == 'monotonic' else 1,
|
||||
|
@@ -57,11 +57,8 @@ class Ebizzy(Workload):
|
||||
self.run_timeout = self.seconds + timeout_buf
|
||||
|
||||
self.binary_name = 'ebizzy'
|
||||
if not self.device.is_installed(self.binary_name):
|
||||
host_binary = context.resolver.get(Executable(self, self.device.abi, self.binary_name))
|
||||
self.device_binary = self.device.install(host_binary)
|
||||
else:
|
||||
self.device_binary = self.binary_name
|
||||
host_binary = context.resolver.get(Executable(self, self.device.abi, self.binary_name))
|
||||
self.device_binary = self.device.install_if_needed(host_binary)
|
||||
|
||||
self.command = self.command.format(self.device_binary, self.threads, self.seconds,
|
||||
self.chunks, self.extra_params, self.ebizzy_results)
|
||||
|
@@ -61,11 +61,8 @@ class Hackbench(Workload):
|
||||
self.run_timeout = self.duration + timeout_buf
|
||||
|
||||
self.binary_name = 'hackbench'
|
||||
if not self.device.is_installed(self.binary_name):
|
||||
host_binary = context.resolver.get(Executable(self, self.device.abi, self.binary_name))
|
||||
self.device_binary = self.device.install(host_binary)
|
||||
else:
|
||||
self.device_binary = self.binary_name
|
||||
host_binary = context.resolver.get(Executable(self, self.device.abi, self.binary_name))
|
||||
self.device_binary = self.device.install(host_binary)
|
||||
|
||||
self.command = self.command.format(self.device_binary, self.datasize, self.groups,
|
||||
self.loops, self.extra_params, self.hackbench_result)
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import os
|
||||
import re
|
||||
|
||||
from wlauto import Workload, Parameter
|
||||
from wlauto import Workload, Parameter, Executable
|
||||
|
||||
|
||||
THIS_DIR = os.path.dirname(__file__)
|
||||
@@ -54,11 +54,10 @@ class MemcpyTest(Workload):
|
||||
]
|
||||
|
||||
def setup(self, context):
|
||||
self.host_binary = os.path.join(THIS_DIR, 'memcpy')
|
||||
if not self.device.is_installed('memcpy'):
|
||||
self.device_binary = self.device.install(self.host_binary)
|
||||
else:
|
||||
self.device_binary = 'memcpy'
|
||||
self.binary_name = 'memcpy'
|
||||
host_binary = context.resolver.get(Executable(self, self.device.abi, self.binary_name))
|
||||
self.device_binary = self.device.install_if_needed(host_binary)
|
||||
|
||||
self.command = '{} -i {} -s {}'.format(self.device_binary, self.iterations, self.buffer_size)
|
||||
if self.cpus:
|
||||
for c in self.cpus:
|
||||
|
BIN
wlauto/workloads/memcpy/bin/arm64/memcpy
Executable file
BIN
wlauto/workloads/memcpy/bin/arm64/memcpy
Executable file
Binary file not shown.
@@ -216,14 +216,13 @@ class RtApp(Workload):
|
||||
|
||||
def _deploy_rt_app_binary_if_necessary(self):
|
||||
# called from initialize() so gets invoked once per run
|
||||
if self.force_install or not self.device.is_installed(BINARY_NAME):
|
||||
RtApp.device_binary = self.device.get_binary_path("rt-app")
|
||||
if self.force_install or not RtApp.device_binary:
|
||||
if not self.host_binary:
|
||||
message = '''rt-app is not installed on the device and could not be
|
||||
found in workload resources'''
|
||||
raise ResourceError(message)
|
||||
RtApp.device_binary = self.device.install(self.host_binary)
|
||||
else:
|
||||
RtApp.device_binary = BINARY_NAME
|
||||
|
||||
def _load_json_config(self, context):
|
||||
user_config_file = self._get_raw_json_config(context.resolver)
|
||||
@@ -280,4 +279,3 @@ class RtApp(Workload):
|
||||
tf.extractall(context.output_directory)
|
||||
os.remove(host_path)
|
||||
self.device.execute('rm -rf {}/*'.format(self.device_working_directory))
|
||||
|
||||
|
@@ -132,13 +132,13 @@ class Sysbench(Workload):
|
||||
self.device.delete_file(self.results_file)
|
||||
|
||||
def _check_executable(self):
|
||||
self.on_device_binary = self.device.path.join(self.device.binaries_directory, 'sysbench')
|
||||
if self.device.is_installed('sysbench') and not self.force_install:
|
||||
self.logger.debug('sysbench found on device')
|
||||
return
|
||||
if not self.on_host_binary:
|
||||
self.on_device_binary = self.device.get_binary_path("sysbench")
|
||||
if not self.on_device_binary and not self.on_host_binary:
|
||||
raise WorkloadError('sysbench binary is not installed on the device, and it is not found on the host.')
|
||||
self.device.install(self.on_host_binary)
|
||||
if self.force_install:
|
||||
self.device.install(self.on_host_binary)
|
||||
else:
|
||||
self.device.install_if_needed(self.on_host_binary)
|
||||
|
||||
def _build_command(self, **parameters):
|
||||
param_strings = ['--{}={}'.format(k.replace('_', '-'), v)
|
||||
|
Reference in New Issue
Block a user