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

wa/workloads: pep8 fixes

This commit is contained in:
Marc Bonnici
2018-07-03 13:23:16 +01:00
parent 185bff9029
commit 6e94cbd36b
18 changed files with 57 additions and 53 deletions

View File

@@ -69,6 +69,7 @@ class AdobeReader(ApkUiautoWorkload):
self.asset_directory = self.target.path.join(self.target.external_storage,
'Android', 'data',
'com.adobe.reader', 'files')
def init_resources(self, context):
super(AdobeReader, self).init_resources(context)
# Only accept certain file formats

View File

@@ -17,6 +17,7 @@ import re
from wa import ApkUiautoWorkload
from wa.framework.exception import WorkloadError
class Androbench(ApkUiautoWorkload):
name = 'androbench'
@@ -52,5 +53,5 @@ class Androbench(ApkUiautoWorkload):
context.add_metric(entry, result, 'MB/s', lower_is_better=False)
expected_results -= 1
if expected_results > 0:
raise WorkloadError("The Androbench workload has failed. Expected {} scores, Detected {} scores."
.format(len(self.regex_matches), expected_results))
msg = "The Androbench workload has failed. Expected {} scores, Detected {} scores."
raise WorkloadError(msg.format(len(self.regex_matches), expected_results))

View File

@@ -16,6 +16,7 @@ import re
from wa import ApkUiautoWorkload, WorkloadError
class Antutu(ApkUiautoWorkload):
name = 'antutu'

View File

@@ -89,7 +89,6 @@ class ApacheBenchmark(Workload):
self.path)
self.output = None
def run(self, context):
self.logger.debug(self.command)
self.output, _ = check_output(self.command, timeout=300, shell=True)

View File

@@ -18,7 +18,6 @@ from wa import ApkUiautoWorkload, Parameter
from wa.framework import pluginloader
class Applaunch(ApkUiautoWorkload):
name = 'applaunch'

View File

@@ -34,9 +34,9 @@ from devlib.utils.android import grant_app_permissions
# Regexps for benchmark synchronization
REGEXPS = {
'start' : '.*Displayed com.google.android.exoplayer2.demo/.PlayerActivity',
'duration' : '.*period \[(?P<duration>[0-9]+.*)\]',
'end' : '.*state \[.+, .+, E\]',
'start': '.*Displayed com.google.android.exoplayer2.demo/.PlayerActivity',
'duration': '.*period \[(?P<duration>[0-9]+.*)\]',
'end': '.*state \[.+, .+, E\]',
'dropped_frames': '.*droppedFrames \[(?P<session_time>[0-9]+\.[0-9]+), (?P<count>[0-9]+)\]'
}
@@ -205,7 +205,7 @@ class ExoPlayer(ApkWorkload):
else:
self.logger.info('Waiting for playback completion ({} seconds)'
.format(media_duration_s))
self.monitor.wait_for(REGEXPS['end'], timeout = media_duration_s + 30)
self.monitor.wait_for(REGEXPS['end'], timeout=media_duration_s + 30)
def update_output(self, context):
regex = re.compile(REGEXPS['dropped_frames'])

View File

@@ -24,6 +24,7 @@ from wa import ApkUiautoWorkload, Parameter
from wa.framework.exception import ConfigError, WorkloadError
from wa.utils.misc import capitalize
class Geekbench(ApkUiautoWorkload):
name = 'geekbench'
@@ -196,6 +197,7 @@ class Geekbench(ApkUiautoWorkload):
update_result_5 = update_result_4
class GBWorkload(object):
"""
Geekbench workload (not to be confused with WA's workloads). This is a single test run by
@@ -403,6 +405,7 @@ class GeekbenchCorproate(Geekbench):
override=True)
]
def namemify(basename, i):
return basename + (' {}'.format(i) if i else '')

View File

@@ -83,7 +83,7 @@ class Googlephotos(ApkUiautoWorkload):
for i, f in enumerate(self.test_images):
orig_file_path = self.target.path.join(d, f)
new_dir = self.target.path.join(e, 'wa', 'wa-{}'.format(i+1))
new_dir = self.target.path.join(e, 'wa', 'wa-{}'.format(i + 1))
new_file_path = self.target.path.join(new_dir, f)
self.target.execute('mkdir -p {}'.format(new_dir))

View File

@@ -60,7 +60,6 @@ class HWUITest(Workload):
super(HWUITest, self).__init__(target, *args, **kwargs)
HWUITest.target_exe = None
@once
def initialize(self, context):
host_exe = context.get_resource(Executable(self,

View File

@@ -118,7 +118,7 @@ class Jankbench(ApkWorkload):
if self.pull_results_db:
target_file = self.target.path.join(self.target.package_data_directory,
self.package, 'databases', self.results_db_file)
host_file = os.path.join(context.output_directory,self.results_db_file)
host_file = os.path.join(context.output_directory, self.results_db_file)
self.target.pull(target_file, host_file, as_root=True)
context.add_artifact('jankbench-results', host_file, 'data')

View File

@@ -125,8 +125,8 @@ class Meabo(Workload):
description='''
Sets which cores each phase is run on.
''',
constraint=lambda x: all(v>=-1 for v in x),
default=[-1]*10,
constraint=lambda x: all(v >= -1 for v in x),
default=[-1] * 10,
),
Parameter(
'num_hwcntrs',
@@ -144,7 +144,7 @@ class Meabo(Workload):
description='''
Controls which phases to run.
''',
constraint=lambda x: all(0 < v <=10 for v in x),
constraint=lambda x: all(0 < v <= 10 for v in x),
default=list(range(1, 11)),
),
Parameter(
@@ -290,7 +290,7 @@ class Meabo(Workload):
# We need to calculate the phase mask
phase_mask = 0
for phase in self.run_phases:
phase_mask |= 1<<(phase-1)
phase_mask |= 1 << (phase - 1)
self.command += ' -P {:d}'.format(phase_mask)

View File

@@ -61,6 +61,7 @@ class Memcpy(Workload):
cores will be used.
'''),
]
@once
def initialize(self, context):
self.binary_name = 'memcpy'

View File

@@ -47,7 +47,7 @@ class Openssl(Workload):
parameters = [
Parameter('algorithm', default='aes-256-cbc',
allowed_values = EVP_NEW + CIPHER_PKI,
allowed_values=EVP_NEW + CIPHER_PKI,
description='''
Algorithm to benchmark.
'''),

View File

@@ -19,6 +19,7 @@ import zipfile
from wa import ApkUiautoWorkload
from wa.framework.exception import WorkloadError
class PcMark(ApkUiautoWorkload):
name = 'pcmark'

View File

@@ -24,7 +24,7 @@ from wa.utils.misc import unique
class Speedometer(UiautoWorkload):
name = 'speedometer'
regex=re.compile(r'Speedometer Score ([\d.]+)')
regex = re.compile(r'Speedometer Score ([\d.]+)')
versions = ['1.0', '2.0']
description = '''
A workload to execute the speedometer web based benchmark

View File

@@ -65,7 +65,6 @@ class Vellamo(ApkUiautoWorkload):
'listed, ``2`` -- the second, etc. Only valid for version ``3.0``.'))
]
def setup(self, context):
self.gui.uiauto_params['version'] = self.version
self.gui.uiauto_params['browserToUse'] = self.browser