1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-07 13:41:24 +00:00

Fixed WA extensions for AndroidManager

Changed method calls to devlib naming
This commit is contained in:
Sebastian Goscik 2016-02-16 16:16:41 +00:00
parent a3962b6323
commit 0b1b9d304c
6 changed files with 13 additions and 18 deletions

View File

@ -188,7 +188,7 @@ class ApkWorkload(Workload):
self.device.clear_logcat() self.device.clear_logcat()
def initialize_package(self, context): def initialize_package(self, context):
installed_version = self.device.get_installed_package_version(self.package) installed_version = self.device.get_package_version(self.package)
if self.check_apk: if self.check_apk:
self.initialize_with_host_apk(context, installed_version) self.initialize_with_host_apk(context, installed_version)
else: else:
@ -238,7 +238,7 @@ class ApkWorkload(Workload):
# As of android API level 23, apps can request permissions at runtime, # As of android API level 23, apps can request permissions at runtime,
# this will grant all of them so requests do not pop up when running the app # this will grant all of them so requests do not pop up when running the app
if self.device.get_sdk_version() >= 23: if self.device.os_version['sdk'] >= 23:
self._grant_requested_permissions() self._grant_requested_permissions()
def install_apk(self, context): def install_apk(self, context):
@ -281,7 +281,7 @@ class ApkWorkload(Workload):
def update_result(self, context): def update_result(self, context):
self.logcat_log = os.path.join(context.output_directory, 'logcat.log') self.logcat_log = os.path.join(context.output_directory, 'logcat.log')
self.device.dump_logcat(self.logcat_log) context.device_manager.dump_logcat(self.logcat_log)
context.add_iteration_artifact(name='logcat', context.add_iteration_artifact(name='logcat',
path='logcat.log', path='logcat.log',
kind='log', kind='log',
@ -488,7 +488,7 @@ class GameWorkload(ApkWorkload, ReventWorkload):
# exist. # exist.
self.device.push(asset_tarball, ondevice_cache, timeout=timeout) self.device.push(asset_tarball, ondevice_cache, timeout=timeout)
device_asset_directory = self.device.path.join(self.device.external_storage_directory, 'Android', kind) device_asset_directory = self.device.path.join(self.context.device_manager.external_storage_directory, 'Android', kind)
deploy_command = 'cd {} && {} tar -xzf {}'.format(device_asset_directory, deploy_command = 'cd {} && {} tar -xzf {}'.format(device_asset_directory,
self.device.busybox, self.device.busybox,
ondevice_cache) ondevice_cache)

View File

@ -123,7 +123,7 @@ class BBench(Workload):
self.device.write_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 #On android 6+ the web browser requires permissions to access the sd card
if self.device.get_sdk_version() >= 23: if self.device.os_version["sdk"]() >= 23:
self.device.execute("pm grant com.android.browser android.permission.READ_EXTERNAL_STORAGE") self.device.execute("pm grant com.android.browser android.permission.READ_EXTERNAL_STORAGE")
self.device.execute("pm grant com.android.browser android.permission.WRITE_EXTERNAL_STORAGE") self.device.execute("pm grant com.android.browser android.permission.WRITE_EXTERNAL_STORAGE")

View File

@ -88,7 +88,7 @@ class Dex2oatBenchmark(Workload):
""" """
logcat_log = os.path.join(context.output_directory, 'logcat.log') logcat_log = os.path.join(context.output_directory, 'logcat.log')
self.device.dump_logcat(logcat_log) context.device_manager.dump_logcat(logcat_log)
regex_time = re.compile("^I\/dex2oat \( *[0-9]+\): dex2oat took (?P<time>[0-9]+\.?[0-9]*)(?P<unit>m?s)") regex_time = re.compile("^I\/dex2oat \( *[0-9]+\): dex2oat took (?P<time>[0-9]+\.?[0-9]*)(?P<unit>m?s)")
regex_comp_time = re.compile("^I\/dex2oat \( *[0-9]+\): +(?P<time>[0-9]*\.?[0-9]*)(?P<unit>m?s) Compile Dex File") regex_comp_time = re.compile("^I\/dex2oat \( *[0-9]+\): +(?P<time>[0-9]*\.?[0-9]*)(?P<unit>m?s) Compile Dex File")

View File

@ -121,12 +121,13 @@ class Geekbench(AndroidUiAutoBenchmark):
score_calculator.update_results(context) score_calculator.update_results(context)
def update_result_3(self, context): def update_result_3(self, context):
outfile_glob = self.device.path.join(self.device.package_data_directory, self.package, 'files', '*gb3') outfile_glob = self.device.path.join(context.device_manager.package_data_directory, self.package, 'files', '*gb3')
on_device_output_files = [f.strip() for f in on_device_output_files = [f.strip() for f in
self.device.execute('ls {}'.format(outfile_glob), as_root=True).split('\n')] self.device.execute('ls {}'.format(outfile_glob), as_root=True).split('\n')
if f.strip()]
for i, on_device_output_file in enumerate(on_device_output_files): for i, on_device_output_file in enumerate(on_device_output_files):
host_temp_file = tempfile.mktemp() host_temp_file = tempfile.mktemp()
self.device.pull_file(on_device_output_file, host_temp_file) self.device.pull(on_device_output_file, host_temp_file)
host_output_file = os.path.join(context.output_directory, os.path.basename(on_device_output_file)) host_output_file = os.path.join(context.output_directory, os.path.basename(on_device_output_file))
with open(host_temp_file) as fh: with open(host_temp_file) as fh:
data = json.load(fh) data = json.load(fh)

View File

@ -86,7 +86,7 @@ class ManualWorkload(Workload):
def update_result(self, context): def update_result(self, context):
if self.enable_logcat: if self.enable_logcat:
logcat_dir = os.path.join(context.output_directory, 'logcat') logcat_dir = os.path.join(context.output_directory, 'logcat')
self.device.dump_logcat(logcat_dir) context.device_manager.dump_logcat(logcat_dir)
def teardown(self, context): def teardown(self, context):
pass pass
@ -102,8 +102,3 @@ class ManualWorkload(Workload):
raise ConfigError(message) raise ConfigError(message)
if not self.user_triggered and not self.duration: if not self.user_triggered and not self.duration:
raise ConfigError('Either user_triggered must be ``True`` or duration must be > 0.') raise ConfigError('Either user_triggered must be ``True`` or duration must be > 0.')
if self.enable_logcat is None:
self.enable_logcat = self.device.platform == "android"
elif self.enable_logcat and self.device.platform != "android":
raise ConfigError("The `enable_logcat` parameter can only be used on Android devices")

View File

@ -101,7 +101,7 @@ class Vellamo(AndroidUiAutoBenchmark):
for test in self.benchmarks: # Get all scores from HTML files for test in self.benchmarks: # Get all scores from HTML files
filename = None filename = None
if test == "Browser": if test == "Browser":
result_folder = self.device.path.join(self.device.package_data_directory, self.package, 'files') result_folder = self.device.path.join(context.device_manager.package_data_directory, self.package, 'files')
for result_file in self.device.listdir(result_folder, as_root=True): for result_file in self.device.listdir(result_folder, as_root=True):
if result_file.startswith("Browser"): if result_file.startswith("Browser"):
filename = result_file filename = result_file
@ -110,7 +110,7 @@ class Vellamo(AndroidUiAutoBenchmark):
device_file = self.device.path.join(self.device.package_data_directory, self.package, 'files', filename) device_file = self.device.path.join(self.device.package_data_directory, self.package, 'files', filename)
host_file = os.path.join(context.output_directory, filename) host_file = os.path.join(context.output_directory, filename)
self.device.pull_file(device_file, host_file, as_root=True) self.device.pull(device_file, host_file, as_root=True)
with open(host_file) as fh: with open(host_file) as fh:
parser = VellamoResultParser() parser = VellamoResultParser()
parser.feed(fh.read()) parser.feed(fh.read())
@ -212,4 +212,3 @@ class VellamoResultParser(HTMLParser):
self.benchmarks[-1].add_metric(data) self.benchmarks[-1].add_metric(data)
else: else:
self.failed = True self.failed = True