aboutsummaryrefslogtreecommitdiff
path: root/wa/framework
diff options
context:
space:
mode:
authorSergei Trofimov <sergei.trofimov@arm.com>2018-07-05 14:02:05 +0100
committerMarc Bonnici <marc.bonnici@arm.com>2018-07-06 14:39:41 +0100
commit03eafe6b33269fb7a1712a5a1abc9a2798a281fe (patch)
tree1c448107a66e6e9ec77fb15b81441626a38be0c0 /wa/framework
parent88c5005b382dd3e4ad101056a097088c1b665cf8 (diff)
framework: pep8 fixes
Fix issues reported by flake8.
Diffstat (limited to 'wa/framework')
-rw-r--r--wa/framework/configuration/core.py6
-rw-r--r--wa/framework/configuration/default.py14
-rw-r--r--wa/framework/configuration/parsers.py7
-rw-r--r--wa/framework/configuration/plugin_cache.py13
-rw-r--r--wa/framework/execution.py14
-rw-r--r--wa/framework/getters.py2
-rw-r--r--wa/framework/host.py41
-rw-r--r--wa/framework/job.py5
-rw-r--r--wa/framework/output.py12
-rw-r--r--wa/framework/output_processor.py2
-rw-r--r--wa/framework/plugin.py4
-rw-r--r--wa/framework/resource.py10
-rw-r--r--wa/framework/run.py9
-rw-r--r--wa/framework/signal.py5
-rw-r--r--wa/framework/target/config.py1
-rw-r--r--wa/framework/target/descriptor.py211
-rw-r--r--wa/framework/target/info.py2
-rw-r--r--wa/framework/target/manager.py1
-rw-r--r--wa/framework/target/runtime_config.py451
-rw-r--r--wa/framework/workload.py14
20 files changed, 435 insertions, 389 deletions
diff --git a/wa/framework/configuration/core.py b/wa/framework/configuration/core.py
index be409ecf..05a7f3db 100644
--- a/wa/framework/configuration/core.py
+++ b/wa/framework/configuration/core.py
@@ -144,12 +144,14 @@ class LoggingConfig(dict):
def to_pod(self):
return self
+
def expanded_path(path):
"""
Ensure that the provided path has been expanded if applicable
"""
return os.path.expanduser(str(path))
+
def get_type_name(kind):
typename = str(kind)
if '\'' in typename:
@@ -377,12 +379,11 @@ class Configuration(object):
name))
try:
self.configuration[name].set_value(self, value,
- check_mandatory=check_mandatory)
+ check_mandatory=check_mandatory)
except (TypeError, ValueError, ConfigError) as e:
msg = 'Invalid value "{}" for "{}": {}'
raise ConfigError(msg.format(value, name, e))
-
def update_config(self, values, check_mandatory=True):
for k, v in values.items():
self.set(k, v, check_mandatory=check_mandatory)
@@ -899,7 +900,6 @@ class JobSpec(Configuration):
self.label = self.workload_name
-
# This is used to construct the list of Jobs WA will run
class JobGenerator(object):
diff --git a/wa/framework/configuration/default.py b/wa/framework/configuration/default.py
index 5d70ad06..94f36f22 100644
--- a/wa/framework/configuration/default.py
+++ b/wa/framework/configuration/default.py
@@ -18,12 +18,14 @@ from wa.framework.configuration.plugin_cache import PluginCache
from wa.utils.serializer import yaml
from wa.utils.doc import strip_inlined_text
-DEFAULT_AUGMENTATIONS = ['execution_time',
- 'interrupts',
- 'cpufreq',
- 'status',
- 'csv'
- ]
+
+DEFAULT_AUGMENTATIONS = [
+ 'execution_time',
+ 'interrupts',
+ 'cpufreq',
+ 'status',
+ 'csv',
+]
def _format_yaml_comment(param, short_description=False):
diff --git a/wa/framework/configuration/parsers.py b/wa/framework/configuration/parsers.py
index 0f17d728..942092f4 100644
--- a/wa/framework/configuration/parsers.py
+++ b/wa/framework/configuration/parsers.py
@@ -84,7 +84,6 @@ class ConfigParser(object):
log.dedent()
-
class AgendaParser(object):
def load_from_path(self, state, filepath):
@@ -244,7 +243,7 @@ def merge_augmentations(raw):
"""
cfg_point = JobSpec.configuration['augmentations']
- names = [cfg_point.name,] + cfg_point.aliases
+ names = [cfg_point.name, ] + cfg_point.aliases
entries = []
for n in names:
@@ -253,9 +252,9 @@ def merge_augmentations(raw):
value = raw.pop(n)
try:
entries.append(toggle_set(value))
- except TypeError as e:
+ except TypeError as exc:
msg = 'Invalid value "{}" for "{}": {}'
- raise ConfigError(msg.format(value, n, e))
+ raise ConfigError(msg.format(value, n, exc))
# Make sure none of the specified aliases conflict with each other
to_check = [e for e in entries]
diff --git a/wa/framework/configuration/plugin_cache.py b/wa/framework/configuration/plugin_cache.py
index d4f6734e..188d226a 100644
--- a/wa/framework/configuration/plugin_cache.py
+++ b/wa/framework/configuration/plugin_cache.py
@@ -81,7 +81,7 @@ class PluginCache(object):
if caseless_string(plugin_name) in ['global', 'config']:
msg = '"{}" entry specified inside config/global section; If this is ' \
- 'defined in a config file, move the entry content into the top level'
+ 'defined in a config file, move the entry content into the top level'
raise ConfigError(msg.format((plugin_name)))
if (not self.loader.has_plugin(plugin_name) and
@@ -270,7 +270,6 @@ class PluginCache(object):
raise AttributeError(name)
-
class MergeState(object):
def __init__(self):
@@ -289,13 +288,13 @@ def update_config_from_source(final_config, source, state):
if name in state.generic_config[source]:
if name in state.seen_specific_config:
msg = ('"{generic_name}" configuration "{config_name}" has '
- 'already been specified more specifically for '
- '{specific_name} in:\n\t\t{sources}')
+ 'already been specified more specifically for '
+ '{specific_name} in:\n\t\t{sources}')
seen_sources = state.seen_specific_config[name]
msg = msg.format(generic_name=state.generic_name,
- config_name=name,
- specific_name=state.specific_name,
- sources=", ".join(seen_sources))
+ config_name=name,
+ specific_name=state.specific_name,
+ sources=", ".join(seen_sources))
raise ConfigError(msg)
value = state.generic_config[source].pop(name)
cfg_point.set_value(final_config, value, check_mandatory=False)
diff --git a/wa/framework/execution.py b/wa/framework/execution.py
index 6cac8e5d..9e1d99fb 100644
--- a/wa/framework/execution.py
+++ b/wa/framework/execution.py
@@ -25,8 +25,8 @@ from datetime import datetime
import wa.framework.signal as signal
from wa.framework import instrument
from wa.framework.configuration.core import Status
-from wa.framework.exception import TargetError, HostError, WorkloadError,\
- TargetNotRespondingError, TimeoutError
+from wa.framework.exception import TargetError, HostError, WorkloadError
+from wa.framework.exception import TargetNotRespondingError, TimeoutError
from wa.framework.job import Job
from wa.framework.output import init_job_output
from wa.framework.output_processor import ProcessorManager
@@ -130,8 +130,8 @@ class ExecutionContext(object):
self.run_state.status = status
self.run_output.status = status
self.run_output.info.end_time = datetime.utcnow()
- self.run_output.info.duration = self.run_output.info.end_time -\
- self.run_output.info.start_time
+ self.run_output.info.duration = (self.run_output.info.end_time -
+ self.run_output.info.start_time)
self.write_output()
def finalize(self):
@@ -356,8 +356,8 @@ class Executor(object):
output.write_config(config)
self.target_manager = TargetManager(config.run_config.device,
- config.run_config.device_config,
- output.basepath)
+ config.run_config.device_config,
+ output.basepath)
self.logger.info('Initializing execution context')
context = ExecutionContext(config_manager, self.target_manager, output)
@@ -540,7 +540,7 @@ class Runner(object):
context.tm.start()
self.do_run_job(job, context)
job.set_status(Status.OK)
- except (Exception, KeyboardInterrupt) as e: # pylint: disable=broad-except
+ except (Exception, KeyboardInterrupt) as e: # pylint: disable=broad-except
log.log_error(e, self.logger)
if isinstance(e, KeyboardInterrupt):
context.run_interrupted = True
diff --git a/wa/framework/getters.py b/wa/framework/getters.py
index a7429613..903d79f3 100644
--- a/wa/framework/getters.py
+++ b/wa/framework/getters.py
@@ -75,7 +75,7 @@ def get_path_matches(resource, files):
for f in files:
if resource.match_path(f):
matches.append(f)
- return matches
+ return matches
def get_from_location(basepath, resource):
diff --git a/wa/framework/host.py b/wa/framework/host.py
index 807217a8..cf5cceba 100644
--- a/wa/framework/host.py
+++ b/wa/framework/host.py
@@ -86,23 +86,28 @@ def convert_wa2_agenda(filepath, output_path):
# Add additional config points to extract from config file.
# Also allows for aliasing of renamed parameters
config_points.extend([
- ConfigurationPoint('augmentations',
- aliases=["instruments", "processors", "instrumentation",
- "output_processors", "augment", "result_processors"],
- description='''The augmentations enabled by default.
- This combines the "instrumentation"
- and "result_processors" from previous
- versions of WA (the old entries are
- now aliases for this).'''),
- ConfigurationPoint('device_config',
- description='''Generic configuration for device.''',
- default={}),
- ConfigurationPoint('cleanup_assets',
- aliases=['clean_up'],
- description='''Specify whether to clean up assets
- deployed to the target''',
- default=True),
- ])
+ ConfigurationPoint(
+ 'augmentations',
+ aliases=["instruments", "processors", "instrumentation",
+ "output_processors", "augment", "result_processors"],
+ description='''
+ The augmentations enabled by default.
+ This combines the "instrumentation"
+ and "result_processors" from previous
+ versions of WA (the old entries are
+ now aliases for this).
+ '''),
+ ConfigurationPoint(
+ 'device_config',
+ description='''Generic configuration for device.''',
+ default={}),
+ ConfigurationPoint(
+ 'cleanup_assets',
+ aliases=['clean_up'],
+ description='''Specify whether to clean up assets
+ deployed to the target''',
+ default=True),
+ ])
for param in list(orig_agenda.keys()):
for cfg_point in config_points:
@@ -137,6 +142,6 @@ def convert_wa2_agenda(filepath, output_path):
def format_parameter(param):
if isinstance(param, dict):
- return {identifier(k) : v for k, v in param.items()}
+ return {identifier(k): v for k, v in param.items()}
else:
return param
diff --git a/wa/framework/job.py b/wa/framework/job.py
index 54724614..347b4e54 100644
--- a/wa/framework/job.py
+++ b/wa/framework/job.py
@@ -13,6 +13,9 @@
# limitations under the License.
#
+# Because of use of Enum (dynamic attrs)
+# pylint: disable=no-member
+
import logging
from copy import copy
from datetime import datetime
@@ -21,8 +24,6 @@ from wa.framework import pluginloader, signal, instrument
from wa.framework.configuration.core import Status
from wa.utils.log import indentcontext
-# Because of use of Enum (dynamic attrs)
-# pylint: disable=no-member
class Job(object):
diff --git a/wa/framework/output.py b/wa/framework/output.py
index 6cdec2c0..148e1497 100644
--- a/wa/framework/output.py
+++ b/wa/framework/output.py
@@ -119,7 +119,6 @@ class Output(object):
self.result.status = Status.UNKNOWN
self.add_event(str(e))
-
def write_result(self):
write_pod(self.result.to_pod(), self.resultfile)
@@ -167,7 +166,6 @@ class Output(object):
return os.path.basename(self.basepath)
-
class RunOutput(Output):
kind = 'run'
@@ -648,10 +646,10 @@ def init_run_output(path, wa_state, force=False):
touch(os.path.join(path, 'run.log'))
info = RunInfo(
- run_name=wa_state.run_config.run_name,
- project=wa_state.run_config.project,
- project_stage=wa_state.run_config.project_stage,
- )
+ run_name=wa_state.run_config.run_name,
+ project=wa_state.run_config.project,
+ project_stage=wa_state.run_config.project_stage,
+ )
write_pod(info.to_pod(), os.path.join(meta_dir, 'run_info.json'))
write_pod(RunState().to_pod(), os.path.join(path, '.run_state.json'))
write_pod(Result().to_pod(), os.path.join(path, 'result.json'))
@@ -678,7 +676,7 @@ def init_job_output(run_output, job):
def discover_wa_outputs(path):
for root, dirs, _ in os.walk(path):
if '__meta' in dirs:
- yield RunOutput(root)
+ yield RunOutput(root)
def _save_raw_config(meta_dir, state):
diff --git a/wa/framework/output_processor.py b/wa/framework/output_processor.py
index 0877fc26..a08046f3 100644
--- a/wa/framework/output_processor.py
+++ b/wa/framework/output_processor.py
@@ -139,7 +139,7 @@ class ProcessorManager(object):
try:
self.logger.info(message.format(proc.name))
proc_func(*args)
- except Exception as e: # pylint: disable=broad-except
+ except Exception as e: # pylint: disable=broad-except
if isinstance(e, KeyboardInterrupt):
raise
log_error(e, self.logger)
diff --git a/wa/framework/plugin.py b/wa/framework/plugin.py
index 27b283bc..720fb6ff 100644
--- a/wa/framework/plugin.py
+++ b/wa/framework/plugin.py
@@ -316,8 +316,8 @@ class Plugin(with_metaclass(PluginMeta, object)):
appropriate exception.
"""
- modules = list(reversed(self.core_modules)) +\
- list(reversed(self.modules or []))
+ modules = list(reversed(self.core_modules))
+ modules += list(reversed(self.modules or []))
if not modules:
return
for module_spec in modules:
diff --git a/wa/framework/resource.py b/wa/framework/resource.py
index 9630c80a..aa1e04c2 100644
--- a/wa/framework/resource.py
+++ b/wa/framework/resource.py
@@ -27,7 +27,6 @@ from wa.utils.misc import get_object_name
from wa.utils.types import enum, list_or_string, prioritylist
-
SourcePriority = enum(['package', 'remote', 'lan', 'local',
'perferred'], start=0, step=10)
@@ -172,9 +171,8 @@ class ApkFile(Resource):
abi_matches = apk_abi_matches(path, self.supported_abi,
self.exact_abi)
return name_matches and version_matches and \
- uiauto_matches and package_matches and \
- abi_matches
-
+ uiauto_matches and package_matches and \
+ abi_matches
def __str__(self):
text = '<{}\'s apk'.format(self.owner)
@@ -280,6 +278,7 @@ def apk_version_matches(path, version):
return True
return loose_version_matching(version, info.version_name)
+
def loose_version_matching(config_version, apk_version):
config_version = config_version.split('.')
apk_version = apk_version.split('.')
@@ -301,14 +300,17 @@ def file_name_matches(path, pattern):
return True
return False
+
def uiauto_test_matches(path, uiauto):
info = ApkInfo(path)
return uiauto == ('com.arm.wa.uiauto' in info.package)
+
def package_name_matches(path, package):
info = ApkInfo(path)
return info.package == package
+
def apk_abi_matches(path, supported_abi, exact_abi=False):
supported_abi = list_or_string(supported_abi)
info = ApkInfo(path)
diff --git a/wa/framework/run.py b/wa/framework/run.py
index 57c03d20..1acad249 100644
--- a/wa/framework/run.py
+++ b/wa/framework/run.py
@@ -12,6 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+
+# Because of use of Enum (dynamic attrs)
+# pylint: disable=no-member
+
import uuid
from collections import OrderedDict, Counter
from copy import copy
@@ -19,8 +23,6 @@ from datetime import datetime, timedelta
from wa.framework.configuration.core import Status
-# Because of use of Enum (dynamic attrs)
-# pylint: disable=no-member
class RunInfo(object):
"""
@@ -36,8 +38,7 @@ class RunInfo(object):
uid = uuid.UUID(uid)
instance = RunInfo(**pod)
instance.uuid = uid
- instance.duration = duration if duration is None else\
- timedelta(seconds=duration)
+ instance.duration = duration if duration is None else timedelta(seconds=duration)
return instance
def __init__(self, run_name=None, project=None, project_stage=None,
diff --git a/wa/framework/signal.py b/wa/framework/signal.py
index ee8f5095..1c45ab72 100644
--- a/wa/framework/signal.py
+++ b/wa/framework/signal.py
@@ -110,8 +110,7 @@ BEFORE_WORKLOAD_EXECUTION = Signal('before-workload-execution', invert_priority=
SUCCESSFUL_WORKLOAD_EXECUTION = Signal('successful-workload-execution')
AFTER_WORKLOAD_EXECUTION = Signal('after-workload-execution')
-BEFORE_WORKLOAD_RESULT_EXTRACTION = Signal('before-workload-result-extracton',
- invert_priority=True)
+BEFORE_WORKLOAD_RESULT_EXTRACTION = Signal('before-workload-result-extracton', invert_priority=True)
SUCCESSFUL_WORKLOAD_RESULT_EXTRACTION = Signal('successful-workload-result-extracton')
AFTER_WORKLOAD_RESULT_EXTRACTION = Signal('after-workload-result-extracton')
@@ -183,8 +182,6 @@ AFTER_RUN_OUTPUT_PROCESSED = Signal(
'after-run-output-processed')
-
-
CallbackPriority = enum(['extremely_low', 'very_low', 'low', 'normal',
'high', 'very_high', 'extremely_high'], -30, 10)
diff --git a/wa/framework/target/config.py b/wa/framework/target/config.py
index d8ae4fae..1e6eed0a 100644
--- a/wa/framework/target/config.py
+++ b/wa/framework/target/config.py
@@ -15,7 +15,6 @@
from copy import copy
-#Not going to be used for now.
class TargetConfig(dict):
"""
diff --git a/wa/framework/target/descriptor.py b/wa/framework/target/descriptor.py
index 45a7abcc..029969cb 100644
--- a/wa/framework/target/descriptor.py
+++ b/wa/framework/target/descriptor.py
@@ -289,117 +289,137 @@ GEM5_PLATFORM_PARAMS = [
CONNECTION_PARAMS = {
AdbConnection: [
- Parameter('device', kind=str,
- aliases=['adb_name'],
- description="""
- ADB device name
- """),
- Parameter('adb_server', kind=str,
- description="""
- ADB server to connect to.
- """),
+ Parameter(
+ 'device', kind=str,
+ aliases=['adb_name'],
+ description="""
+ ADB device name
+ """),
+ Parameter(
+ 'adb_server', kind=str,
+ description="""
+ ADB server to connect to.
+ """),
],
SshConnection: [
- Parameter('host', kind=str, mandatory=True,
- description="""
- Host name or IP address of the target.
- """),
- Parameter('username', kind=str, mandatory=True,
- description="""
- User name to connect with
- """),
- Parameter('password', kind=str,
- description="""
- Password to use.
- """),
- Parameter('keyfile', kind=str,
- description="""
- Key file to use
- """),
- Parameter('port', kind=int,
- description="""
- The port SSH server is listening on on the target.
- """),
- Parameter('telnet', kind=bool, default=False,
- description="""
- If set to ``True``, a Telnet connection, rather than
- SSH will be used.
- """),
- Parameter('password_prompt', kind=str,
- description="""
- Password prompt to expect
- """),
- Parameter('original_prompt', kind=str,
- description="""
- Original shell prompt to expect.
- """),
- Parameter('sudo_cmd', kind=str,
- default="sudo -- sh -c '{}'",
- description="""
- Sudo command to use. Must have ``"{}"`` specified
- somewhere in the string it indicate where the command
- to be run via sudo is to go.
- """),
+ Parameter(
+ 'host', kind=str, mandatory=True,
+ description="""
+ Host name or IP address of the target.
+ """),
+ Parameter(
+ 'username', kind=str, mandatory=True,
+ description="""
+ User name to connect with
+ """),
+ Parameter(
+ 'password', kind=str,
+ description="""
+ Password to use.
+ """),
+ Parameter(
+ 'keyfile', kind=str,
+ description="""
+ Key file to use
+ """),
+ Parameter(
+ 'port', kind=int,
+ description="""
+ The port SSH server is listening on on the target.
+ """),
+ Parameter(
+ 'telnet', kind=bool, default=False,
+ description="""
+ If set to ``True``, a Telnet connection, rather than
+ SSH will be used.
+ """),
+ Parameter(
+ 'password_prompt', kind=str,
+ description="""
+ Password prompt to expect
+ """),
+ Parameter(
+ 'original_prompt', kind=str,
+ description="""
+ Original shell prompt to expect.
+ """),
+ Parameter(
+ 'sudo_cmd', kind=str,
+ default="sudo -- sh -c '{}'",
+ description="""
+ Sudo command to use. Must have ``"{}"`` specified
+ somewhere in the string it indicate where the command
+ to be run via sudo is to go.
+ """),
],
Gem5Connection: [
- Parameter('host', kind=str, mandatory=False,
- description="""
- Host name or IP address of the target.
- """),
- Parameter('username', kind=str, default='root',
- description="""
- User name to connect to gem5 simulation.
- """),
- Parameter('password', kind=str,
- description="""
- Password to use.
- """),
- Parameter('port', kind=int,
- description="""
- The port SSH server is listening on on the target.
- """),
- Parameter('password_prompt', kind=str,
- description="""
- Password prompt to expect
- """),
- Parameter('original_prompt', kind=str,
- description="""
- Original shell prompt to expect.
- """),
+ Parameter(
+ 'host', kind=str, mandatory=False,
+ description="""
+ Host name or IP address of the target.
+ """),
+ Parameter(
+ 'username', kind=str, default='root',
+ description="""
+ User name to connect to gem5 simulation.
+ """),
+ Parameter(
+ 'password', kind=str,
+ description="""
+ Password to use.
+ """),
+ Parameter(
+ 'port', kind=int,
+ description="""
+ The port SSH server is listening on on the target.
+ """),
+ Parameter(
+ 'password_prompt', kind=str,
+ description="""
+ Password prompt to expect
+ """),
+ Parameter(
+ 'original_prompt', kind=str,
+ description="""
+ Original shell prompt to expect.
+ """),
],
LocalConnection: [
- Parameter('password', kind=str,
- description="""
- Password to use for sudo. if not specified, the user will
- be prompted during intialization.
- """),
- Parameter('keep_password', kind=bool, default=True,
- description="""
- If ``True`` (the default), the password will be cached in
- memory after it is first obtained from the user, so that the
- user would not be prompted for it again.
- """),
- Parameter('unrooted', kind=bool, default=False,
- description="""
- Indicate that the target should be considered unrooted; do not
- attempt sudo or ask the user for their password.
- """),
+ Parameter(
+ 'password', kind=str,
+ description="""
+ Password to use for sudo. if not specified, the user will
+ be prompted during intialization.
+ """),
+ Parameter(
+ 'keep_password', kind=bool, default=True,
+ description="""
+ If ``True`` (the default), the password will be cached in
+ memory after it is first obtained from the user, so that the
+ user would not be prompted for it again.
+ """),
+ Parameter(
+ 'unrooted', kind=bool, default=False,
+ description="""
+ Indicate that the target should be considered unrooted; do not
+ attempt sudo or ask the user for their password.
+ """),
],
}
CONNECTION_PARAMS['ChromeOsConnection'] = \
- CONNECTION_PARAMS[AdbConnection] + CONNECTION_PARAMS[SshConnection]
+ CONNECTION_PARAMS[AdbConnection] + CONNECTION_PARAMS[SshConnection]
# name --> ((target_class, conn_class), params_list, defaults)
TARGETS = {
'linux': ((LinuxTarget, SshConnection), COMMON_TARGET_PARAMS, None),
'android': ((AndroidTarget, AdbConnection), COMMON_TARGET_PARAMS +
- [Parameter('package_data_directory', kind=str, default='/data/data',
- description='''
- Directory containing Android data
- '''),
- ], None),
+ [Parameter('package_data_directory', kind=str, default='/data/data',
+ description='''
+ Directory containing Android data
+ '''),
+ ], None),
'chromeos': ((ChromeOsTarget, 'ChromeOsConnection'), COMMON_TARGET_PARAMS +
[Parameter('package_data_directory', kind=str, default='/data/data',
description='''
@@ -524,7 +544,6 @@ class DefaultTargetDescriptor(TargetDescriptor):
return cls, updated_params
-
_adhoc_target_descriptions = []
diff --git a/wa/framework/target/info.py b/wa/framework/target/info.py
index 06aa9886..689ce5b0 100644
--- a/wa/framework/target/info.py
+++ b/wa/framework/target/info.py
@@ -130,7 +130,7 @@ class CpuidleInfo(object):
def __repr__(self):
return 'Cpuidle({}/{} {} states)'.format(
- self.governor, self.driver, self.num_states)
+ self.governor, self.driver, self.num_states)
__str__ = __repr__
diff --git a/wa/framework/target/manager.py b/wa/framework/target/manager.py
index 21d7edf2..c35095e2 100644
--- a/wa/framework/target/manager.py
+++ b/wa/framework/target/manager.py
@@ -53,7 +53,6 @@ class TargetManager(object):
self.parameters = parameters
self.disconnect = parameters.get('disconnect')
-
def initialize(self):
self._init_target()
diff --git a/wa/framework/target/runtime_config.py b/wa/framework/target/runtime_config.py
index 2abcefa8..f61de33c 100644
--- a/wa/framework/target/runtime_config.py
+++ b/wa/framework/target/runtime_config.py
@@ -131,49 +131,46 @@ class HotplugRuntimeConfig(RuntimeConfig):
return
param_name = 'num_cores'
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=int,
- constraint=lambda x:
- 0 <= x <= self.target.number_of_cpus,
- description="""
- The number of cpu cores to be online
- """,
- setter=self.set_num_cores,
- setter_params={'core': None})
+ RuntimeParameter(param_name, kind=int,
+ constraint=lambda x: 0 <= x <= self.target.number_of_cpus,
+ description="""
+ The number of cpu cores to be online
+ """,
+ setter=self.set_num_cores,
+ setter_params={'core': None})
for name in unique(self.target.platform.core_names):
param_name = 'num_{}_cores'.format(name)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=int,
- constraint=lambda x, name=name:
- 0 <= x <= len(self.target.core_cpus(name)),
- description="""
- The number of {} cores to be online
- """.format(name),
- setter=self.set_num_cores,
- setter_params={'core': name})
+ RuntimeParameter(param_name, kind=int,
+ constraint=lambda x, name=name: 0 <= x <= len(self.target.core_cpus(name)),
+ description="""
+ The number of {} cores to be online
+ """.format(name),
+ setter=self.set_num_cores,
+ setter_params={'core': name})
for cpu_no in range(self.target.number_of_cpus):
param_name = 'cpu{}_online'.format(cpu_no)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=bool,
- description="""
- Specify whether cpu{} should be online
- """.format(cpu_no),
- setter=self.set_num_cores,
- setter_params={'core': cpu_no})
+ RuntimeParameter(param_name, kind=bool,
+ description="""
+ Specify whether cpu{} should be online
+ """.format(cpu_no),
+ setter=self.set_num_cores,
+ setter_params={'core': cpu_no})
if self.target.has('bl'):
for cluster in ['big', 'little']:
param_name = 'num_{}_cores'.format(cluster)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=int,
- constraint=lambda x, cluster=cluster:
- 0 <= x <= len(resolve_cpus(cluster, self.target)),
- description="""
- The number of cores on the {} cluster to be online
- """.format(cluster),
- setter=self.set_num_cores,
- setter_params={'core': cluster})
+ RuntimeParameter(param_name, kind=int,
+ constraint=lambda x, c=cluster: 0 <= x <= len(resolve_cpus(c, self.target)),
+ description="""
+ The number of cores on the {} cluster to be online
+ """.format(cluster),
+ setter=self.set_num_cores,
+ setter_params={'core': cluster})
def check_target(self):
if not self.target.has('hotplug'):
@@ -224,11 +221,11 @@ class SysfileValuesRuntimeConfig(RuntimeConfig):
def initialize(self):
self._runtime_params['sysfile_values'] = \
RuntimeParameter('sysfile_values', kind=dict, merge=True,
- setter=self.set_sysfile,
- setter_params={'core': None},
- description="""
- Sysfile path to be set
- """)
+ setter=self.set_sysfile,
+ setter_params={'core': None},
+ description="""
+ Sysfile path to be set
+ """)
def check_target(self):
return True
@@ -334,49 +331,54 @@ class CpufreqRuntimeConfig(RuntimeConfig):
freq_val = FreqValue(common_freqs)
param_name = 'frequency'
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=freq_val,
- setter=self.set_frequency,
- setter_params={'core': None},
- description="""
- The desired frequency for all cores
- """)
+ RuntimeParameter(
+ param_name, kind=freq_val,
+ setter=self.set_frequency,
+ setter_params={'core': None},
+ description="""
+ The desired frequency for all cores
+ """)
param_name = 'max_frequency'
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=freq_val,
- setter=self.set_max_frequency,
- setter_params={'core': None},
- description="""
- The maximum frequency for all cores
- """)
+ RuntimeParameter(
+ param_name, kind=freq_val,
+ setter=self.set_max_frequency,
+ setter_params={'core': None},
+ description="""
+ The maximum frequency for all cores
+ """)
param_name = 'min_frequency'
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=freq_val,
- setter=self.set_min_frequency,
- setter_params={'core': None},
- description="""
- The minimum frequency for all cores
- """)
+ RuntimeParameter(
+ param_name, kind=freq_val,
+ setter=self.set_min_frequency,
+ setter_params={'core': None},
+ description="""
+ The minimum frequency for all cores
+ """)
if common_gov:
param_name = 'governor'
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=str,
- allowed_values=common_gov,
- setter=self.set_governor,
- setter_params={'core': None},
- description="""
- The governor to be set for all cores
- """)
+ RuntimeParameter(
+ param_name, kind=str,
+ allowed_values=common_gov,
+ setter=self.set_governor,
+ setter_params={'core': None},
+ description="""
+ The governor to be set for all cores
+ """)
param_name = 'governor_tunables'
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=dict,
- merge=True,
- setter=self.set_governor_tunables,
- setter_params={'core': None},
- description="""
- The governor tunables to be set for all cores
- """)
+ RuntimeParameter(
+ param_name, kind=dict,
+ merge=True,
+ setter=self.set_governor_tunables,
+ setter_params={'core': None},
+ description="""
+ The governor tunables to be set for all cores
+ """)
# Add core name parameters
for name in unique(self.target.platform.core_names):
@@ -386,46 +388,51 @@ class CpufreqRuntimeConfig(RuntimeConfig):
param_name = '{}_frequency'.format(name)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=freq_val,
- setter=self.set_frequency,
- setter_params={'core': name},
- description="""
- The desired frequency for the {} cores
- """.format(name))
+ RuntimeParameter(
+ param_name, kind=freq_val,
+ setter=self.set_frequency,
+ setter_params={'core': name},
+ description="""
+ The desired frequency for the {} cores
+ """.format(name))
param_name = '{}_max_frequency'.format(name)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=freq_val,
- setter=self.set_max_frequency,
- setter_params={'core': name},
- description="""
- The maximum frequency for the {} cores
- """.format(name))
+ RuntimeParameter(
+ param_name, kind=freq_val,
+ setter=self.set_max_frequency,
+ setter_params={'core': name},
+ description="""
+ The maximum frequency for the {} cores
+ """.format(name))
param_name = '{}_min_frequency'.format(name)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=freq_val,
- setter=self.set_min_frequency,
- setter_params={'core': name},
- description="""
- The minimum frequency for the {} cores
- """.format(name))
+ RuntimeParameter(
+ param_name, kind=freq_val,
+ setter=self.set_min_frequency,
+ setter_params={'core': name},
+ description="""
+ The minimum frequency for the {} cores
+ """.format(name))
param_name = '{}_governor'.format(name)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=str,
- allowed_values=avail_govs,
- setter=self.set_governor,
- setter_params={'core': name},
- description="""
- The governor to be set for the {} cores
- """.format(name))
+ RuntimeParameter(
+ param_name, kind=str,
+ allowed_values=avail_govs,
+ setter=self.set_governor,
+ setter_params={'core': name},
+ description="""
+ The governor to be set for the {} cores
+ """.format(name))
param_name = '{}_gov_tunables'.format(name)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=dict,
- setter=self.set_governor_tunables,
- setter_params={'core': name},
- merge=True,
- description="""
- The governor tunables to be set for the {} cores
- """.format(name))
+ RuntimeParameter(
+ param_name, kind=dict,
+ setter=self.set_governor_tunables,
+ setter_params={'core': name},
+ merge=True,
+ description="""
+ The governor tunables to be set for the {} cores
+ """.format(name))
# Add cpuX parameters.
for cpu_no in range(self.target.number_of_cpus):
@@ -434,46 +441,51 @@ class CpufreqRuntimeConfig(RuntimeConfig):
param_name = 'cpu{}_frequency'.format(cpu_no)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=freq_val,
- setter=self.set_frequency,
- setter_params={'core': cpu_no},
- description="""
- The desired frequency for cpu{}
- """.format(cpu_no))
+ RuntimeParameter(
+ param_name, kind=freq_val,
+ setter=self.set_frequency,
+ setter_params={'core': cpu_no},
+ description="""
+ The desired frequency for cpu{}
+ """.format(cpu_no))
param_name = 'cpu{}_max_frequency'.format(cpu_no)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=freq_val,
- setter=self.set_max_frequency,
- setter_params={'core': cpu_no},
- description="""
- The maximum frequency for cpu{}
- """.format(cpu_no))
+ RuntimeParameter(
+ param_name, kind=freq_val,
+ setter=self.set_max_frequency,
+ setter_params={'core': cpu_no},
+ description="""
+ The maximum frequency for cpu{}
+ """.format(cpu_no))
param_name = 'cpu{}_min_frequency'.format(cpu_no)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=freq_val,
- setter=self.set_min_frequency,
- setter_params={'core': cpu_no},
- description="""
- The minimum frequency for cpu{}
- """.format(cpu_no))
+ RuntimeParameter(
+ param_name, kind=freq_val,
+ setter=self.set_min_frequency,
+ setter_params={'core': cpu_no},
+ description="""
+ The minimum frequency for cpu{}
+ """.format(cpu_no))
param_name = 'cpu{}_governor'.format(cpu_no)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=str,
- allowed_values=avail_govs,
- setter=self.set_governor,
- setter_params={'core': cpu_no},
- description="""
- The governor to be set for cpu{}
- """.format(cpu_no))
+ RuntimeParameter(
+ param_name, kind=str,
+ allowed_values=avail_govs,
+ setter=self.set_governor,
+ setter_params={'core': cpu_no},
+ description="""
+ The governor to be set for cpu{}
+ """.format(cpu_no))
param_name = 'cpu{}_gov_tunables'.format(cpu_no)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=dict,
- setter=self.set_governor_tunables,
- setter_params={'core': cpu_no},
- merge=True,
- description="""
- The governor tunables to be set for cpu{}
- """.format(cpu_no))
+ RuntimeParameter(
+ param_name, kind=dict,
+ setter=self.set_governor_tunables,
+ setter_params={'core': cpu_no},
+ merge=True,
+ description="""
+ The governor tunables to be set for cpu{}
+ """.format(cpu_no))
# Add big.little cores if present on device.
if self.target.has('bl'):
@@ -484,46 +496,51 @@ class CpufreqRuntimeConfig(RuntimeConfig):
param_name = '{}_frequency'.format(cluster)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=freq_val,
- setter=self.set_frequency,
- setter_params={'core': cluster},
- description="""
- The desired frequency for the {} cluster
- """.format(cluster))
+ RuntimeParameter(
+ param_name, kind=freq_val,
+ setter=self.set_frequency,
+ setter_params={'core': cluster},
+ description="""
+ The desired frequency for the {} cluster
+ """.format(cluster))
param_name = '{}_max_frequency'.format(cluster)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=freq_val,
- setter=self.set_max_frequency,
- setter_params={'core': cluster},
- description="""
- The maximum frequency for the {} cluster
- """.format(cluster))
+ RuntimeParameter(
+ param_name, kind=freq_val,
+ setter=self.set_max_frequency,
+ setter_params={'core': cluster},
+ description="""
+ The maximum frequency for the {} cluster
+ """.format(cluster))
param_name = '{}_min_frequency'.format(cluster)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=freq_val,
- setter=self.set_min_frequency,
- setter_params={'core': cluster},
- description="""
- The minimum frequency for the {} cluster
- """.format(cluster))
+ RuntimeParameter(
+ param_name, kind=freq_val,
+ setter=self.set_min_frequency,
+ setter_params={'core': cluster},
+ description="""
+ The minimum frequency for the {} cluster
+ """.format(cluster))
param_name = '{}_governor'.format(cluster)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=str,
- allowed_values=avail_govs,
- setter=self.set_governor,
- setter_params={'core': cluster},
- description="""
- The governor to be set for the {} cores
- """.format(cluster))
+ RuntimeParameter(
+ param_name, kind=str,
+ allowed_values=avail_govs,
+ setter=self.set_governor,
+ setter_params={'core': cluster},
+ description="""
+ The governor to be set for the {} cores
+ """.format(cluster))
param_name = '{}_gov_tunables'.format(cluster)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=dict,
- setter=self.set_governor_tunables,
- setter_params={'core': cluster},
- merge=True,
- description="""
- The governor tunables to be set for the {} cores
- """.format(cluster))
+ RuntimeParameter(
+ param_name, kind=dict,
+ setter=self.set_governor_tunables,
+ setter_params={'core': cluster},
+ merge=True,
+ description="""
+ The governor tunables to be set for the {} cores
+ """.format(cluster))
def check_target(self):
if not self.target.has('cpufreq'):
@@ -679,6 +696,7 @@ class CpufreqRuntimeConfig(RuntimeConfig):
return all_freqs, common_freqs, common_gov
+
class IdleStateValue(object):
def __init__(self, values):
@@ -750,35 +768,38 @@ class CpuidleRuntimeConfig(RuntimeConfig):
if common_idle_states:
param_name = 'idle_states'
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=idle_state_val,
- setter=self.set_idle_state,
- setter_params={'core': None},
- description="""
- The idle states to be set for all cores
- """)
+ RuntimeParameter(
+ param_name, kind=idle_state_val,
+ setter=self.set_idle_state,
+ setter_params={'core': None},
+ description="""
+ The idle states to be set for all cores
+ """)
for name in unique(self.target.platform.core_names):
cpu = resolve_cpus(name, self.target)[0]
idle_state_val = IdleStateValue(self.supported_idle_states.get(cpu))
param_name = '{}_idle_states'.format(name)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=idle_state_val,
- setter=self.set_idle_state,
- setter_params={'core': name},
- description="""
- The idle states to be set for {} cores
- """.format(name))
+ RuntimeParameter(
+ param_name, kind=idle_state_val,
+ setter=self.set_idle_state,
+ setter_params={'core': name},
+ description="""
+ The idle states to be set for {} cores
+ """.format(name))
for cpu_no in range(self.target.number_of_cpus):
idle_state_val = IdleStateValue(self.supported_idle_states.get(cpu_no))
param_name = 'cpu{}_idle_states'.format(cpu_no)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=idle_state_val,
- setter=self.set_idle_state,
- setter_params={'core': cpu_no},
- description="""
- The idle states to be set for cpu{}
- """.format(cpu_no))
+ RuntimeParameter(
+ param_name, kind=idle_state_val,
+ setter=self.set_idle_state,
+ setter_params={'core': cpu_no},
+ description="""
+ The idle states to be set for cpu{}
+ """.format(cpu_no))
if self.target.has('bl'):
for cluster in ['big', 'little']:
@@ -786,12 +807,13 @@ class CpuidleRuntimeConfig(RuntimeConfig):
idle_state_val = IdleStateValue(self.supported_idle_states.get(cpu))
param_name = '{}_idle_states'.format(cluster)
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=idle_state_val,
- setter=self.set_idle_state,
- setter_params={'core': cluster},
- description="""
- The idle states to be set for the {} cores
- """.format(cluster))
+ RuntimeParameter(
+ param_name, kind=idle_state_val,
+ setter=self.set_idle_state,
+ setter_params={'core': cluster},
+ description="""
+ The idle states to be set for the {} cores
+ """.format(cluster))
def check_target(self):
if not self.target.has('cpuidle'):
@@ -826,6 +848,7 @@ class CpuidleRuntimeConfig(RuntimeConfig):
common_idle_states.append(state)
return common_idle_states
+
ScreenOrientation = enum(['NATURAL', 'LEFT', 'INVERTED', 'RIGHT'])
@@ -865,41 +888,45 @@ class AndroidRuntimeConfig(RuntimeConfig):
param_name = 'brightness'
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=int,
- constraint=lambda x: 0 <= x <= 255,
- default=127,
- setter=self.set_brightness,
- description="""
- Specify the screen brightness to be set for
- the device
- """)
+ RuntimeParameter(
+ param_name, kind=int,
+ constraint=lambda x: 0 <= x <= 255,
+ default=127,
+ setter=self.set_brightness,
+ description="""
+ Specify the screen brightness to be set for
+ the device
+ """)
if self.target.os == 'android':
param_name = 'airplane_mode'
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=bool,
- setter=self.set_airplane_mode,
- description="""
- Specify whether airplane mode should be
- enabled for the device
- """)
+ RuntimeParameter(
+ param_name, kind=bool,
+ setter=self.set_airplane_mode,
+ description="""
+ Specify whether airplane mode should be
+ enabled for the device
+ """)
param_name = 'rotation'
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=ScreenOrientation,
- setter=self.set_rotation,
- description="""
- Specify the screen orientation for the device
- """)
+ RuntimeParameter(
+ param_name, kind=ScreenOrientation,
+ setter=self.set_rotation,
+ description="""
+ Specify the screen orientation for the device
+ """)
param_name = 'screen_on'
self._runtime_params[param_name] = \
- RuntimeParameter(param_name, kind=bool,
- default=True,
- setter=self.set_screen_state,
- description="""
- Specify whether the device screen should be on
- """)
+ RuntimeParameter(
+ param_name, kind=bool,
+ default=True,
+ setter=self.set_screen_state,
+ description="""
+ Specify whether the device screen should be on
+ """)
def check_target(self):
if self.target.os != 'android' and self.target.os != 'chromeos':
diff --git a/wa/framework/workload.py b/wa/framework/workload.py
index e1480af3..f2c655b5 100644
--- a/wa/framework/workload.py
+++ b/wa/framework/workload.py
@@ -114,7 +114,6 @@ class Workload(TargetedPlugin):
'Workload "{}" requires internet. Target does not appear '
'to be connected to the internet.'.format(self.name))
-
def run(self, context):
"""
Execute the workload. This is the method that performs the actual
@@ -288,7 +287,6 @@ class ApkWorkload(Workload):
super(ApkWorkload, self).teardown(context)
self.apk.teardown()
-
def deploy_assets(self, context):
super(ApkWorkload, self).deploy_assets(context)
self.target.refresh_files(self.deployed_assets)
@@ -373,6 +371,7 @@ class ApkReventWorkload(ApkUIWorkload):
self.extract_results_timeout,
self.teardown_timeout)
+
class UIWorkload(Workload):
def __init__(self, target, **kwargs):
@@ -459,7 +458,6 @@ class ReventWorkload(UIWorkload):
self.teardown_timeout)
-
class UiAutomatorGUI(object):
stages = ['setup', 'runWorkload', 'extractResults', 'teardown']
@@ -571,12 +569,12 @@ class ReventGUI(object):
stage='run',
target=self.target.model))
self.revent_extract_results_file = resolver.get(ReventFile(owner=self.workload,
- stage='extract_results',
- target=self.target.model),
+ stage='extract_results',
+ target=self.target.model),
strict=False)
self.revent_teardown_file = resolver.get(resource=ReventFile(owner=self.workload,
- stage='teardown',
- target=self.target.model),
+ stage='teardown',
+ target=self.target.model),
strict=False)
def deploy(self):
@@ -833,7 +831,7 @@ class PackageHandler(object):
raise WorkloadError(message.format(package))
package_info = self.target.get_package_info(package)
self.target.pull(package_info.apk_path, self.owner.dependencies_directory,
- timeout=self.install_timeout)
+ timeout=self.install_timeout)
apk_name = self.target.path.basename(package_info.apk_path)
return os.path.join(self.owner.dependencies_directory, apk_name)