lisa.target.Target#

class lisa.target.Target(kind, name='<noname>', tools=[], res_dir=None, plat_info=None, lazy_platinfo=True, workdir=None, device=None, host=None, port=None, username=None, password=None, keyfile=None, strict_host_check=None, devlib_platform=None, devlib_excluded_modules=[], devlib_file_xfer=None, wait_boot=True, wait_boot_timeout=10, kernel_src=None, kmod_build_env=None, kmod_make_vars=None, kmod_overlay_backend=None, devlib_max_async=None)[source]#

Bases: Loggable, HideExekallID, ExekallTaggable, Configurable

Wrap devlib.target.Target to provide additional features on top of it.

Parameters:
  • kind (Literal['linux', 'android', 'host']) – Target kind. Can be “linux” (ssh) or “android” (adb)

  • name (str) – Board name, free-form value only used to embelish logs

  • tools (Sequence[str]) – List of tools to install on the target

  • lazy_platinfo (bool) – Lazily autodect the platform information to speed up the connection

  • workdir (str) – Remote target workdir

  • device (str or None) – ADB device

  • host (str or None) – Hostname or IP address of the SSH or ADB server

  • port (int or None) – SSH or ADB server port

  • username (str or None) – SSH username. On ADB connections, “root” username will root adb upon target connection

  • password (str or None) – SSH password

  • keyfile (str or None) – SSH private key file

  • strict_host_check (bool or None) – Equivalent to StrictHostKeyChecking option of OpenSSH

  • wait_boot (bool) – Enable the boot check

  • devlib_excluded_modules (Sequence[str]) – List of devlib modules to not load

  • devlib_file_xfer (Sequence[str]) – File transfer method. Can be “sftp” (default) or “scp”. (Only valid for linux targets)

  • devlib_max_async (int or None) – Maximum number of asynchronous commands in flight at any time

  • wait_boot_timeout (int) – Timeout of the boot check

  • kernel_src (str or None) – Path to kernel source tree matching the kernel running on the target used to build modules

  • kmod_build_env (collections.abc.Mapping) – Kernel module build environment

  • devlib_platform (devlib.platform.Platform) – Instance of devlib.platform.Platform to use to build the devlib.target.Target

  • plat_info (lisa.platforms.platinfo.PlatformInfo) – Platform information attached to this target, for the benefits of user code.

You need to provide the information needed to connect to the target. For SSH targets that means “host”, “username” and either “password” or “keyfile”. All other fields are optional if the relevant features aren’t needed.

Note

The wrapping of devlib.target.Target is done using composition, as opposed to inheritance. This allows swapping the exact class used under the hood, and avoids messing up with devlib internal members.

Classes

CONF_CLASS

Target connection settings.

Attributes

ADB_PORT_DEFAULT

CRITICAL_TASKS

Dictionary mapping OS name to list of task names that we can’t afford to freeze when using freeze_userspace().

INIT_KWARGS_KEY_MAP

Dictionary of __init__ parameter names to configuration key path.

SSH_PORT_DEFAULT

bl

See devlib.module.biglittle.BigLittleModule.

cgroups

See devlib.module.cgroups.CgroupsModule.

cpufreq

See devlib.module.cpufreq.CpufreqModule.

cpuidle

See devlib.module.cpuidle.Cpuidle.

devfreq

See devlib.module.devfreq.DevfreqModule.

fastboot

See devlib.module.android.FastbootFlashModule.

gem5stats

See devlib.module.gem5stats.Gem5StatsModule.

gpufreq

See devlib.module.gpufreq.GpufreqModule.

hotplug

See devlib.module.hotplug.HotplugModule.

hwmon

See devlib.module.hwmon.HwmonModule.

mbed_fan

See devlib.module.cooling.MbedFanActiveCoolingModule.

odroidxu3_fan

See devlib.module.cooling.OdroidXU3ctiveCoolingModule.

sched

See devlib.module.sched.SchedModule.

thermal

See devlib.module.thermal.ThermalModule.

default_modules inherited

See devlib.target.Target.default_modules

ls_command inherited

See devlib.target.AndroidTarget.ls_command

os inherited

See devlib.target.Target.os

path inherited

See devlib.target.Target.path

system_id inherited

See devlib.target.Target.system_id

Properties

abi inherited

See devlib.target.Target.abi

adb_name inherited

See devlib.target.AndroidTarget.adb_name

adb_port inherited

See devlib.target.AndroidTarget.adb_port

adb_server inherited

See devlib.target.AndroidTarget.adb_server

android_id inherited

See devlib.target.AndroidTarget.android_id

async_manager inherited

See devlib.target.Target.async_manager

big_core inherited

See devlib.target.Target.big_core

charging_enabled inherited

See devlib.target.AndroidTarget.charging_enabled

config inherited

See devlib.target.Target.config

conn inherited

See devlib.target.Target.conn

connected_as_root inherited

See devlib.target.Target.connected_as_root

core_clusters inherited

See devlib.target.Target.core_clusters

core_names inherited

See devlib.target.Target.core_names

cpuinfo inherited

See devlib.target.Target.cpuinfo

external_storage inherited

See devlib.target.AndroidTarget.external_storage

external_storage_app_dir inherited

See devlib.target.AndroidTarget.external_storage_app_dir

hostid inherited

See devlib.target.Target.hostid

hostname inherited

See devlib.target.Target.hostname

is_connected inherited

See devlib.target.Target.is_connected

is_rooted inherited

See devlib.target.Target.is_rooted

kernel_version inherited

See devlib.target.Target.kernel_version

list_nodes_cpus inherited

See devlib.target.Target.list_nodes_cpus

little_core inherited

See devlib.target.Target.little_core

logger inherited

Convenience short-hand for self.get_logger().

model inherited

See devlib.target.Target.model

modules inherited

See devlib.target.Target.modules

needs_su inherited

See devlib.target.Target.needs_su

number_of_cpus inherited

See devlib.target.Target.number_of_cpus

number_of_nodes inherited

See devlib.target.Target.number_of_nodes

os_version inherited

See devlib.target.Target.os_version

page_size_kb inherited

See devlib.target.Target.page_size_kb

screen_resolution inherited

See devlib.target.AndroidTarget.screen_resolution

shutils inherited

See devlib.target.Target.shutils

supported_abi inherited

See devlib.target.Target.supported_abi

user inherited

See devlib.target.Target.user

Methods

__dir__()

List our attributes plus the ones from the underlying target, and the devlib modules that could be loaded on-demand.

__getattr__()

Forward all non-overriden attributes/method accesses to the underlying devlib.target.Target.

__setstate__()

cached_pull()

Same as lisa.target.Target.pull but will cache the file in the target.res_dir folder, based on the source path.

closing()

Returns a context manager that will disconnect the target automatically.

disable_idle_states()

Context manager that lets you disable all idle states.

execute_python()

Executes the given Python function f with the provided positional and keyword arguments.

freeze_userspace()

Context manager that lets you freeze the userspace.

from_cli()

Same as from_custom_cli() without the custom parameters capabilities.

from_conf()

from_custom_cli()

Create a Target from command line arguments.

from_default_conf()

Create a Target from the YAML configuration file pointed by LISA_CONF environment variable.

from_one_conf()

Create a Target from a single YAML configuration file.

get_kmod()

Build a lisa._kmod.DynamicKmod instance of the given subclass.

get_res_dir()

Returns a directory managed by LISA to store results.

get_tags()

Dictionary of tags and tag values.

install_tools()

Install tools additional to those specified in the test config ‘tools’ field.

is_module_available()

Check if the given devlib module is available.

remote_func()

Decorates a given function to execute remotely using execute_python().

__aenter__() inherited

See devlib.target.Target.__aenter__()

__aexit__() inherited

See devlib.target.Target.__aexit__()

__enter__() inherited

See devlib.target.Target.__enter__()

__exit__() inherited

See devlib.target.Target.__exit__()

background() inherited

See devlib.target.Target.background()

background_invoke() inherited

See devlib.target.Target.background_invoke()

batch_revertable_write_value() inherited

See devlib.target.Target.batch_revertable_write_value()

bin() inherited

See devlib.target.Target.bin()

broadcast_media_mounted() inherited

See devlib.target.AndroidTarget.broadcast_media_mounted()

broadcast_media_scan_file() inherited

See devlib.target.AndroidTarget.broadcast_media_scan_file()

capture_screen() inherited

See devlib.target.Target.capture_screen()

capture_ui_hierarchy() inherited

See devlib.target.AndroidTarget.capture_ui_hierarchy()

check_connection() inherited

See devlib.target.Target.check_connection()

check_init_param() inherited

Take the same parameters as __init__, and check their types according to what is specified in the configuration class.

check_responsive() inherited

See devlib.target.Target.check_responsive()

clear_logcat() inherited

See devlib.target.AndroidTarget.clear_logcat()

conf_to_init_kwargs() inherited

Turn a configuration object into a dictionary suitable for passing to __init__ as **kwargs.

connect() inherited

See devlib.target.Target.connect()

core_cpus() inherited

See devlib.target.Target.core_cpus()

directory_exists() inherited

See devlib.target.Target.directory_exists()

disconnect() inherited

See devlib.target.Target.disconnect()

dump_logcat() inherited

See devlib.target.AndroidTarget.dump_logcat()

ensure_screen_is_off() inherited

See devlib.target.AndroidTarget.ensure_screen_is_off()

ensure_screen_is_on() inherited

See devlib.target.AndroidTarget.ensure_screen_is_on()

ensure_screen_is_on_and_stays() inherited

See devlib.target.AndroidTarget.ensure_screen_is_on_and_stays()

execute() inherited

See devlib.target.Target.execute()

extract() inherited

See devlib.target.Target.extract()

file_exists() inherited

See devlib.target.Target.file_exists()

get_airplane_mode() inherited

See devlib.target.AndroidTarget.get_airplane_mode()

get_auto_brightness() inherited

See devlib.target.AndroidTarget.get_auto_brightness()

get_auto_rotation() inherited

See devlib.target.AndroidTarget.get_auto_rotation()

get_brightness() inherited

See devlib.target.AndroidTarget.get_brightness()

get_connection() inherited

See devlib.target.Target.get_connection()

get_directory() inherited

See devlib.target.Target.get_directory()

get_installed() inherited

See devlib.target.Target.get_installed()

get_logcat_monitor() inherited

See devlib.target.AndroidTarget.get_logcat_monitor()

get_logger() inherited

Provides a logging.Logger named after cls.

get_package_info() inherited

See devlib.target.AndroidTarget.get_package_info()

get_package_version() inherited

See devlib.target.AndroidTarget.get_package_version()

get_pids_of() inherited

See devlib.target.Target.get_pids_of()

get_rotation() inherited

See devlib.target.AndroidTarget.get_rotation()

get_screen_timeout() inherited

See devlib.target.AndroidTarget.get_screen_timeout()

get_sdk_version() inherited

See devlib.target.AndroidTarget.get_sdk_version()

get_stay_on_mode() inherited

See devlib.target.AndroidTarget.get_stay_on_mode()

get_workpath() inherited

See devlib.target.Target.get_workpath()

getenv() inherited

See devlib.target.Target.getenv()

getprop() inherited

See devlib.target.AndroidTarget.getprop()

grant_package_permission() inherited

See devlib.target.AndroidTarget.grant_package_permission()

has() inherited

See devlib.target.Target.has()

homescreen() inherited

See devlib.target.AndroidTarget.homescreen()

input_swipe() inherited

See devlib.target.AndroidTarget.input_swipe()

input_swipe_pct() inherited

See devlib.target.AndroidTarget.input_swipe_pct()

input_tap() inherited

See devlib.target.AndroidTarget.input_tap()

input_tap_pct() inherited

See devlib.target.AndroidTarget.input_tap_pct()

insmod() inherited

See devlib.target.Target.insmod()

install() inherited

See devlib.target.Target.install()

install_apk() inherited

See devlib.target.AndroidTarget.install_apk()

install_executable() inherited

See devlib.target.AndroidTarget.install_executable()

install_if_needed() inherited

See devlib.target.Target.install_if_needed()

install_module() inherited

See devlib.target.Target.install_module()

invoke() inherited

See devlib.target.Target.invoke()

is_installed() inherited

See devlib.target.Target.is_installed()

is_network_connected() inherited

See devlib.target.Target.is_network_connected()

is_running() inherited

See devlib.target.Target.is_running()

is_screen_locked() inherited

See devlib.target.AndroidTarget.is_screen_locked()

is_screen_on() inherited

See devlib.target.AndroidTarget.is_screen_on()

kick_off() inherited

See devlib.target.Target.kick_off()

kill() inherited

See devlib.target.Target.kill()

killall() inherited

See devlib.target.Target.killall()

list_directory() inherited

See devlib.target.Target.list_directory()

list_file_systems() inherited

See devlib.target.Target.list_file_systems()

list_offline_cpus() inherited

See devlib.target.Target.list_offline_cpus()

list_online_cpus() inherited

See devlib.target.Target.list_online_cpus()

list_packages() inherited

See devlib.target.AndroidTarget.list_packages()

log_locals() inherited

Debugging aid: log the local variables of the calling function.

lsmod() inherited

See devlib.target.Target.lsmod()

make_temp() inherited

See devlib.target.Target.make_temp()

makedirs() inherited

See devlib.target.Target.makedirs()

open_url() inherited

See devlib.target.AndroidTarget.open_url()

package_is_installed() inherited

See devlib.target.AndroidTarget.package_is_installed()

ps() inherited

See devlib.target.Target.ps()

pull() inherited

See devlib.target.Target.pull()

push() inherited

See devlib.target.Target.push()

read_bool() inherited

See devlib.target.Target.read_bool()

read_int() inherited

See devlib.target.Target.read_int()

read_sysctl() inherited

See devlib.target.Target.read_sysctl()

read_tree_tar_flat() inherited

See devlib.target.Target.read_tree_tar_flat()

read_tree_values() inherited

See devlib.target.Target.read_tree_values()

read_tree_values_flat() inherited

See devlib.target.Target.read_tree_values_flat()

read_value() inherited

See devlib.target.Target.read_value()

reboot() inherited

See devlib.target.Target.reboot()

reboot_bootloader() inherited

See devlib.target.AndroidTarget.reboot_bootloader()

refresh_files() inherited

See devlib.target.AndroidTarget.refresh_files()

remove() inherited

See devlib.target.Target.remove()

reset() inherited

See devlib.target.Target.reset()

revertable_write_value() inherited

See devlib.target.Target.revertable_write_value()

set_airplane_mode() inherited

See devlib.target.AndroidTarget.set_airplane_mode()

set_auto_brightness() inherited

See devlib.target.AndroidTarget.set_auto_brightness()

set_auto_rotation() inherited

See devlib.target.AndroidTarget.set_auto_rotation()

set_brightness() inherited

See devlib.target.AndroidTarget.set_brightness()

set_inverted_rotation() inherited

See devlib.target.AndroidTarget.set_inverted_rotation()

set_left_rotation() inherited

See devlib.target.AndroidTarget.set_left_rotation()

set_natural_rotation() inherited

See devlib.target.AndroidTarget.set_natural_rotation()

set_right_rotation() inherited

See devlib.target.AndroidTarget.set_right_rotation()

set_rotation() inherited

See devlib.target.AndroidTarget.set_rotation()

set_screen_timeout() inherited

See devlib.target.AndroidTarget.set_screen_timeout()

set_stay_on_mode() inherited

See devlib.target.AndroidTarget.set_stay_on_mode()

set_stay_on_never() inherited

See devlib.target.AndroidTarget.set_stay_on_never()

set_stay_on_while_powered() inherited

See devlib.target.AndroidTarget.set_stay_on_while_powered()

setup() inherited

See devlib.target.Target.setup()

sleep() inherited

See devlib.target.Target.sleep()

swipe_to_unlock() inherited

See devlib.target.AndroidTarget.swipe_to_unlock()

tempfile() inherited

See devlib.target.Target.tempfile()

uninstall() inherited

See devlib.target.Target.uninstall()

uninstall_executable() inherited

See devlib.target.AndroidTarget.uninstall_executable()

uninstall_package() inherited

See devlib.target.AndroidTarget.uninstall_package()

wait_boot_complete() inherited

See devlib.target.Target.wait_boot_complete()

wait_for_device() inherited

See devlib.target.AndroidTarget.wait_for_device()

which() inherited

See devlib.target.Target.which()

write_value() inherited

See devlib.target.Target.write_value()

Classes#

Target.CONF_CLASS#

alias of TargetConf

Attributes#

Target.ADB_PORT_DEFAULT = 5037#
Target.CRITICAL_TASKS = {'android': ['sh', 'adbd', 'usb', 'transport', 'thermal-engine', 'watchdogd', 'rs.media.module'], 'linux': ['init', 'systemd[^-]', 'dbus', 'sh', 'ssh', 'rsyslogd', 'jbd2']}#

Dictionary mapping OS name to list of task names that we can’t afford to freeze when using freeze_userspace().

Target.INIT_KWARGS_KEY_MAP = {'device': ['device'], 'devlib_excluded_modules': ['devlib', 'excluded-modules'], 'devlib_file_xfer': ['devlib', 'file-xfer'], 'devlib_max_async': ['devlib', 'max-async'], 'host': ['host'], 'kernel_src': ['kernel', 'src'], 'keyfile': ['keyfile'], 'kind': ['kind'], 'kmod_build_env': ['kernel', 'modules'], 'lazy_platinfo': ['lazy-platinfo'], 'name': ['name'], 'password': ['password'], 'port': ['port'], 'strict_host_check': ['strict-host-check'], 'tools': ['tools'], 'username': ['username'], 'wait_boot': ['wait-boot', 'enable'], 'wait_boot_timeout': ['wait-boot', 'timeout'], 'workdir': ['workdir']}#

Dictionary of __init__ parameter names to configuration key path.

That path is a list of strings to take into account sublevels like ['level-key', 'sublevel', 'foo'].

Target.SSH_PORT_DEFAULT = 22#
Target.bl = None#

See devlib.module.biglittle.BigLittleModule

Target.cgroups = None#

See devlib.module.cgroups.CgroupsModule

Target.cpufreq = None#

See devlib.module.cpufreq.CpufreqModule

Target.cpuidle = None#

See devlib.module.cpuidle.Cpuidle

Target.devfreq = None#

See devlib.module.devfreq.DevfreqModule

Target.fastboot = None#

See devlib.module.android.FastbootFlashModule

Target.gem5stats = None#

See devlib.module.gem5stats.Gem5StatsModule

Target.gpufreq = None#

See devlib.module.gpufreq.GpufreqModule

Target.hotplug = None#

See devlib.module.hotplug.HotplugModule

Target.hwmon = None#

See devlib.module.hwmon.HwmonModule

Target.mbed_fan = None#

See devlib.module.cooling.MbedFanActiveCoolingModule

Target.odroidxu3_fan = None#

See devlib.module.cooling.OdroidXU3ctiveCoolingModule

Target.sched = None#

See devlib.module.sched.SchedModule

Target.thermal = None#

See devlib.module.thermal.ThermalModule

Target.default_modules = []#

Inherited attribute, see devlib.target.Target.default_modules

Target.ls_command = ''#

Inherited attribute, see devlib.target.AndroidTarget.ls_command

Target.os = None#

Inherited attribute, see devlib.target.Target.os

Target.path = None#

Inherited attribute, see devlib.target.Target.path

Target.system_id = None#

Inherited attribute, see devlib.target.Target.system_id

Properties#

property Target.abi#

Inherited property, see devlib.target.Target.abi

property Target.adb_name#

Inherited property, see devlib.target.AndroidTarget.adb_name

property Target.adb_port#

Inherited property, see devlib.target.AndroidTarget.adb_port

property Target.adb_server#

Inherited property, see devlib.target.AndroidTarget.adb_server

property Target.android_id#

Inherited property, see devlib.target.AndroidTarget.android_id

property Target.async_manager#

Inherited property, see devlib.target.Target.async_manager

property Target.big_core#

Inherited property, see devlib.target.Target.big_core

property Target.charging_enabled#

Inherited property, see devlib.target.AndroidTarget.charging_enabled

property Target.config#

Inherited property, see devlib.target.Target.config

property Target.conn#

Inherited property, see devlib.target.Target.conn

property Target.connected_as_root#

Inherited property, see devlib.target.Target.connected_as_root

property Target.core_clusters#

Inherited property, see devlib.target.Target.core_clusters

property Target.core_names#

Inherited property, see devlib.target.Target.core_names

property Target.cpuinfo#

Inherited property, see devlib.target.Target.cpuinfo

property Target.external_storage#

Inherited property, see devlib.target.AndroidTarget.external_storage

property Target.external_storage_app_dir#

Inherited property, see devlib.target.AndroidTarget.external_storage_app_dir

property Target.hostid#

Inherited property, see devlib.target.Target.hostid

property Target.hostname#

Inherited property, see devlib.target.Target.hostname

property Target.is_connected#

Inherited property, see devlib.target.Target.is_connected

property Target.is_rooted#

Inherited property, see devlib.target.Target.is_rooted

property Target.kernel_version#

Inherited property, see devlib.target.Target.kernel_version

property Target.list_nodes_cpus#

Inherited property, see devlib.target.Target.list_nodes_cpus

property Target.little_core#

Inherited property, see devlib.target.Target.little_core

property Target.logger#

Inherited property, see lisa.utils.Loggable.logger

Convenience short-hand for self.get_logger().

property Target.model#

Inherited property, see devlib.target.Target.model

property Target.modules#

Inherited property, see devlib.target.Target.modules

property Target.needs_su#

Inherited property, see devlib.target.Target.needs_su

property Target.number_of_cpus#

Inherited property, see devlib.target.Target.number_of_cpus

property Target.number_of_nodes#

Inherited property, see devlib.target.Target.number_of_nodes

property Target.os_version#

Inherited property, see devlib.target.Target.os_version

property Target.page_size_kb#

Inherited property, see devlib.target.Target.page_size_kb

property Target.screen_resolution#

Inherited property, see devlib.target.AndroidTarget.screen_resolution

property Target.shutils#

Inherited property, see devlib.target.Target.shutils

property Target.supported_abi#

Inherited property, see devlib.target.Target.supported_abi

property Target.user#

Inherited property, see devlib.target.Target.user

Methods#

Target.__dir__()[source]#

List our attributes plus the ones from the underlying target, and the devlib modules that could be loaded on-demand.

Target.__getattr__(attr)[source]#

Forward all non-overriden attributes/method accesses to the underlying devlib.target.Target.

Note

That will not forward special methods like __str__, since the interpreter bypasses __getattr__ when looking them up.

Note

Devlib modules are loaded on demand when accessed.

Target.__setstate__(dct)[source]#
Target.cached_pull(src, dst, key=None, **kwargs)[source]#

Same as lisa.target.Target.pull but will cache the file in the target.res_dir folder, based on the source path.

Parameters:

key (object or None) – Cache key to check against when deciding to pull the file : again. If None, the file will be pulled once in the lifetime of the Target instance it is called on.

Variable keyword arguments:

Forwarded to Target.pull.

Target.closing()[source]#

Returns a context manager that will disconnect the target automatically.

Target.disable_idle_states()[source]#

Context manager that lets you disable all idle states

Target.execute_python(f, args, kwargs, **execute_kwargs)[source]#

Executes the given Python function f with the provided positional and keyword arguments.

The return value or any exception is pickled back and is returned/raised in the host caller.

Variable keyword arguments:

Forwarded to execute() that will spawn the Python interpreter on the target

Note

Closure variables are supported, but mutating them will not be reflected in the caller’s context. Also, functions that are referred to will be:

  • bundled in the script if it is defined in the same module

  • referred to by name, assuming it comes from a module that is installed on the target and that this module is in scope. If that is not the case, a NameError will be raised.

Attention

Decorators are ignored and not applied.

Target.freeze_userspace()[source]#

Context manager that lets you freeze the userspace.

Note

A number of situations prevent from freezing anything. When that happens, a warning is logged but no exception is raised, so it’s a best-effort approach.

classmethod Target.from_cli(argv=None, params=None) Target[source]#

Same as from_custom_cli() without the custom parameters capabilities.

Returns:

A connected Target

classmethod Target.from_conf(conf: TargetConf, res_dir: ArtifactPath = None, plat_info: PlatformInfo = None, **kwargs) Target[source]#
classmethod Target.from_custom_cli(argv=None, params=None, description=None)[source]#

Create a Target from command line arguments.

Parameters:
  • argv (list(str)) – The list of arguments. sys.argv[1:] will be used if this is None.

  • params (dict(str, dict)) – Dictionary of custom parameters to add to the parser. It is in the form of {param_name: {dict of ArgumentParser.add_argument() options}}.

  • description (str or None) – Description passed to the argument parser. If None, a default one is provided.

Returns:

A tuple (args, target)

Note

This method should not be relied upon to implement long-term scripts, it’s more designed for quick scripting.

classmethod Target.from_default_conf()[source]#

Create a Target from the YAML configuration file pointed by LISA_CONF environment variable.

Note

Only load trusted YAML files as it can lead to abritrary code execution.

classmethod Target.from_one_conf(path)[source]#

Create a Target from a single YAML configuration file.

This file will be used to provide a TargetConf and lisa.platforms.platinfo.PlatformInfo instances.

Note

Only load trusted YAML files as it can lead to abritrary code execution.

Target.get_kmod(mod_cls=<class 'lisa._kmod.DynamicKmod'>, **kwargs)[source]#

Build a lisa._kmod.DynamicKmod instance of the given subclass.

Parameters:

mod_cls (type) – Subclass of lisa._kmod.DynamicKmod used to build the module.

Variable keyword arguments:

Forwarded to the from_target class method of mod_cls.

Target.get_res_dir(name=None, append_time=True, symlink=True)[source]#

Returns a directory managed by LISA to store results.

Usage of that function is reserved to interactive use or simple scripts. Tests should not rely on that as the created folder will not be tracked by any external entity, which means the results will be lost in some automated environment.

Parameters:
  • name (str) – Name of the results directory

  • append_time (bool) – If True, the current datetime will be appended to the given name. If name is None, the directory name will be the current datetime.

  • symlink (bool) – Create a symlink named results_latest to the newly created results directory

Target.get_tags()[source]#

Dictionary of tags and tag values.

Return type:

dict(str, object)

Target.install_tools(tools)[source]#

Install tools additional to those specified in the test config ‘tools’ field

Parameters:

tools (list(str)) – The list of names of tools to install

Target.is_module_available(module)[source]#

Check if the given devlib module is available.

Returns:

True if module is available, False otherwise.

Parameters:

module (str) – Devlib module to check.

Note

This will attempt to load the module if it’s not loaded already, and bail out if it fails to load.

Target.remote_func(**kwargs)[source]#

Decorates a given function to execute remotely using execute_python().

target = Target(...)

@target.remote_func(timeout=42)
def foo(x, y):
    return x + y

# Execute the function on the target transparently
val = foo(1, y=2)
Variable keyword arguments:

Forwarded to execute() that will spawn the Python interpreter on the target

async Target.__aenter__()#

Inherited method, see devlib.target.Target.__aenter__()

async Target.__aexit__()#

Inherited method, see devlib.target.Target.__aexit__()

Target.__enter__()#

Inherited method, see devlib.target.Target.__enter__()

Target.__exit__()#

Inherited method, see devlib.target.Target.__exit__()

Target.background()#

Inherited method, see devlib.target.Target.background()

Target.background_invoke()#

Inherited method, see devlib.target.Target.background_invoke()

Target.batch_revertable_write_value()#

Inherited method, see devlib.target.Target.batch_revertable_write_value()

Target.bin()#

Inherited method, see devlib.target.Target.bin()

Target.broadcast_media_mounted()#

Inherited method, see devlib.target.AndroidTarget.broadcast_media_mounted()

Target.broadcast_media_scan_file()#

Inherited method, see devlib.target.AndroidTarget.broadcast_media_scan_file()

Target.capture_screen()#

Inherited method, see devlib.target.Target.capture_screen()

Target.capture_ui_hierarchy()#

Inherited method, see devlib.target.AndroidTarget.capture_ui_hierarchy()

Target.check_connection()#

Inherited method, see devlib.target.Target.check_connection()

classmethod Target.check_init_param(**kwargs)#

Inherited method, see lisa.conf.Configurable.check_init_param()

Take the same parameters as __init__, and check their types according to what is specified in the configuration class.

Target.check_responsive()#

Inherited method, see devlib.target.Target.check_responsive()

Target.clear_logcat()#

Inherited method, see devlib.target.AndroidTarget.clear_logcat()

classmethod Target.conf_to_init_kwargs(conf)#

Inherited method, see lisa.conf.Configurable.conf_to_init_kwargs()

Turn a configuration object into a dictionary suitable for passing to __init__ as **kwargs.

Target.connect()#

Inherited method, see devlib.target.Target.connect()

Target.core_cpus()#

Inherited method, see devlib.target.Target.core_cpus()

Target.directory_exists()#

Inherited method, see devlib.target.Target.directory_exists()

Target.disconnect()#

Inherited method, see devlib.target.Target.disconnect()

Target.dump_logcat()#

Inherited method, see devlib.target.AndroidTarget.dump_logcat()

Target.ensure_screen_is_off()#

Inherited method, see devlib.target.AndroidTarget.ensure_screen_is_off()

Target.ensure_screen_is_on()#

Inherited method, see devlib.target.AndroidTarget.ensure_screen_is_on()

Target.ensure_screen_is_on_and_stays()#

Inherited method, see devlib.target.AndroidTarget.ensure_screen_is_on_and_stays()

Target.execute()#

Inherited method, see devlib.target.Target.execute()

Target.extract()#

Inherited method, see devlib.target.Target.extract()

Target.file_exists()#

Inherited method, see devlib.target.Target.file_exists()

Target.get_airplane_mode()#

Inherited method, see devlib.target.AndroidTarget.get_airplane_mode()

Target.get_auto_brightness()#

Inherited method, see devlib.target.AndroidTarget.get_auto_brightness()

Target.get_auto_rotation()#

Inherited method, see devlib.target.AndroidTarget.get_auto_rotation()

Target.get_brightness()#

Inherited method, see devlib.target.AndroidTarget.get_brightness()

Target.get_connection()#

Inherited method, see devlib.target.Target.get_connection()

Target.get_directory()#

Inherited method, see devlib.target.Target.get_directory()

Target.get_installed()#

Inherited method, see devlib.target.Target.get_installed()

Target.get_logcat_monitor()#

Inherited method, see devlib.target.AndroidTarget.get_logcat_monitor()

classmethod Target.get_logger(suffix=None)#

Inherited method, see lisa.utils.Loggable.get_logger()

Provides a logging.Logger named after cls.

Target.get_package_info()#

Inherited method, see devlib.target.AndroidTarget.get_package_info()

Target.get_package_version()#

Inherited method, see devlib.target.AndroidTarget.get_package_version()

Target.get_pids_of()#

Inherited method, see devlib.target.Target.get_pids_of()

Target.get_rotation()#

Inherited method, see devlib.target.AndroidTarget.get_rotation()

Target.get_screen_timeout()#

Inherited method, see devlib.target.AndroidTarget.get_screen_timeout()

Target.get_sdk_version()#

Inherited method, see devlib.target.AndroidTarget.get_sdk_version()

Target.get_stay_on_mode()#

Inherited method, see devlib.target.AndroidTarget.get_stay_on_mode()

Target.get_workpath()#

Inherited method, see devlib.target.Target.get_workpath()

Target.getenv()#

Inherited method, see devlib.target.Target.getenv()

Target.getprop()#

Inherited method, see devlib.target.AndroidTarget.getprop()

Target.grant_package_permission()#

Inherited method, see devlib.target.AndroidTarget.grant_package_permission()

Target.has()#

Inherited method, see devlib.target.Target.has()

Target.homescreen()#

Inherited method, see devlib.target.AndroidTarget.homescreen()

Target.input_swipe()#

Inherited method, see devlib.target.AndroidTarget.input_swipe()

Target.input_swipe_pct()#

Inherited method, see devlib.target.AndroidTarget.input_swipe_pct()

Target.input_tap()#

Inherited method, see devlib.target.AndroidTarget.input_tap()

Target.input_tap_pct()#

Inherited method, see devlib.target.AndroidTarget.input_tap_pct()

Target.insmod()#

Inherited method, see devlib.target.Target.insmod()

Target.install()#

Inherited method, see devlib.target.Target.install()

Target.install_apk()#

Inherited method, see devlib.target.AndroidTarget.install_apk()

Target.install_executable()#

Inherited method, see devlib.target.AndroidTarget.install_executable()

Target.install_if_needed()#

Inherited method, see devlib.target.Target.install_if_needed()

Target.install_module()#

Inherited method, see devlib.target.Target.install_module()

Target.invoke()#

Inherited method, see devlib.target.Target.invoke()

Target.is_installed()#

Inherited method, see devlib.target.Target.is_installed()

Target.is_network_connected()#

Inherited method, see devlib.target.Target.is_network_connected()

Target.is_running()#

Inherited method, see devlib.target.Target.is_running()

Target.is_screen_locked()#

Inherited method, see devlib.target.AndroidTarget.is_screen_locked()

Target.is_screen_on()#

Inherited method, see devlib.target.AndroidTarget.is_screen_on()

Target.kick_off()#

Inherited method, see devlib.target.Target.kick_off()

Target.kill()#

Inherited method, see devlib.target.Target.kill()

Target.killall()#

Inherited method, see devlib.target.Target.killall()

Target.list_directory()#

Inherited method, see devlib.target.Target.list_directory()

Target.list_file_systems()#

Inherited method, see devlib.target.Target.list_file_systems()

Target.list_offline_cpus()#

Inherited method, see devlib.target.Target.list_offline_cpus()

Target.list_online_cpus()#

Inherited method, see devlib.target.Target.list_online_cpus()

Target.list_packages()#

Inherited method, see devlib.target.AndroidTarget.list_packages()

classmethod Target.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.

Target.lsmod()#

Inherited method, see devlib.target.Target.lsmod()

Target.make_temp()#

Inherited method, see devlib.target.Target.make_temp()

Target.makedirs()#

Inherited method, see devlib.target.Target.makedirs()

Target.open_url()#

Inherited method, see devlib.target.AndroidTarget.open_url()

Target.package_is_installed()#

Inherited method, see devlib.target.AndroidTarget.package_is_installed()

Target.ps()#

Inherited method, see devlib.target.Target.ps()

Target.pull()#

Inherited method, see devlib.target.Target.pull()

Target.push()#

Inherited method, see devlib.target.Target.push()

Target.read_bool()#

Inherited method, see devlib.target.Target.read_bool()

Target.read_int()#

Inherited method, see devlib.target.Target.read_int()

Target.read_sysctl()#

Inherited method, see devlib.target.Target.read_sysctl()

Target.read_tree_tar_flat()#

Inherited method, see devlib.target.Target.read_tree_tar_flat()

Target.read_tree_values()#

Inherited method, see devlib.target.Target.read_tree_values()

Target.read_tree_values_flat()#

Inherited method, see devlib.target.Target.read_tree_values_flat()

Target.read_value()#

Inherited method, see devlib.target.Target.read_value()

Target.reboot()#

Inherited method, see devlib.target.Target.reboot()

Target.reboot_bootloader()#

Inherited method, see devlib.target.AndroidTarget.reboot_bootloader()

Target.refresh_files()#

Inherited method, see devlib.target.AndroidTarget.refresh_files()

Target.remove()#

Inherited method, see devlib.target.Target.remove()

Target.reset()#

Inherited method, see devlib.target.Target.reset()

Target.revertable_write_value()#

Inherited method, see devlib.target.Target.revertable_write_value()

Target.set_airplane_mode()#

Inherited method, see devlib.target.AndroidTarget.set_airplane_mode()

Target.set_auto_brightness()#

Inherited method, see devlib.target.AndroidTarget.set_auto_brightness()

Target.set_auto_rotation()#

Inherited method, see devlib.target.AndroidTarget.set_auto_rotation()

Target.set_brightness()#

Inherited method, see devlib.target.AndroidTarget.set_brightness()

Target.set_inverted_rotation()#

Inherited method, see devlib.target.AndroidTarget.set_inverted_rotation()

Target.set_left_rotation()#

Inherited method, see devlib.target.AndroidTarget.set_left_rotation()

Target.set_natural_rotation()#

Inherited method, see devlib.target.AndroidTarget.set_natural_rotation()

Target.set_right_rotation()#

Inherited method, see devlib.target.AndroidTarget.set_right_rotation()

Target.set_rotation()#

Inherited method, see devlib.target.AndroidTarget.set_rotation()

Target.set_screen_timeout()#

Inherited method, see devlib.target.AndroidTarget.set_screen_timeout()

Target.set_stay_on_mode()#

Inherited method, see devlib.target.AndroidTarget.set_stay_on_mode()

Target.set_stay_on_never()#

Inherited method, see devlib.target.AndroidTarget.set_stay_on_never()

Target.set_stay_on_while_powered()#

Inherited method, see devlib.target.AndroidTarget.set_stay_on_while_powered()

Target.setup()#

Inherited method, see devlib.target.Target.setup()

Target.sleep()#

Inherited method, see devlib.target.Target.sleep()

Target.swipe_to_unlock()#

Inherited method, see devlib.target.AndroidTarget.swipe_to_unlock()

Target.tempfile()#

Inherited method, see devlib.target.Target.tempfile()

Target.uninstall()#

Inherited method, see devlib.target.Target.uninstall()

Target.uninstall_executable()#

Inherited method, see devlib.target.AndroidTarget.uninstall_executable()

Target.uninstall_package()#

Inherited method, see devlib.target.AndroidTarget.uninstall_package()

Target.wait_boot_complete()#

Inherited method, see devlib.target.Target.wait_boot_complete()

Target.wait_for_device()#

Inherited method, see devlib.target.AndroidTarget.wait_for_device()

Target.which()#

Inherited method, see devlib.target.Target.which()

Target.write_value()#

Inherited method, see devlib.target.Target.write_value()