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

Fixed WA extensions for LinuxManager

Changed method calls to devlib naming
This commit is contained in:
Sebastian Goscik
2016-02-16 15:38:48 +00:00
parent 6f0de17201
commit 001239dfe4
47 changed files with 107 additions and 1244 deletions

View File

@@ -40,7 +40,7 @@ class Androbench(AndroidUiAutoBenchmark):
dbn = 'databases/history.db'
db = self.device.path.join(self.device.package_data_directory, self.package, dbn)
host_results = os.path.join(context.output_directory, 'history.db')
self.device.pull_file(db, host_results, as_root=True)
self.device.pull(db, host_results, as_root=True)
qs = 'select * from history'
conn = sqlite3.connect(host_results)
c = conn.cursor()

View File

@@ -132,7 +132,7 @@ class ApplaunchWorkload(Workload):
if self.io_stress:
host_scheduler_file = os.path.join(context.output_directory, 'scheduler')
device_scheduler_file = '/sys/block/mmcblk0/queue/scheduler'
self.device.pull_file(device_scheduler_file, host_scheduler_file)
self.device.pull(device_scheduler_file, host_scheduler_file)
with open(host_scheduler_file) as fh:
scheduler = fh.read()
scheduler_used = scheduler[scheduler.index("[") + 1:scheduler.index("]")]
@@ -144,7 +144,7 @@ class ApplaunchWorkload(Workload):
if self.set_launcher_affinity:
self._reset_launcher_affinity()
if self.cleanup:
self.device.delete_file(self.device_script_file)
self.device.remove(self.device_script_file)
def _set_launcher_affinity(self):
try:
@@ -169,7 +169,7 @@ class ApplaunchWorkload(Workload):
def _extract_results_from_file(self, context, filename, metric_suffix):
host_result_file = os.path.join(context.output_directory, filename)
device_result_file = self.device.path.join(self.device.working_directory, filename)
self.device.pull_file(device_result_file, host_result_file)
self.device.pull(device_result_file, host_result_file)
with open(host_result_file) as fh:
if filename == 'time.result':

View File

@@ -57,7 +57,7 @@ class Audio(Workload):
self.on_device_file = os.path.join(self.device.working_directory,
os.path.basename(self.audio_file))
self.device.push_file(self.audio_file, self.on_device_file, timeout=120)
self.device.push(self.audio_file, self.on_device_file, timeout=120)
# Open the browser with default page
self.device.execute('am start -n com.android.browser/.BrowserActivity about:blank')
@@ -75,7 +75,7 @@ class Audio(Workload):
if self.clear_file_cache:
self.device.execute('sync')
self.device.set_sysfile_value('/proc/sys/vm/drop_caches', 3)
self.device.write_value('/proc/sys/vm/drop_caches', 3)
# Start the background music
self.device.execute('am start -W -S -n com.android.music/.MediaPlaybackActivity -d {}'.format(self.on_device_file))
@@ -95,7 +95,7 @@ class Audio(Workload):
def teardown(self, context):
if self.perform_cleanup:
self.device.delete_file(self.on_device_file)
self.device.remove(self.on_device_file)
def _download_audio_file(self):
self.logger.debug('Downloading audio file from {}'.format(DEFAULT_AUDIO_FILE_URL))

View File

@@ -59,7 +59,7 @@ class ChromeAutotest(Workload):
]
def setup(self, context):
if self.device.platform != 'chromeos':
if self.device.os != 'chromeos':
raise WorkloadError('{} only supports ChromeOS devices'.format(self.name))
self.test_that = which('test_that')
if not self.test_that:

View File

@@ -93,12 +93,12 @@ class BBench(Workload):
if self.with_audio:
if self.force_dependency_push or not self.device.file_exists(self.audio_on_device):
self.device.push_file(self.audio_file, self.audio_on_device, timeout=120)
self.device.push(self.audio_file, self.audio_on_device, timeout=120)
# Push the bbench site pages and http server to target device
if self.force_dependency_push or not self.device.file_exists(self.bbench_on_device):
self.logger.debug('Copying bbench sites to device.')
self.device.push_file(self.dependencies_directory, self.bbench_on_device, timeout=300)
self.device.push(self.dependencies_directory, self.bbench_on_device, timeout=300)
# Push the bbench server
host_binary = context.resolver.get(Executable(self, self.device.abi, 'bbench_server'))
@@ -120,7 +120,7 @@ class BBench(Workload):
self.device.execute('pm clear {}'.format(self.browser_package))
if self.clear_file_cache:
self.device.execute('sync')
self.device.set_sysfile_value('/proc/sys/vm/drop_caches', 3)
self.device.write_value('/proc/sys/vm/drop_caches', 3)
#On android 6+ the web browser requires permissions to access the sd card
if self.device.get_sdk_version() >= 23:
@@ -148,12 +148,12 @@ class BBench(Workload):
# Get index_no_input.html
indexfile = os.path.join(self.device.working_directory, 'bbench/index_noinput.html')
self.device.pull_file(indexfile, context.output_directory)
self.device.pull(indexfile, context.output_directory)
# Get the logs
output_file = os.path.join(self.device.working_directory, 'browser_bbench_logcat.txt')
self.device.execute('logcat -v time -d > {}'.format(output_file))
self.device.pull_file(output_file, context.output_directory)
self.device.pull(output_file, context.output_directory)
metrics = _parse_metrics(os.path.join(context.output_directory, 'browser_bbench_logcat.txt'),
os.path.join(context.output_directory, 'index_noinput.html'),

View File

@@ -57,7 +57,7 @@ class Cfbench(AndroidUiAutoBenchmark):
self.package,
'shared_prefs', 'eu.chainfire.cfbench_preferences.xml ')
self.device.execute('cp {} {}'.format(device_results_file, self.device.working_directory), as_root=True)
self.device.pull_file(os.path.join(self.device.working_directory, 'eu.chainfire.cfbench_preferences.xml'), context.output_directory)
self.device.pull(os.path.join(self.device.working_directory, 'eu.chainfire.cfbench_preferences.xml'), context.output_directory)
result_file = os.path.join(context.output_directory, 'eu.chainfire.cfbench_preferences.xml')
tree = ET.parse(result_file)
root = tree.getroot()

View File

@@ -93,9 +93,9 @@ class Cyclictest(Workload):
if self.clear_file_cache:
self.device.execute('sync')
self.device.set_sysfile_value('/proc/sys/vm/drop_caches', 3)
self.device.write_value('/proc/sys/vm/drop_caches', 3)
if self.device.platform == 'android':
if self.device.os == 'android':
if self.screen_off and self.device.is_screen_on:
self.device.execute('input keyevent 26')
@@ -103,7 +103,7 @@ class Cyclictest(Workload):
self.device.execute(self.cyclictest_command, self.duration * 2, as_root=True)
def update_result(self, context):
self.device.pull_file(self.cyclictest_result, context.output_directory)
self.device.pull(self.cyclictest_result, context.output_directory)
# Parsing the output
# Standard Cyclictest Output:
@@ -132,7 +132,7 @@ class Cyclictest(Workload):
context.result.add_metric(full_key, value, 'microseconds')
def teardown(self, context):
if self.device.platform == 'android':
if self.device.os == 'android':
if self.screen_off:
self.device.ensure_screen_is_on()
self.device.execute('rm -f {}'.format(self.cyclictest_result))

View File

@@ -71,7 +71,7 @@ class Dex2oatBenchmark(Workload):
self.command = self.command_template.format(on_device_apk, self.on_device_oat, self.instruction_set)
if not self.device.file_exists(on_device_apk):
self.device.push_file(self.apk_file, on_device_apk)
self.device.push(self.apk_file, on_device_apk)
def run(self, context):
self.device.execute(self.command, self.run_timeout)
@@ -118,5 +118,4 @@ class Dex2oatBenchmark(Workload):
context.result.add_metric('dex2oat_comp_time', time, "ms", lower_is_better=True)
def teardown(self, context):
self.device.delete_file(self.on_device_oat)
self.device.remove(self.on_device_oat)

View File

@@ -120,7 +120,7 @@ class Dhrystone(Workload):
context.result.add_metric('total score', total_score)
def teardown(self, context):
self.device.uninstall_executable('dhrystone')
self.device.uninstall('dhrystone')
def validate(self):
if self.mloops and self.duration: # pylint: disable=E0203

View File

@@ -67,7 +67,7 @@ class Ebizzy(Workload):
self.device.execute(self.command, timeout=self.run_timeout)
def update_result(self, context):
self.device.pull_file(self.ebizzy_results, context.output_directory)
self.device.pull(self.ebizzy_results, context.output_directory)
with open(os.path.join(context.output_directory, results_txt)) as ebizzy_file:
for line in ebizzy_file:
@@ -83,7 +83,7 @@ class Ebizzy(Workload):
results_match.group('unit'))
def teardown(self, context):
self.device.uninstall_executable(self.device_binary)
self.device.uninstall(self.device_binary)
def validate(self):
pass

View File

@@ -71,7 +71,7 @@ class Hackbench(Workload):
self.device.execute(self.command, timeout=self.run_timeout)
def update_result(self, context):
self.device.pull_file(self.hackbench_result, context.output_directory)
self.device.pull(self.hackbench_result, context.output_directory)
with open(os.path.join(context.output_directory, hackbench_results_txt)) as hackbench_file:
for line in hackbench_file:
@@ -81,7 +81,7 @@ class Hackbench(Workload):
context.result.add_metric(label, float(match.group(1)), units)
def teardown(self, context):
self.device.uninstall_executable(self.binary_name)
self.device.uninstall(self.binary_name)
self.device.execute('rm -f {}'.format(self.hackbench_result))
def validate(self):

View File

@@ -105,4 +105,4 @@ class HWUITest(Workload):
"frames": self.frames})
def teardown(self, context):
self.device.uninstall_executable(BINARY)
self.device.uninstall(BINARY)

View File

@@ -44,7 +44,7 @@ class IdleWorkload(Workload):
def setup(self, context):
if self.stop_android:
if self.device.platform != 'android':
if self.device.os != 'android':
raise ConfigError('stop_android can only be set for Android devices')
if not self.device.is_rooted:
raise WorkloadError('Idle workload requires the device to be rooted in order to stop Android.')

View File

@@ -177,12 +177,12 @@ class Iozone(Workload):
self.device.execute(self.command, timeout=self.timeout)
def update_result(self, context):
self.device.pull_file(self.results, context.output_directory)
self.device.pull(self.results, context.output_directory)
self.outfile = os.path.join(context.output_directory,
iozone_results_txt)
if '-b' in self.other_params:
self.device.pull_file(self.device_output_file,
self.device.pull(self.device_output_file,
context.output_directory)
# if running in thread mode
@@ -313,4 +313,4 @@ class Iozone(Workload):
return results
def finalize(self, context):
self.device.uninstall_executable(self.device_binary)
self.device.uninstall(self.device_binary)

View File

@@ -122,7 +122,7 @@ class lmbench(Workload):
context.add_artifact('lmbench', 'lmbench.output', 'data')
def teardown(self, context):
self.device.uninstall_executable(self.test)
self.device.uninstall(self.test)
#
# Test setup routines

View File

@@ -71,7 +71,7 @@ class Peacekeeper(AndroidUiAutoBenchmark):
# Pull the result page url, which contains the results, from the
# peacekeeper.txt file and process it
self.device.pull_file(self.output_file, context.output_directory)
self.device.pull(self.output_file, context.output_directory)
result_file = os.path.join(context.output_directory, 'peacekeeper.txt')
with open(result_file) as fh:
for line in fh:

View File

@@ -68,7 +68,7 @@ class PowerLoadtest(Workload):
]
def setup(self, context):
if self.device.platform != 'chromeos':
if self.device.os != 'chromeos':
raise WorkloadError('{} only supports ChromeOS devices'.format(self.name))
self.test_that = which('test_that')
if not self.test_that:

View File

@@ -57,8 +57,8 @@ class Recentfling(Workload):
def setup(self, context):
self.defs_host = context.resolver.get(File(self, "defs.sh"))
self.recentfling_host = context.resolver.get(File(self, "recentfling.sh"))
self.device.push_file(self.recentfling_host, self.device.working_directory)
self.device.push_file(self.defs_host, self.device.working_directory)
self.device.push(self.recentfling_host, self.device.working_directory)
self.device.push(self.defs_host, self.device.working_directory)
self._kill_recentfling()
self.device.ensure_screen_is_on()
@@ -89,9 +89,9 @@ class Recentfling(Workload):
classifiers={"loop": count or "Average"})
def teardown(self, context):
self.device.delete_file(self.device.path.join(self.device.working_directory,
self.device.remove(self.device.path.join(self.device.working_directory,
"recentfling.sh"))
self.device.delete_file(self.device.path.join(self.device.working_directory,
self.device.remove(self.device.path.join(self.device.working_directory,
"defs.sh"))
def _kill_recentfling(self):

View File

@@ -164,7 +164,7 @@ class RtApp(Workload):
self.host_json_config = self._load_json_config(context)
self.config_file_on_device = self.device.path.join(self.device_working_directory,
os.path.basename(self.host_json_config))
self.device.push_file(self.host_json_config, self.config_file_on_device, timeout=60)
self.device.push(self.host_json_config, self.config_file_on_device, timeout=60)
self.command = '{} {}'.format(self.device_binary, self.config_file_on_device)
time_buffer = 30
@@ -216,7 +216,7 @@ class RtApp(Workload):
def _deploy_rt_app_binary_if_necessary(self):
# called from initialize() so gets invoked once per run
RtApp.device_binary = self.device.get_binary_path("rt-app")
RtApp.device_binary = self.device.get_installed("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
@@ -274,7 +274,7 @@ class RtApp(Workload):
self.device.execute(tar_command, timeout=300)
device_path = self.device.path.join(self.device_working_directory, TARBALL_FILENAME)
host_path = os.path.join(context.output_directory, TARBALL_FILENAME)
self.device.pull_file(device_path, host_path, timeout=120)
self.device.pull(device_path, host_path, timeout=120)
with tarfile.open(host_path, 'r:gz') as tf:
tf.extractall(context.output_directory)
os.remove(host_path)

View File

@@ -51,7 +51,7 @@ class ShellScript(Workload):
def setup(self, context):
self.on_device_script_file = self.device.path.join(self.device.working_directory,
os.path.basename(self.script_file))
self.device.push_file(self.script_file, self.on_device_script_file)
self.device.push(self.script_file, self.on_device_script_file)
self.command = 'sh {} {}'.format(self.on_device_script_file, self.argstring)
def run(self, context):
@@ -62,4 +62,4 @@ class ShellScript(Workload):
wfh.write(self.output)
def teardown(self, context):
self.device.delete_file(self.on_device_script_file)
self.device.remove(self.on_device_script_file)

View File

@@ -253,7 +253,7 @@ class Spec2000(Workload):
if self.force_push_assets or not self.device.file_exists(datadir):
self.device.execute('mkdir -p {}'.format(datadir))
for datafile in bench.datafiles:
self.device.push_file(datafile, self.device.path.join(datadir, os.path.basename(datafile)))
self.device.push(datafile, self.device.path.join(datadir, os.path.basename(datafile)))
if self.mode == 'speed':
cpus = [self._get_fastest_cpu().lower()]

View File

@@ -69,7 +69,7 @@ class Stream(Workload):
self.output = self.device.execute(self.command, timeout=self.timeout)
def update_result(self, context):
self.device.pull_file(self.results, context.output_directory)
self.device.pull(self.results, context.output_directory)
outfile = os.path.join(context.output_directory, stream_results_txt)
with open(outfile, 'r') as stream_file:
@@ -89,5 +89,5 @@ class Stream(Workload):
context.result.add_metric(label, float(match.group(1)), match.group(2))
def finalize(self, context):
self.device.uninstall_executable(self.stream_default)
self.device.uninstall_executable(self.stream_optional)
self.device.uninstall(self.stream_default)
self.device.uninstall(self.stream_optional)

View File

@@ -112,7 +112,7 @@ class Sysbench(Workload):
def update_result(self, context):
host_results_file = os.path.join(context.output_directory, 'sysbench_result.txt')
self.device.pull_file(self.results_file, host_results_file)
self.device.pull(self.results_file, host_results_file)
context.add_iteration_artifact('sysbench_output', kind='raw', path=host_results_file)
with open(host_results_file) as fh:
@@ -129,10 +129,10 @@ class Sysbench(Workload):
extract_threads_fairness_metric('execution time', fh.next(), context.result)
def teardown(self, context):
self.device.delete_file(self.results_file)
self.device.remove(self.results_file)
def _check_executable(self):
self.on_device_binary = self.device.get_binary_path("sysbench")
self.on_device_binary = self.device.get_installed("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.')
if self.force_install:

View File

@@ -189,12 +189,12 @@ class Telemetry(Workload):
if self.target_config:
device_opts = self.target_config
else:
if self.device.platform == 'chromeos':
if self.device.os == 'chromeos':
if '--remote' not in self.run_benchmark_params:
device_opts += '--remote={} '.format(self.device.host)
if '--browser' not in self.run_benchmark_params:
device_opts += '--browser=cros-chrome '
elif self.device.platform == 'android':
elif self.device.os == 'android':
if '--device' not in self.run_benchmark_params and self.device.adb_name:
device_opts += '--device={} '.format(self.device.adb_name)
if '--browser' not in self.run_benchmark_params:

View File

@@ -108,7 +108,7 @@ class VideoWorkload(Workload):
on_device_video_file = os.path.join(self.device.working_directory, os.path.basename(self.host_video_file))
if self.force_dependency_push or not self.device.file_exists(on_device_video_file):
self.logger.debug('Copying {} to device.'.format(self.host_video_file))
self.device.push_file(self.host_video_file, on_device_video_file, timeout=120)
self.device.push(self.host_video_file, on_device_video_file, timeout=120)
self.device.execute('am start -n com.android.browser/.BrowserActivity about:blank')
time.sleep(5)
self.device.execute('am force-stop com.android.browser')