mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-09-02 11:22:41 +01:00
wa/workloads: pep8 fixes
This commit is contained in:
@@ -69,6 +69,7 @@ class AdobeReader(ApkUiautoWorkload):
|
|||||||
self.asset_directory = self.target.path.join(self.target.external_storage,
|
self.asset_directory = self.target.path.join(self.target.external_storage,
|
||||||
'Android', 'data',
|
'Android', 'data',
|
||||||
'com.adobe.reader', 'files')
|
'com.adobe.reader', 'files')
|
||||||
|
|
||||||
def init_resources(self, context):
|
def init_resources(self, context):
|
||||||
super(AdobeReader, self).init_resources(context)
|
super(AdobeReader, self).init_resources(context)
|
||||||
# Only accept certain file formats
|
# Only accept certain file formats
|
||||||
|
@@ -17,6 +17,7 @@ import re
|
|||||||
from wa import ApkUiautoWorkload
|
from wa import ApkUiautoWorkload
|
||||||
from wa.framework.exception import WorkloadError
|
from wa.framework.exception import WorkloadError
|
||||||
|
|
||||||
|
|
||||||
class Androbench(ApkUiautoWorkload):
|
class Androbench(ApkUiautoWorkload):
|
||||||
|
|
||||||
name = 'androbench'
|
name = 'androbench'
|
||||||
@@ -52,5 +53,5 @@ class Androbench(ApkUiautoWorkload):
|
|||||||
context.add_metric(entry, result, 'MB/s', lower_is_better=False)
|
context.add_metric(entry, result, 'MB/s', lower_is_better=False)
|
||||||
expected_results -= 1
|
expected_results -= 1
|
||||||
if expected_results > 0:
|
if expected_results > 0:
|
||||||
raise WorkloadError("The Androbench workload has failed. Expected {} scores, Detected {} scores."
|
msg = "The Androbench workload has failed. Expected {} scores, Detected {} scores."
|
||||||
.format(len(self.regex_matches), expected_results))
|
raise WorkloadError(msg.format(len(self.regex_matches), expected_results))
|
||||||
|
@@ -16,6 +16,7 @@ import re
|
|||||||
|
|
||||||
from wa import ApkUiautoWorkload, WorkloadError
|
from wa import ApkUiautoWorkload, WorkloadError
|
||||||
|
|
||||||
|
|
||||||
class Antutu(ApkUiautoWorkload):
|
class Antutu(ApkUiautoWorkload):
|
||||||
|
|
||||||
name = 'antutu'
|
name = 'antutu'
|
||||||
|
@@ -89,7 +89,6 @@ class ApacheBenchmark(Workload):
|
|||||||
self.path)
|
self.path)
|
||||||
self.output = None
|
self.output = None
|
||||||
|
|
||||||
|
|
||||||
def run(self, context):
|
def run(self, context):
|
||||||
self.logger.debug(self.command)
|
self.logger.debug(self.command)
|
||||||
self.output, _ = check_output(self.command, timeout=300, shell=True)
|
self.output, _ = check_output(self.command, timeout=300, shell=True)
|
||||||
|
@@ -18,7 +18,6 @@ from wa import ApkUiautoWorkload, Parameter
|
|||||||
from wa.framework import pluginloader
|
from wa.framework import pluginloader
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Applaunch(ApkUiautoWorkload):
|
class Applaunch(ApkUiautoWorkload):
|
||||||
|
|
||||||
name = 'applaunch'
|
name = 'applaunch'
|
||||||
|
@@ -34,9 +34,9 @@ from devlib.utils.android import grant_app_permissions
|
|||||||
|
|
||||||
# Regexps for benchmark synchronization
|
# Regexps for benchmark synchronization
|
||||||
REGEXPS = {
|
REGEXPS = {
|
||||||
'start' : '.*Displayed com.google.android.exoplayer2.demo/.PlayerActivity',
|
'start': '.*Displayed com.google.android.exoplayer2.demo/.PlayerActivity',
|
||||||
'duration' : '.*period \[(?P<duration>[0-9]+.*)\]',
|
'duration': '.*period \[(?P<duration>[0-9]+.*)\]',
|
||||||
'end' : '.*state \[.+, .+, E\]',
|
'end': '.*state \[.+, .+, E\]',
|
||||||
'dropped_frames': '.*droppedFrames \[(?P<session_time>[0-9]+\.[0-9]+), (?P<count>[0-9]+)\]'
|
'dropped_frames': '.*droppedFrames \[(?P<session_time>[0-9]+\.[0-9]+), (?P<count>[0-9]+)\]'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ class ExoPlayer(ApkWorkload):
|
|||||||
else:
|
else:
|
||||||
self.logger.info('Waiting for playback completion ({} seconds)'
|
self.logger.info('Waiting for playback completion ({} seconds)'
|
||||||
.format(media_duration_s))
|
.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):
|
def update_output(self, context):
|
||||||
regex = re.compile(REGEXPS['dropped_frames'])
|
regex = re.compile(REGEXPS['dropped_frames'])
|
||||||
|
@@ -24,6 +24,7 @@ from wa import ApkUiautoWorkload, Parameter
|
|||||||
from wa.framework.exception import ConfigError, WorkloadError
|
from wa.framework.exception import ConfigError, WorkloadError
|
||||||
from wa.utils.misc import capitalize
|
from wa.utils.misc import capitalize
|
||||||
|
|
||||||
|
|
||||||
class Geekbench(ApkUiautoWorkload):
|
class Geekbench(ApkUiautoWorkload):
|
||||||
|
|
||||||
name = 'geekbench'
|
name = 'geekbench'
|
||||||
@@ -196,6 +197,7 @@ class Geekbench(ApkUiautoWorkload):
|
|||||||
|
|
||||||
update_result_5 = update_result_4
|
update_result_5 = update_result_4
|
||||||
|
|
||||||
|
|
||||||
class GBWorkload(object):
|
class GBWorkload(object):
|
||||||
"""
|
"""
|
||||||
Geekbench workload (not to be confused with WA's workloads). This is a single test run by
|
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)
|
override=True)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def namemify(basename, i):
|
def namemify(basename, i):
|
||||||
return basename + (' {}'.format(i) if i else '')
|
return basename + (' {}'.format(i) if i else '')
|
||||||
|
|
||||||
|
@@ -83,7 +83,7 @@ class Googlephotos(ApkUiautoWorkload):
|
|||||||
|
|
||||||
for i, f in enumerate(self.test_images):
|
for i, f in enumerate(self.test_images):
|
||||||
orig_file_path = self.target.path.join(d, f)
|
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)
|
new_file_path = self.target.path.join(new_dir, f)
|
||||||
|
|
||||||
self.target.execute('mkdir -p {}'.format(new_dir))
|
self.target.execute('mkdir -p {}'.format(new_dir))
|
||||||
|
@@ -60,7 +60,6 @@ class HWUITest(Workload):
|
|||||||
super(HWUITest, self).__init__(target, *args, **kwargs)
|
super(HWUITest, self).__init__(target, *args, **kwargs)
|
||||||
HWUITest.target_exe = None
|
HWUITest.target_exe = None
|
||||||
|
|
||||||
|
|
||||||
@once
|
@once
|
||||||
def initialize(self, context):
|
def initialize(self, context):
|
||||||
host_exe = context.get_resource(Executable(self,
|
host_exe = context.get_resource(Executable(self,
|
||||||
|
@@ -118,7 +118,7 @@ class Jankbench(ApkWorkload):
|
|||||||
if self.pull_results_db:
|
if self.pull_results_db:
|
||||||
target_file = self.target.path.join(self.target.package_data_directory,
|
target_file = self.target.path.join(self.target.package_data_directory,
|
||||||
self.package, 'databases', self.results_db_file)
|
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)
|
self.target.pull(target_file, host_file, as_root=True)
|
||||||
context.add_artifact('jankbench-results', host_file, 'data')
|
context.add_artifact('jankbench-results', host_file, 'data')
|
||||||
|
|
||||||
|
@@ -125,8 +125,8 @@ class Meabo(Workload):
|
|||||||
description='''
|
description='''
|
||||||
Sets which cores each phase is run on.
|
Sets which cores each phase is run on.
|
||||||
''',
|
''',
|
||||||
constraint=lambda x: all(v>=-1 for v in x),
|
constraint=lambda x: all(v >= -1 for v in x),
|
||||||
default=[-1]*10,
|
default=[-1] * 10,
|
||||||
),
|
),
|
||||||
Parameter(
|
Parameter(
|
||||||
'num_hwcntrs',
|
'num_hwcntrs',
|
||||||
@@ -144,7 +144,7 @@ class Meabo(Workload):
|
|||||||
description='''
|
description='''
|
||||||
Controls which phases to run.
|
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)),
|
default=list(range(1, 11)),
|
||||||
),
|
),
|
||||||
Parameter(
|
Parameter(
|
||||||
@@ -290,7 +290,7 @@ class Meabo(Workload):
|
|||||||
# We need to calculate the phase mask
|
# We need to calculate the phase mask
|
||||||
phase_mask = 0
|
phase_mask = 0
|
||||||
for phase in self.run_phases:
|
for phase in self.run_phases:
|
||||||
phase_mask |= 1<<(phase-1)
|
phase_mask |= 1 << (phase - 1)
|
||||||
|
|
||||||
self.command += ' -P {:d}'.format(phase_mask)
|
self.command += ' -P {:d}'.format(phase_mask)
|
||||||
|
|
||||||
|
@@ -61,6 +61,7 @@ class Memcpy(Workload):
|
|||||||
cores will be used.
|
cores will be used.
|
||||||
'''),
|
'''),
|
||||||
]
|
]
|
||||||
|
|
||||||
@once
|
@once
|
||||||
def initialize(self, context):
|
def initialize(self, context):
|
||||||
self.binary_name = 'memcpy'
|
self.binary_name = 'memcpy'
|
||||||
|
@@ -47,7 +47,7 @@ class Openssl(Workload):
|
|||||||
|
|
||||||
parameters = [
|
parameters = [
|
||||||
Parameter('algorithm', default='aes-256-cbc',
|
Parameter('algorithm', default='aes-256-cbc',
|
||||||
allowed_values = EVP_NEW + CIPHER_PKI,
|
allowed_values=EVP_NEW + CIPHER_PKI,
|
||||||
description='''
|
description='''
|
||||||
Algorithm to benchmark.
|
Algorithm to benchmark.
|
||||||
'''),
|
'''),
|
||||||
|
@@ -19,6 +19,7 @@ import zipfile
|
|||||||
from wa import ApkUiautoWorkload
|
from wa import ApkUiautoWorkload
|
||||||
from wa.framework.exception import WorkloadError
|
from wa.framework.exception import WorkloadError
|
||||||
|
|
||||||
|
|
||||||
class PcMark(ApkUiautoWorkload):
|
class PcMark(ApkUiautoWorkload):
|
||||||
|
|
||||||
name = 'pcmark'
|
name = 'pcmark'
|
||||||
|
@@ -24,7 +24,7 @@ from wa.utils.misc import unique
|
|||||||
class Speedometer(UiautoWorkload):
|
class Speedometer(UiautoWorkload):
|
||||||
|
|
||||||
name = 'speedometer'
|
name = 'speedometer'
|
||||||
regex=re.compile(r'Speedometer Score ([\d.]+)')
|
regex = re.compile(r'Speedometer Score ([\d.]+)')
|
||||||
versions = ['1.0', '2.0']
|
versions = ['1.0', '2.0']
|
||||||
description = '''
|
description = '''
|
||||||
A workload to execute the speedometer web based benchmark
|
A workload to execute the speedometer web based benchmark
|
||||||
|
@@ -65,7 +65,6 @@ class Vellamo(ApkUiautoWorkload):
|
|||||||
'listed, ``2`` -- the second, etc. Only valid for version ``3.0``.'))
|
'listed, ``2`` -- the second, etc. Only valid for version ``3.0``.'))
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def setup(self, context):
|
def setup(self, context):
|
||||||
self.gui.uiauto_params['version'] = self.version
|
self.gui.uiauto_params['version'] = self.version
|
||||||
self.gui.uiauto_params['browserToUse'] = self.browser
|
self.gui.uiauto_params['browserToUse'] = self.browser
|
||||||
|
Reference in New Issue
Block a user