mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-31 02:01:16 +00:00
framework: pep8 fixes
Fix issues reported by flake8.
This commit is contained in:
parent
88c5005b38
commit
03eafe6b33
@ -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:
|
||||
@ -382,7 +384,6 @@ class Configuration(object):
|
||||
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):
|
||||
|
||||
|
@ -18,11 +18,13 @@ 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',
|
||||
|
||||
DEFAULT_AUGMENTATIONS = [
|
||||
'execution_time',
|
||||
'interrupts',
|
||||
'cpufreq',
|
||||
'status',
|
||||
'csv'
|
||||
'csv',
|
||||
]
|
||||
|
||||
|
||||
|
@ -84,7 +84,6 @@ class ConfigParser(object):
|
||||
log.dedent()
|
||||
|
||||
|
||||
|
||||
class AgendaParser(object):
|
||||
|
||||
def load_from_path(self, state, filepath):
|
||||
@ -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]
|
||||
|
@ -270,7 +270,6 @@ class PluginCache(object):
|
||||
raise AttributeError(name)
|
||||
|
||||
|
||||
|
||||
class MergeState(object):
|
||||
|
||||
def __init__(self):
|
||||
|
@ -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):
|
||||
|
@ -86,18 +86,23 @@ 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',
|
||||
ConfigurationPoint(
|
||||
'augmentations',
|
||||
aliases=["instruments", "processors", "instrumentation",
|
||||
"output_processors", "augment", "result_processors"],
|
||||
description='''The augmentations enabled by default.
|
||||
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',
|
||||
now aliases for this).
|
||||
'''),
|
||||
ConfigurationPoint(
|
||||
'device_config',
|
||||
description='''Generic configuration for device.''',
|
||||
default={}),
|
||||
ConfigurationPoint('cleanup_assets',
|
||||
ConfigurationPoint(
|
||||
'cleanup_assets',
|
||||
aliases=['clean_up'],
|
||||
description='''Specify whether to clean up assets
|
||||
deployed to the target''',
|
||||
|
@ -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):
|
||||
|
||||
|
@ -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'
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
||||
@ -175,7 +174,6 @@ class ApkFile(Resource):
|
||||
uiauto_matches and package_matches and \
|
||||
abi_matches
|
||||
|
||||
|
||||
def __str__(self):
|
||||
text = '<{}\'s apk'.format(self.owner)
|
||||
if self.variant:
|
||||
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
from copy import copy
|
||||
|
||||
#Not going to be used for now.
|
||||
|
||||
class TargetConfig(dict):
|
||||
"""
|
||||
|
@ -289,51 +289,62 @@ GEM5_PLATFORM_PARAMS = [
|
||||
|
||||
CONNECTION_PARAMS = {
|
||||
AdbConnection: [
|
||||
Parameter('device', kind=str,
|
||||
Parameter(
|
||||
'device', kind=str,
|
||||
aliases=['adb_name'],
|
||||
description="""
|
||||
ADB device name
|
||||
"""),
|
||||
Parameter('adb_server', kind=str,
|
||||
Parameter(
|
||||
'adb_server', kind=str,
|
||||
description="""
|
||||
ADB server to connect to.
|
||||
"""),
|
||||
],
|
||||
SshConnection: [
|
||||
Parameter('host', kind=str, mandatory=True,
|
||||
Parameter(
|
||||
'host', kind=str, mandatory=True,
|
||||
description="""
|
||||
Host name or IP address of the target.
|
||||
"""),
|
||||
Parameter('username', kind=str, mandatory=True,
|
||||
Parameter(
|
||||
'username', kind=str, mandatory=True,
|
||||
description="""
|
||||
User name to connect with
|
||||
"""),
|
||||
Parameter('password', kind=str,
|
||||
Parameter(
|
||||
'password', kind=str,
|
||||
description="""
|
||||
Password to use.
|
||||
"""),
|
||||
Parameter('keyfile', kind=str,
|
||||
Parameter(
|
||||
'keyfile', kind=str,
|
||||
description="""
|
||||
Key file to use
|
||||
"""),
|
||||
Parameter('port', kind=int,
|
||||
Parameter(
|
||||
'port', kind=int,
|
||||
description="""
|
||||
The port SSH server is listening on on the target.
|
||||
"""),
|
||||
Parameter('telnet', kind=bool, default=False,
|
||||
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,
|
||||
Parameter(
|
||||
'password_prompt', kind=str,
|
||||
description="""
|
||||
Password prompt to expect
|
||||
"""),
|
||||
Parameter('original_prompt', kind=str,
|
||||
Parameter(
|
||||
'original_prompt', kind=str,
|
||||
description="""
|
||||
Original shell prompt to expect.
|
||||
"""),
|
||||
Parameter('sudo_cmd', kind=str,
|
||||
Parameter(
|
||||
'sudo_cmd', kind=str,
|
||||
default="sudo -- sh -c '{}'",
|
||||
description="""
|
||||
Sudo command to use. Must have ``"{}"`` specified
|
||||
@ -342,44 +353,53 @@ CONNECTION_PARAMS = {
|
||||
"""),
|
||||
],
|
||||
Gem5Connection: [
|
||||
Parameter('host', kind=str, mandatory=False,
|
||||
Parameter(
|
||||
'host', kind=str, mandatory=False,
|
||||
description="""
|
||||
Host name or IP address of the target.
|
||||
"""),
|
||||
Parameter('username', kind=str, default='root',
|
||||
Parameter(
|
||||
'username', kind=str, default='root',
|
||||
description="""
|
||||
User name to connect to gem5 simulation.
|
||||
"""),
|
||||
Parameter('password', kind=str,
|
||||
Parameter(
|
||||
'password', kind=str,
|
||||
description="""
|
||||
Password to use.
|
||||
"""),
|
||||
Parameter('port', kind=int,
|
||||
Parameter(
|
||||
'port', kind=int,
|
||||
description="""
|
||||
The port SSH server is listening on on the target.
|
||||
"""),
|
||||
Parameter('password_prompt', kind=str,
|
||||
Parameter(
|
||||
'password_prompt', kind=str,
|
||||
description="""
|
||||
Password prompt to expect
|
||||
"""),
|
||||
Parameter('original_prompt', kind=str,
|
||||
Parameter(
|
||||
'original_prompt', kind=str,
|
||||
description="""
|
||||
Original shell prompt to expect.
|
||||
"""),
|
||||
],
|
||||
LocalConnection: [
|
||||
Parameter('password', kind=str,
|
||||
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,
|
||||
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,
|
||||
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.
|
||||
@ -524,7 +544,6 @@ class DefaultTargetDescriptor(TargetDescriptor):
|
||||
return cls, updated_params
|
||||
|
||||
|
||||
|
||||
_adhoc_target_descriptions = []
|
||||
|
||||
|
||||
|
@ -53,7 +53,6 @@ class TargetManager(object):
|
||||
self.parameters = parameters
|
||||
self.disconnect = parameters.get('disconnect')
|
||||
|
||||
|
||||
def initialize(self):
|
||||
self._init_target()
|
||||
|
||||
|
@ -132,8 +132,7 @@ class HotplugRuntimeConfig(RuntimeConfig):
|
||||
param_name = 'num_cores'
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=int,
|
||||
constraint=lambda x:
|
||||
0 <= x <= self.target.number_of_cpus,
|
||||
constraint=lambda x: 0 <= x <= self.target.number_of_cpus,
|
||||
description="""
|
||||
The number of cpu cores to be online
|
||||
""",
|
||||
@ -144,8 +143,7 @@ class HotplugRuntimeConfig(RuntimeConfig):
|
||||
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)),
|
||||
constraint=lambda x, name=name: 0 <= x <= len(self.target.core_cpus(name)),
|
||||
description="""
|
||||
The number of {} cores to be online
|
||||
""".format(name),
|
||||
@ -167,8 +165,7 @@ class HotplugRuntimeConfig(RuntimeConfig):
|
||||
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)),
|
||||
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),
|
||||
@ -334,7 +331,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
freq_val = FreqValue(common_freqs)
|
||||
param_name = 'frequency'
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=freq_val,
|
||||
RuntimeParameter(
|
||||
param_name, kind=freq_val,
|
||||
setter=self.set_frequency,
|
||||
setter_params={'core': None},
|
||||
description="""
|
||||
@ -342,7 +340,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
""")
|
||||
param_name = 'max_frequency'
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=freq_val,
|
||||
RuntimeParameter(
|
||||
param_name, kind=freq_val,
|
||||
setter=self.set_max_frequency,
|
||||
setter_params={'core': None},
|
||||
description="""
|
||||
@ -350,7 +349,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
""")
|
||||
param_name = 'min_frequency'
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=freq_val,
|
||||
RuntimeParameter(
|
||||
param_name, kind=freq_val,
|
||||
setter=self.set_min_frequency,
|
||||
setter_params={'core': None},
|
||||
description="""
|
||||
@ -360,7 +360,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
if common_gov:
|
||||
param_name = 'governor'
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=str,
|
||||
RuntimeParameter(
|
||||
param_name, kind=str,
|
||||
allowed_values=common_gov,
|
||||
setter=self.set_governor,
|
||||
setter_params={'core': None},
|
||||
@ -370,7 +371,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
|
||||
param_name = 'governor_tunables'
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=dict,
|
||||
RuntimeParameter(
|
||||
param_name, kind=dict,
|
||||
merge=True,
|
||||
setter=self.set_governor_tunables,
|
||||
setter_params={'core': None},
|
||||
@ -386,7 +388,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
|
||||
param_name = '{}_frequency'.format(name)
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=freq_val,
|
||||
RuntimeParameter(
|
||||
param_name, kind=freq_val,
|
||||
setter=self.set_frequency,
|
||||
setter_params={'core': name},
|
||||
description="""
|
||||
@ -394,7 +397,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
""".format(name))
|
||||
param_name = '{}_max_frequency'.format(name)
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=freq_val,
|
||||
RuntimeParameter(
|
||||
param_name, kind=freq_val,
|
||||
setter=self.set_max_frequency,
|
||||
setter_params={'core': name},
|
||||
description="""
|
||||
@ -402,7 +406,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
""".format(name))
|
||||
param_name = '{}_min_frequency'.format(name)
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=freq_val,
|
||||
RuntimeParameter(
|
||||
param_name, kind=freq_val,
|
||||
setter=self.set_min_frequency,
|
||||
setter_params={'core': name},
|
||||
description="""
|
||||
@ -410,7 +415,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
""".format(name))
|
||||
param_name = '{}_governor'.format(name)
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=str,
|
||||
RuntimeParameter(
|
||||
param_name, kind=str,
|
||||
allowed_values=avail_govs,
|
||||
setter=self.set_governor,
|
||||
setter_params={'core': name},
|
||||
@ -419,7 +425,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
""".format(name))
|
||||
param_name = '{}_gov_tunables'.format(name)
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=dict,
|
||||
RuntimeParameter(
|
||||
param_name, kind=dict,
|
||||
setter=self.set_governor_tunables,
|
||||
setter_params={'core': name},
|
||||
merge=True,
|
||||
@ -434,7 +441,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
|
||||
param_name = 'cpu{}_frequency'.format(cpu_no)
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=freq_val,
|
||||
RuntimeParameter(
|
||||
param_name, kind=freq_val,
|
||||
setter=self.set_frequency,
|
||||
setter_params={'core': cpu_no},
|
||||
description="""
|
||||
@ -442,7 +450,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
""".format(cpu_no))
|
||||
param_name = 'cpu{}_max_frequency'.format(cpu_no)
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=freq_val,
|
||||
RuntimeParameter(
|
||||
param_name, kind=freq_val,
|
||||
setter=self.set_max_frequency,
|
||||
setter_params={'core': cpu_no},
|
||||
description="""
|
||||
@ -450,7 +459,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
""".format(cpu_no))
|
||||
param_name = 'cpu{}_min_frequency'.format(cpu_no)
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=freq_val,
|
||||
RuntimeParameter(
|
||||
param_name, kind=freq_val,
|
||||
setter=self.set_min_frequency,
|
||||
setter_params={'core': cpu_no},
|
||||
description="""
|
||||
@ -458,7 +468,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
""".format(cpu_no))
|
||||
param_name = 'cpu{}_governor'.format(cpu_no)
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=str,
|
||||
RuntimeParameter(
|
||||
param_name, kind=str,
|
||||
allowed_values=avail_govs,
|
||||
setter=self.set_governor,
|
||||
setter_params={'core': cpu_no},
|
||||
@ -467,7 +478,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
""".format(cpu_no))
|
||||
param_name = 'cpu{}_gov_tunables'.format(cpu_no)
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=dict,
|
||||
RuntimeParameter(
|
||||
param_name, kind=dict,
|
||||
setter=self.set_governor_tunables,
|
||||
setter_params={'core': cpu_no},
|
||||
merge=True,
|
||||
@ -484,7 +496,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
param_name = '{}_frequency'.format(cluster)
|
||||
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=freq_val,
|
||||
RuntimeParameter(
|
||||
param_name, kind=freq_val,
|
||||
setter=self.set_frequency,
|
||||
setter_params={'core': cluster},
|
||||
description="""
|
||||
@ -492,7 +505,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
""".format(cluster))
|
||||
param_name = '{}_max_frequency'.format(cluster)
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=freq_val,
|
||||
RuntimeParameter(
|
||||
param_name, kind=freq_val,
|
||||
setter=self.set_max_frequency,
|
||||
setter_params={'core': cluster},
|
||||
description="""
|
||||
@ -500,7 +514,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
""".format(cluster))
|
||||
param_name = '{}_min_frequency'.format(cluster)
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=freq_val,
|
||||
RuntimeParameter(
|
||||
param_name, kind=freq_val,
|
||||
setter=self.set_min_frequency,
|
||||
setter_params={'core': cluster},
|
||||
description="""
|
||||
@ -508,7 +523,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
""".format(cluster))
|
||||
param_name = '{}_governor'.format(cluster)
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=str,
|
||||
RuntimeParameter(
|
||||
param_name, kind=str,
|
||||
allowed_values=avail_govs,
|
||||
setter=self.set_governor,
|
||||
setter_params={'core': cluster},
|
||||
@ -517,7 +533,8 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
""".format(cluster))
|
||||
param_name = '{}_gov_tunables'.format(cluster)
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=dict,
|
||||
RuntimeParameter(
|
||||
param_name, kind=dict,
|
||||
setter=self.set_governor_tunables,
|
||||
setter_params={'core': cluster},
|
||||
merge=True,
|
||||
@ -679,6 +696,7 @@ class CpufreqRuntimeConfig(RuntimeConfig):
|
||||
|
||||
return all_freqs, common_freqs, common_gov
|
||||
|
||||
|
||||
class IdleStateValue(object):
|
||||
|
||||
def __init__(self, values):
|
||||
@ -750,7 +768,8 @@ class CpuidleRuntimeConfig(RuntimeConfig):
|
||||
if common_idle_states:
|
||||
param_name = 'idle_states'
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=idle_state_val,
|
||||
RuntimeParameter(
|
||||
param_name, kind=idle_state_val,
|
||||
setter=self.set_idle_state,
|
||||
setter_params={'core': None},
|
||||
description="""
|
||||
@ -762,7 +781,8 @@ class CpuidleRuntimeConfig(RuntimeConfig):
|
||||
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,
|
||||
RuntimeParameter(
|
||||
param_name, kind=idle_state_val,
|
||||
setter=self.set_idle_state,
|
||||
setter_params={'core': name},
|
||||
description="""
|
||||
@ -773,7 +793,8 @@ class CpuidleRuntimeConfig(RuntimeConfig):
|
||||
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,
|
||||
RuntimeParameter(
|
||||
param_name, kind=idle_state_val,
|
||||
setter=self.set_idle_state,
|
||||
setter_params={'core': cpu_no},
|
||||
description="""
|
||||
@ -786,7 +807,8 @@ 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,
|
||||
RuntimeParameter(
|
||||
param_name, kind=idle_state_val,
|
||||
setter=self.set_idle_state,
|
||||
setter_params={'core': cluster},
|
||||
description="""
|
||||
@ -826,6 +848,7 @@ class CpuidleRuntimeConfig(RuntimeConfig):
|
||||
common_idle_states.append(state)
|
||||
return common_idle_states
|
||||
|
||||
|
||||
ScreenOrientation = enum(['NATURAL', 'LEFT', 'INVERTED', 'RIGHT'])
|
||||
|
||||
|
||||
@ -865,7 +888,8 @@ class AndroidRuntimeConfig(RuntimeConfig):
|
||||
|
||||
param_name = 'brightness'
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=int,
|
||||
RuntimeParameter(
|
||||
param_name, kind=int,
|
||||
constraint=lambda x: 0 <= x <= 255,
|
||||
default=127,
|
||||
setter=self.set_brightness,
|
||||
@ -877,7 +901,8 @@ class AndroidRuntimeConfig(RuntimeConfig):
|
||||
if self.target.os == 'android':
|
||||
param_name = 'airplane_mode'
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=bool,
|
||||
RuntimeParameter(
|
||||
param_name, kind=bool,
|
||||
setter=self.set_airplane_mode,
|
||||
description="""
|
||||
Specify whether airplane mode should be
|
||||
@ -886,7 +911,8 @@ class AndroidRuntimeConfig(RuntimeConfig):
|
||||
|
||||
param_name = 'rotation'
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=ScreenOrientation,
|
||||
RuntimeParameter(
|
||||
param_name, kind=ScreenOrientation,
|
||||
setter=self.set_rotation,
|
||||
description="""
|
||||
Specify the screen orientation for the device
|
||||
@ -894,7 +920,8 @@ class AndroidRuntimeConfig(RuntimeConfig):
|
||||
|
||||
param_name = 'screen_on'
|
||||
self._runtime_params[param_name] = \
|
||||
RuntimeParameter(param_name, kind=bool,
|
||||
RuntimeParameter(
|
||||
param_name, kind=bool,
|
||||
default=True,
|
||||
setter=self.set_screen_state,
|
||||
description="""
|
||||
|
@ -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']
|
||||
|
Loading…
x
Reference in New Issue
Block a user