lisa.tests.base.FtraceTestBundleBase#
- class lisa.tests.base.FtraceTestBundleBase(res_dir, plat_info)[source]#
Bases:
TestBundleBase
Base class for test bundles needing ftrace traces.
Optionally, an
FTRACE_CONF
class attribute can be defined to hold additional FTrace configuration used to record a trace while the synthetic workload is being run. By default, the required events are extracted from decorated test methods.This base class ensures that each subclass will get its own copy of
FTRACE_CONF
attribute, and that the events specified in that configuration are a superset of what is needed by methods using the family of decoratorslisa.trace.requires_events()
. This makes sure that the default set of events is always enough to run all defined methods, without duplicating that information. That means that trace events are “inherited” at the same time as the methods that need them.The
FTRACE_CONF
attribute is typically built by merging these sources:Existing
FTRACE_CONF
class attribute on theRTATestBundle
subclassEvents required by methods using
lisa.trace.requires_events()
decorator (and equivalents).lisa.trace.FtraceConf
specified by the user and passed tolisa.tests.base.TestBundleBase.from_target()
asftrace_conf
parameter.
Warning
Arbitrary code can be executed while loading an instance from a YAML or Pickle file. To include untrusted data in YAML, use the !untrusted tag along with a string
Note
As a subclass of
lisa.tests.base.TestBundleBase
, this class is considered as “application” and its API is therefore more subject to change than other parts oflisa
.Classes
__class__
inheritedMetaclass of
TestBundleBase
.Attributes
Path to the
trace-cmd
trace.dat file in the result directory.ATTRIBUTES_SERIALIZATION
inheritedAttributes to be treated specially during serialization.
DEFAULT_SERIALIZATION_FMT
inheritedDefault format used when serializing objects.
VERIFY_SERIALIZATION
inheritedWhen True, this enforces a serialization/deserialization step in
from_target()
.YAML_ENCODING
inheritedEncoding used for YAML files.
Properties
The
Trace
for the collected trace.dat file.Path to the
trace-cmd report
trace.dat file._children_test_bundles
inheritedlogger
inheritedConvenience short-hand for
self.get_logger()
.Methods
- returns:
a
lisa.trace.Trace
collected in the standard location.
__copy__()
inheritedRegular shallow copy operation, without dropping any attributes.
__getstate__()
inheritedFilter the instance’s attributes upon serialization.
__setstate__()
inherited_from_target()
inherited_get_filepath()
inheritedadd_undecided_filter()
inheritedTurn any method returning a
ResultBundleBase
into a decorator that can be used as a test method filter.can_create_from_target()
inherited- returns:
Whether the given target can be used to create an instance of this class :rtype: bool.
check_from_target()
inheritedCheck whether the given target can be used to create an instance of this class.
from_dir()
inheritedWrapper around
lisa.utils.Serializable.from_path()
.from_path()
inheritedDeserialize an object from a file.
from_target()
inheritedFactory method to create a bundle using a live target.
get_logger()
inheritedProvides a
logging.Logger
named aftercls
.get_tags()
inheritedDictionary of tags and tag values.
log_locals()
inheritedDebugging aid: log the local variables of the calling function.
to_dir()
inheritedto_path()
inheritedSerialize the object to a file.
to_yaml()
inheritedReturn a YAML string with the serialized object.
Classes#
- FtraceTestBundleBase.__class__#
alias of
TestBundleMeta
Attributes#
- FtraceTestBundleBase.TRACE_PATH = 'trace.dat'#
Path to the
trace-cmd
trace.dat file in the result directory.
- FtraceTestBundleBase.ATTRIBUTES_SERIALIZATION = {'allowed': [], 'ignored': [], 'placeholders': {}}#
Inherited attribute, see
lisa.utils.Serializable.ATTRIBUTES_SERIALIZATION
Attributes to be treated specially during serialization.
- FtraceTestBundleBase.DEFAULT_SERIALIZATION_FMT = 'yaml'#
Inherited attribute, see
lisa.utils.Serializable.DEFAULT_SERIALIZATION_FMT
Default format used when serializing objects.
- FtraceTestBundleBase.VERIFY_SERIALIZATION = True#
Inherited attribute, see
lisa.tests.base.TestBundleBase.VERIFY_SERIALIZATION
When True, this enforces a serialization/deserialization step in
from_target()
.
- FtraceTestBundleBase.YAML_ENCODING = 'utf-8'#
Inherited attribute, see
lisa.utils.Serializable.YAML_ENCODING
Encoding used for YAML files.
Properties#
- property FtraceTestBundleBase.trace[source]#
The
Trace
for the collected trace.dat file.All events specified in
FTRACE_CONF
are parsed from the trace, so it is suitable for direct use in methods.Having the trace as a property lets us defer the loading of the actual trace to when it is first used. Also, this prevents it from being serialized when calling
lisa.utils.Serializable.to_path()
and allows updating the underlying path before it is actually loaded to match a different folder structure.
- property FtraceTestBundleBase._children_test_bundles#
Inherited property, see
lisa.tests.base.TestBundleBase._children_test_bundles
- property FtraceTestBundleBase.logger#
Inherited property, see
lisa.utils.Loggable.logger
Convenience short-hand for
self.get_logger()
.
Methods#
- FtraceTestBundleBase.get_trace(events=None, **kwargs)[source]#
- Returns:
a
lisa.trace.Trace
collected in the standard location.- Variable keyword arguments:
Forwarded to
lisa.trace.Trace
.
- FtraceTestBundleBase.__copy__()#
Inherited method, see
lisa.utils.Serializable.__copy__()
Regular shallow copy operation, without dropping any attributes.
- FtraceTestBundleBase.__getstate__()#
Inherited method, see
lisa.utils.Serializable.__getstate__()
Filter the instance’s attributes upon serialization.
- FtraceTestBundleBase.__setstate__(dct)#
Inherited method, see
lisa.utils.Serializable.__setstate__()
- abstract classmethod FtraceTestBundleBase._from_target(target, *, res_dir)#
Inherited method, see
lisa.tests.base.TestBundleBase._from_target()
- classmethod FtraceTestBundleBase._get_filepath(res_dir)#
Inherited method, see
lisa.tests.base.TestBundleBase._get_filepath()
- FtraceTestBundleBase.add_undecided_filter()#
Inherited method, see
lisa.tests.base.TestBundleBase.add_undecided_filter()
Turn any method returning a
ResultBundleBase
into a decorator that can be used as a test method filter.
- classmethod FtraceTestBundleBase.can_create_from_target(target)#
Inherited method, see
lisa.tests.base.TestBundleBase.can_create_from_target()
- Returns:
Whether the given target can be used to create an instance of this class :rtype: bool.
- classmethod FtraceTestBundleBase.check_from_target(target)#
Inherited method, see
lisa.tests.base.TestBundleBase.check_from_target()
Check whether the given target can be used to create an instance of this class.
- classmethod FtraceTestBundleBase.from_dir(res_dir, update_res_dir=True)#
Inherited method, see
lisa.tests.base.TestBundleBase.from_dir()
Wrapper around
lisa.utils.Serializable.from_path()
.
- classmethod FtraceTestBundleBase.from_path(filepath, fmt=None)#
Inherited method, see
lisa.utils.Serializable.from_path()
Deserialize an object from a file.
- classmethod FtraceTestBundleBase.from_target(target: Target, *, res_dir: ArtifactPath = None, **kwargs)#
Inherited method, see
lisa.tests.base.TestBundleBase.from_target()
Factory method to create a bundle using a live target.
- classmethod FtraceTestBundleBase.get_logger(suffix=None)#
Inherited method, see
lisa.utils.Loggable.get_logger()
Provides a
logging.Logger
named aftercls
.
- FtraceTestBundleBase.get_tags()#
Inherited method, see
lisa.tests.base.TestBundleBase.get_tags()
Dictionary of tags and tag values.
- classmethod FtraceTestBundleBase.log_locals(var_names=None, level='debug')#
Inherited method, see
lisa.utils.Loggable.log_locals()
Debugging aid: log the local variables of the calling function.
- FtraceTestBundleBase.to_dir(res_dir)#
Inherited method, see
lisa.tests.base.TestBundleBase.to_dir()
- FtraceTestBundleBase.to_path(filepath, fmt=None)#
Inherited method, see
lisa.utils.Serializable.to_path()
Serialize the object to a file.
- FtraceTestBundleBase.to_yaml()#
Inherited method, see
lisa.utils.Serializable.to_yaml()
Return a YAML string with the serialized object.