When passing an idle state ID to get_states(), nothing is returned. Also, there
is a wrong call to enable() in the method.
Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com>
If username is set to None, no '-l' option is appended to the telnet command.
If password is set to None, devlib does not wait for a password prompt when
connecting.
The "adb connect" command is not required for USB connected devices.
This patch is a small update to use "adb connect" only for android devices
accessed by IP address.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Added a method for extracting compressed on-target files and archives.
The method extacts the specified on-target path (the method is based on
the extension) and return the path to extracted content.
Most invocations of target.execute() pass as_root=self.is_rooted .
However, is_rooted is not what you want to do here. as_root tells the
connection to wrap the command around sudo/su to execute the command as
root. is_rooted returns True if the device can run commands as
root (for example, if we are connected as root). If you are already
connected as root, there is no need to wrap the command around sudo, you
are already root. In that case, as_root should always be false.
Define a new property for the target called needs_su that returns true
if the target needs to run a command to get superuser privileges.
Using the wrapt module we can improve the memoize decorator. In fact, it allows
to preserve the attributes of the memoized function, such as signature,
docstring, path to the file where the function is implemented, and so on.
Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com>
To install busybox we need to know the ABI of the device to push the
correct binary but to know the ABI we need busybox.
Since uname is part of the POSIX standard and this issue only effects
the LinuxTarget (AndroidTarget gets this from build.prop) it is safe
to assume all LinuxTargets should have uname.
Connection objects set timeout to a default value in case a timeout is
not specified. However, Target defaults timeout to None and passes that
to connection, overridng the default.
This commit ensures that default timeout remains set if calling code
specified timemout as None.
Fix for issue
https://github.com/ARM-software/devlib/issues/34
The cgroups module requires busybox and shutil to properly initialise.
This patch required the module to be initialized once the setup has
completed.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Some modules could requires assets available on a target before being
initialised. For example, the cgroups module requires busybox and shutil
to properly initialise.
This patch adds a new stage to Target which allows to post-pone the
initialisation of some modules till Target.setup() has been executed.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
In case a target does not report a configuration file, we can still check
the user-space API to verify it CGroups are supported.
NOTE: a rooted target is still a mandatory requirement because some commands
are still dependant on the possibility to run them with root permissions.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Certain commands requires in general root permissions to be properly
executed (for example on an Android target).
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
On some targets the run_into function is not passing all params to the
called application. This patch should fix that using shift to get a list
of all command parameters.
Moreovere, we use now exec to spawn the command execution, which avoids to
generate yet another shell to run the required command.
CGroups controller can be mounted by specifying a "noprefix" option,
in which case attribute names are named as:
<mountpoint>/<attribute_name>
instead of the (more recent) naming schema using:
<mountpoint>/<contoller_name>.<attribute_name>
For example, Android uses the old format for backward compatibility
with user-space. Thus, it's possible in general to work on a target
system where some controller are mounted "noprefix" while others not.
This patchset adds a set of updates which allows to use the proper
attributes naming schema based on how the controller has been mounted.
This patch provides a more generic implementation of the get attributes
shutils which is working also for noprefix mounted controllers.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
CGroups controller can be mounted by specifying a "noprefix" option,
in which case attribute names are named as:
<mountpoint>/<attribute_name>
instead of the (more recent) naming schema using:
<mountpoint>/<contoller_name>.<attribute_name>
For example, Android uses the old format for backward compatibility
with user-space. Thus, it's possible in general to work on a target
system where some controller are mounted "noprefix" while others not.
This patchset adds a set of updates which allows to use the proper
attributes naming schema based on how the controller has been mounted.
This patch makes use of the Controller::_noprefix option to properly
build the attribute path. It adds also a check which reports a more
clear error in case an attribute is set which is not provided by the
controller.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
CGroups controller can be mounted by specifying a "noprefix" option,
in which case attribute names are named as:
<mountpoint>/<attribute_name>
instead of the (more recent) naming schema using:
<mountpoint>/<contoller_name>.<attribute_name>
For example, Android uses the old format for backward compatibility
with user-space. Thus, it's possible in general to work on a target
system where some controller are mounted "noprefix" while others not.
This patchset adds a set of updates which allows to use the proper
attributes naming schema based on how the controller has been mounted.
This first patch keeps track of whatever a controller has been mounted
using the noprefix option.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This patch provides a couple of utility functions which makes it
easy to run a command under a specific CGroup or to move all tasks
from a group to another.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
The newline separator is a property of AdbConnection while the adb_shell is
just a method of the android module, thus we do not have a "self" pointer
to and AdbConnection from within the adb_shell function.
This patch fixes 8de24b5 by exposing the newline_separator used by adb_shell
as a parameter of that method and using the AdbConnection::newline_separator
to properly initialize it at executue() time.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Executing a command as root was not possible when running it in background.
This is done in a similar way as with a standard execute call.
This was also a bug in ssh.py because if you tried to run a background command
on the target, the background function in target.py was passing the as_root
parameter which was not present in ssh.py.
Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com>
The info statements are clobbering the "normal" output of devlib users.
This patch demote the logging to debug level. The user can still
log-report these information from the corresponding functions call site.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This is the only info statement which is thus clobbering the "normal"
output of a client ueser for that devlib. This patch demote the logging
to debug level. The user can still log-report the output file which is also
an input parameter.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
In general we could be interested to define a common configuration to use
across different kernels. Thus, for a given set of experiments, some
trace events can be present only on some kernels and not others.
This patch introduces a check for the availability of trace events by
ensuring that we consider only those available in the kernel in use
in the target. In case of a trace event is not supported in the target
kernel we still log a warning.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>