wlauto.common.linux package

Submodules

wlauto.common.linux.device module

class wlauto.common.linux.device.BaseLinuxDevice(**kwargs)[source]

Bases: wlauto.core.device.Device

abi
aliases = AC([])
artifacts = AC([])
core_modules = []
cpuinfo
deploy_busybox(context, force=False)[source]

Deploys the busybox binary to the specified device and returns the path to the binary on the device.

Parameters:
  • context – an instance of ExecutionContext
  • force – by default, if the binary is already present on the device, it will not be deployed again. Setting force to True overrides that behavior and ensures that the binary is always copied. Defaults to False.
Returns:

The on-device path to the busybox binary.

disable_cpu(cpu)[source]

Disable the specified core.

Parameters:cpu – CPU core to disable. This must be the full name as it appears in sysfs, e.g. “cpu0”.
dynamic_modules = AC(["{'devcpufreq': {}}", "{'cpuidle': {}}"])
enable_cpu(cpu)[source]

Enable the specified core.

Parameters:cpu – CPU core to enable. This must be the full name as it appears in sysfs, e.g. “cpu0”.
file_transfer_cache
finalize(*args, **kwargs)
get_binary_path(name, search_system_binaries=True)[source]

Searches the devices binary_directory for the given binary, if it cant find it there it tries using which to find it.

Parameters:
  • name – The name of the binary
  • search_system_binaries – By default this function will try using which to find the binary if it isn’t in binary_directory. When this is set to False it will not try this.
Returns:

The on-device path to the binary.

get_device_model()[source]
get_number_of_online_cores(core)[source]
get_online_cpus(c)[source]
get_pids_of(process_name)[source]
get_properties(context)[source]
get_sysfile_value(sysfile, kind=None, binary=False)[source]

Get the contents of the specified sysfile.

Parameters:
  • sysfile – The file who’s contents will be returned.
  • kind – The type of value to be expected in the sysfile. This can be any Python callable that takes a single str argument. If not specified or is None, the contents will be returned as a string.
  • binary – Whether the value should be encoded into base64 for reading to deal with binary format.
get_sysfile_values()[source]

Returns a dict mapping paths of sysfiles that were previously set to their current values.

has_gpu = True
hotplug_cpu(cpu, online)[source]

Hotplug the specified CPU either on or off. See https://www.kernel.org/doc/Documentation/cpu-hotplug.txt

Parameters:
  • cpu – The CPU for which the governor is to be set. This must be the full name as it appears in sysfs, e.g. “cpu0”.
  • online – CPU will be enabled if this value bool()’s to True, and will be disabled otherwise.
initialize(*args, **kwargs)
install_if_needed(host_path, search_system_binaries=True)[source]

Similar to get_binary_path but will install the binary if not found.

Parameters:
  • host_path – The path to the binary on the host
  • search_system_binaries – By default this function will try using which to find the binary if it isn’t in binary_directory. When this is set to False it will not try this.
Returns:

The on-device path to the binary.

invoke(binary, args=None, in_directory=None, on_cpus=None, background=False, as_root=False, timeout=30)[source]

Executes the specified binary under the specified conditions.

Binary:binary to execute. Must be present and executable on the device.
Args:arguments to be passed to the binary. The can be either a list or a string.
In_directory:execute the binary in the specified directory. This must be an absolute path.
On_cpus:taskset the binary to these CPUs. This may be a single int (in which case, it will be interpreted as the mask), a list of ints, in which case this will be interpreted as the list of cpus, or string, which will be interpreted as a comma-separated list of cpu ranges, e.g. "0,4-7".
Background:If True, a subprocess.Popen object will be returned straight away. If False (the default), this will wait for the command to terminate and return the STDOUT output
As_root:Specify whether the command should be run as root
Timeout:If the invocation does not terminate within this number of seconds, a TimeoutError exception will be raised. Set to None if the invocation should not timeout.
is_directory(filepath)[source]
is_file(filepath)[source]
is_installed(name)[source]
is_network_connected()[source]

Checks for internet connectivity on the device by pinging IP address provided.

Parameters:ip_address – IP address to ping. Default is Google’s public DNS server (8.8.8.8)
Returns:True if internet is available, False otherwise.
kill(pid, signal=None, as_root=False)[source]

Kill the specified process.

param pid:PID of the process to kill.
param signal:Specify which singal to send to the process. This must be a valid value for -s option of kill. Defaults to None.

Modified in version 2.1.4: added signal parameter.

killall(process_name, signal=None, as_root=None)[source]

Kill all processes with the specified name.

param process_name:
 The name of the process(es) to kill.
param signal:Specify which singal to send to the process. This must be a valid value for -s option of kill. Defaults to None.

Modified in version 2.1.5: added as_root parameter.

list_file_systems()[source]
number_of_cores

Added in version 2.1.4.

online_cpus
parameters = AC(["Param({'kind': <type 'list'>, 'mandatory': None, 'name': 'modules', 'constraint': None, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <class 'wlauto.utils.types.list_of_caseless_strings'>, 'mandatory': True, 'name': 'core_names', 'constraint': None, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <function list_of_ints>, 'mandatory': True, 'name': 'core_clusters', 'constraint': None, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <type 'str'>, 'mandatory': None, 'name': 'scheduler', 'constraint': None, 'default': 'unknown', 'allowed_values': ['unknown', 'smp', 'hmp', 'iks', 'ea', 'other'], 'global_alias': None, 'override': False})", "Param({'kind': <function integer>, 'mandatory': None, 'name': 'iks_switch_frequency', 'constraint': None, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <function list_of_strs>, 'mandatory': None, 'name': 'property_files', 'constraint': None, 'default': ['/etc/arch-release', '/etc/debian_version', '/etc/lsb-release', '/proc/config.gz', '/proc/cmdline', '/proc/cpuinfo', '/proc/version', '/proc/zconfig', '/sys/kernel/debug/sched_features', '/sys/kernel/hmp'], 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <type 'str'>, 'mandatory': None, 'name': 'binaries_directory', 'constraint': None, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <type 'str'>, 'mandatory': None, 'name': 'working_directory', 'constraint': None, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False})"])
path_module = 'posixpath'
ps(**kwargs)[source]
resource_cache
runtime_parameters = AC(['sysfile_values', '${core}_cores', '${core}_min_frequency', '${core}_max_frequency', '${core}_frequency', '${core}_governor', '${core}_governor_tunables'])
set_number_of_online_cores(core, number)[source]
set_sysfile_value(sysfile, value, verify=True, binary=False)[source]

Set the value of the specified sysfile. By default, the value will be checked afterwards. Can be overridden by setting verify parameter to False. By default binary values will not be written correctly this can be changed by setting the binary parameter to True.

set_sysfile_values(params)[source]

The plural version of set_sysfile_value. Takes a single parameter which is a mapping of file paths to values to be set. By default, every value written will be verified. This can be disabled for individual paths by appending '!' to them. To enable values being written as binary data, a '^' can be prefixed to the path.

supported_abi
validate(*args, **kwargs)
class wlauto.common.linux.device.FstabEntry(device, mount_point, fs_type, options, dump_freq, pass_num)

Bases: tuple

device

Alias for field number 0

dump_freq

Alias for field number 4

fs_type

Alias for field number 2

mount_point

Alias for field number 1

options

Alias for field number 3

pass_num

Alias for field number 5

class wlauto.common.linux.device.LinuxDevice(*args, **kwargs)[source]

Bases: wlauto.common.linux.device.BaseLinuxDevice

aliases = AC([])
artifacts = AC([])
boot(hard=False, **kwargs)[source]
capture_screen(filepath)[source]
connect()[source]
core_modules = []
default_timeout = 30
delay = 2
delete_file(filepath, as_root=False)[source]
disconnect()[source]
dynamic_modules = AC(["{'devcpufreq': {}}", "{'cpuidle': {}}"])
ensure_screen_is_on()[source]
execute(command, timeout=30, check_exit_code=True, background=False, as_root=False, strip_colors=True, **kwargs)[source]

Execute the specified command on the device using adb.

Parameters:

param command:

The command to be executed. It should appear exactly as if you were typing it into a shell.

param timeout:

Time, in seconds, to wait for adb to return before aborting and raising an error. Defaults to AndroidDevice.default_timeout.

param check_exit_code:
 

If True, the return code of the command on the Device will be check and exception will be raised if it is not 0. Defaults to True.

param background:
 

If True, will execute create a new ssh shell rather than using the default session and will return it immediately. If this is True, timeout, strip_colors and (obvisously) check_exit_code will be ignored; also, with this, as_root=True is only valid if username for the device was set to root.

param as_root:

If True, will attempt to execute command in privileged mode. The device must be rooted, otherwise an error will be raised. Defaults to False.

Added in version 2.1.3

Returns:If background parameter is set to True, the subprocess object will be returned; otherwise, the contents of STDOUT from the device will be returned.
file_exists(filepath)[source]
finalize(*args, **kwargs)
get_pids_of(process_name)[source]

Returns a list of PIDs of all processes with the specified name.

hard_reset()[source]
initialize(*args, **kwargs)
insmod(path)[source]

Install a kernel module located on the host on the target device.

install(filepath, timeout=30, with_name=None)[source]
install_executable(filepath, timeout=30, with_name=None)
is_rooted
is_screen_on()[source]
kick_off(command, as_root=None)[source]

Like execute but closes ssh session and returns immediately, leaving the command running on the device (this is different from execute(background=True) which keeps ssh connection open and returns a subprocess object).

listdir(path, as_root=False, **kwargs)[source]
long_delay = 6
lsmod()[source]

List loaded kernel modules.

parameters = AC(["Param({'kind': <type 'list'>, 'mandatory': None, 'name': 'modules', 'constraint': None, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <class 'wlauto.utils.types.list_of_caseless_strings'>, 'mandatory': True, 'name': 'core_names', 'constraint': None, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <function list_of_ints>, 'mandatory': True, 'name': 'core_clusters', 'constraint': None, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <type 'str'>, 'mandatory': None, 'name': 'scheduler', 'constraint': None, 'default': 'unknown', 'allowed_values': ['unknown', 'smp', 'hmp', 'iks', 'ea', 'other'], 'global_alias': None, 'override': False})", "Param({'kind': <function integer>, 'mandatory': None, 'name': 'iks_switch_frequency', 'constraint': None, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <function list_of_strs>, 'mandatory': None, 'name': 'property_files', 'constraint': None, 'default': ['/etc/arch-release', '/etc/debian_version', '/etc/lsb-release', '/proc/config.gz', '/proc/cmdline', '/proc/cpuinfo', '/proc/version', '/proc/zconfig', '/sys/kernel/debug/sched_features', '/sys/kernel/hmp'], 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <type 'str'>, 'mandatory': None, 'name': 'binaries_directory', 'constraint': None, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <type 'str'>, 'mandatory': None, 'name': 'working_directory', 'constraint': None, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <type 'str'>, 'mandatory': True, 'name': 'host', 'constraint': None, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <type 'str'>, 'mandatory': True, 'name': 'username', 'constraint': None, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <type 'str'>, 'mandatory': None, 'name': 'password', 'constraint': None, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <type 'str'>, 'mandatory': None, 'name': 'keyfile', 'constraint': None, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <function integer>, 'mandatory': None, 'name': 'port', 'constraint': None, 'default': 22, 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <type 'str'>, 'mandatory': None, 'name': 'password_prompt', 'constraint': None, 'default': '[sudo] password', 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <function boolean>, 'mandatory': None, 'name': 'use_telnet', 'constraint': None, 'default': False, 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <function integer>, 'mandatory': None, 'name': 'boot_timeout', 'constraint': None, 'default': 120, 'allowed_values': None, 'global_alias': None, 'override': False})"])
ping()[source]
platform = 'linux'
ps(**kwargs)[source]
pull_file(source, dest, as_root=False, timeout=30)[source]
push_file(source, dest, as_root=False, timeout=30)[source]
ready_timeout = 60
reset()[source]
runtime_parameters = AC(['sysfile_values', '${core}_cores', '${core}_min_frequency', '${core}_max_frequency', '${core}_frequency', '${core}_governor', '${core}_governor_tunables'])
uninstall(executable_name)[source]
uninstall_executable(executable_name)
validate(*args, **kwargs)
class wlauto.common.linux.device.LsmodEntry(name, size, use_count, used_by)

Bases: tuple

name

Alias for field number 0

size

Alias for field number 1

use_count

Alias for field number 2

used_by

Alias for field number 3

class wlauto.common.linux.device.PsEntry(user, pid, ppid, vsize, rss, wchan, pc, state, name)

Bases: tuple

name

Alias for field number 8

pc

Alias for field number 6

pid

Alias for field number 1

ppid

Alias for field number 2

rss

Alias for field number 4

state

Alias for field number 7

user

Alias for field number 0

vsize

Alias for field number 3

wchan

Alias for field number 5

wlauto.common.linux.workload module

class wlauto.common.linux.workload.ReventWorkload(device, _call_super=True, **kwargs)[source]

Bases: wlauto.core.workload.Workload

aliases = AC([])
artifacts = AC([])
core_modules = []
description = "\n A workload for playing back revent recordings. You can supply three\n different files:\n \n 1. {device_model}.setup.revent\n 2. {device_model}.run.revent\n 3. {device_model}.teardown.revent\n\n You may generate these files using the wa record command using the -s flag\n to specify the stage (``setup``, ``run``, ``teardown``)\n\n You may also supply an 'idle_time' in seconds in place of the run file.\n The ``run`` file may only be omitted if you choose to run this way, but\n while running idle may supply ``setup`` and ``teardown`` files.\n\n To use a ``setup`` or ``teardown`` file set the setup_required and/or\n teardown_required class attributes to True (default: False).\n\n N.B. This is the default description. You may overwrite this for your\n workload to include more specific information.\n\n "
finalize(*args, **kwargs)
initialize(*args, **kwargs)
parameters = AC(["Param({'kind': <type 'list'>, 'mandatory': None, 'name': 'modules', 'constraint': None, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False})", "Param({'kind': <function integer>, 'mandatory': None, 'name': 'idle_time', 'constraint': None, 'default': None, 'allowed_values': None, 'global_alias': None, 'override': False})"])
run(context)[source]
setup(context)[source]
setup_required = False
teardown(context)[source]
teardown_required = False
update_result(context)[source]
validate(*args, **kwargs)

Module contents