1
0
mirror of https://github.com/ARM-software/devlib.git synced 2024-10-06 02:40:50 +01:00
Commit Graph

135 Commits

Author SHA1 Message Date
Sergei Trofimov
ca0b6e88a1 AndroidTarget: fixed kick_off()
kick_off relies on nohup, which may not work properly unless the command
for it is  explicitly backgrounded with "&", which was not being done in
the AndroidTarget implementation of kick_off().
2016-08-30 14:27:16 +01:00
setrofim
c307ffab15 Merge pull request #56 from derkling/cgroups-isolation-and-freeze
Add support for CPUs isolation and tasks freezing
2016-08-30 09:14:39 +01:00
Patrick Bellasi
23ad61fcae cgroups: add support for tasks freezing
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-08-26 18:27:08 +01:00
Patrick Bellasi
75a086d77a cgroups: add support for CPUs isolation
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-08-26 18:27:08 +01:00
Patrick Bellasi
21d18f8b78 cgroups: fix support to filter tasks to move into a specified CGroup
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-08-26 18:20:11 +01:00
Patrick Bellasi
3cab786d03 cgroups: use shutils for move_tasks
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-08-26 18:17:32 +01:00
Patrick Bellasi
d8ae3aba1a cgroups: add couple of methods to return the tasks of a CGroup
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-08-26 18:17:32 +01:00
Patrick Bellasi
42efd0a2e2 cgroups: add support list tasks in a specified CGroup
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-08-26 18:15:41 +01:00
Patrick Bellasi
83c1312b22 shutils: ensure we use "cat" version provided by Busybox
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-08-26 16:12:23 +01:00
setrofim
b9a16982d8 Merge pull request #53 from mdigiorgio/fix-cgroups_get_states
cgroups: fix get_states() return value when passing integer state
2016-08-01 10:46:24 +01:00
Michele Di Giorgio
f9cb932d9c cgroups: fix get_states() return value when passing integer state
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>
2016-08-01 10:41:38 +01:00
setrofim
0c8f26763b Merge pull request #49 from derkling/fix-adb-connect
android: avoid connect for USB target
2016-07-29 16:09:17 +01:00
setrofim
2d496486bf Merge pull request #52 from garethstockwell/master
TelnetConnection: support for systems which do not prompt for a password
2016-07-29 16:08:30 +01:00
Gareth Stockwell
f24493676c TelnetConnection: allow username and/or password to be optional
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.
2016-07-29 14:52:52 +00:00
Gareth Stockwell
76b059c6b1 TelnetConnection: allow client to specify the original prompt string 2016-07-29 14:52:52 +00:00
setrofim
baab8ab131 Merge pull request #51 from ep1cman/master
TelnetConnection: Added the ability to specify connection port
2016-07-29 15:21:26 +01:00
Sebastian Goscik
73f2e28a06 TelnetConnection: Added the ability to specify connection port 2016-07-29 15:14:41 +01:00
Patrick Bellasi
f714dd39f1 android: avoid connect for USB target
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>
2016-07-15 11:18:09 +01:00
Sergei Trofimov
c4784e0993 Added documentation for Target.extract() 2016-07-14 11:15:08 +01:00
Sergei Trofimov
baaa67bfcc target: added extract() method
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.
2016-07-14 11:07:19 +01:00
setrofim
17692891ef Merge pull request #46 from JaviMerino/needs_su
devlib: don't use sudo/su if you are root
2016-06-24 09:18:01 +01:00
Javi Merino
16d87c6924 devlib: don't use sudo/su if you are root
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.
2016-06-23 14:55:19 +01:00
setrofim
fa20e7c28d Merge pull request #45 from mdigiorgio/improve-memoize
Improve memoize decorator
2016-06-23 11:13:36 +01:00
Michele Di Giorgio
539e9b34b9 devlib/utils/misc: improve memoize decorator
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>
2016-06-23 09:51:47 +01:00
setrofim
ee521f64e6 Merge pull request #42 from ep1cman/fixes
LinuxTarget: now used 'uname' instead of 'busybox uname'
2016-06-16 14:50:49 +01:00
Sebastian Goscik
5880f6e9ef LinuxTarget: now used 'uname' instead of 'busybox uname'
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.
2016-06-16 13:56:13 +01:00
setrofim
cf791d1e64 Merge pull request #35 from derkling/cgroup-fix-setup
Cgroup fix setup
2016-05-27 16:39:50 +01:00
setrofim
bbee251547 Merge pull request #39 from ep1cman/fixes
AndroidDevice: kick-off no longer requires root
2016-05-27 16:37:55 +01:00
Sebastian Goscik
9af32ec485 AndroidDevice: kick-off no longer requires root
kick off will now use root if the device is rooted or if manually
specified otherwise its run without root.
2016-05-27 16:36:45 +01:00
Sergei Trofimov
89256fd408 connetion: fixing None timeout issue
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
2016-05-17 14:00:01 +01:00
Patrick Bellasi
616f229949 cgroups: requires initialization after the "setup" stage
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>
2016-05-13 18:17:22 +01:00
Patrick Bellasi
c4e46b7c26 target: add a "setup" stage for modules initialisation
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>
2016-05-13 18:15:51 +01:00
setrofim
1dc1e1364c Merge pull request #28 from msrasmussen/patch-1
Fix typos in overview documentation
2016-04-27 11:01:42 +01:00
setrofim
232204633f Merge pull request #33 from derkling/fix-cgroups-noprefix
Fix cgroups noprefix
2016-04-27 08:55:18 +01:00
Patrick Bellasi
4b58c573a5 cgroups: make probe method more robust
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>
2016-04-26 16:38:30 +01:00
Patrick Bellasi
3acf5d56df cgroups: run some commands with root permissions
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>
2016-04-26 16:38:30 +01:00
Patrick Bellasi
96392fd6b5 cgroups: fix run_into shutils
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.
2016-04-26 16:38:30 +01:00
Patrick Bellasi
c976189444 cgroups: fix get attributes for controller noprefix mounted
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>
2016-04-26 16:38:28 +01:00
Patrick Bellasi
658005a178 cgroups: properly format attributes path and check for being supported
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>
2016-04-26 16:38:25 +01:00
Patrick Bellasi
15f9c03b45 cgroups: keep track if a controller is mounted with noprefix option
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>
2016-04-26 16:38:21 +01:00
Patrick Bellasi
28739397c0 cgroups: add a couple of functions to move tasks among groups
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>
2016-04-22 11:43:49 +01:00
setrofim
741157c000 Merge pull request #31 from derkling/fix-newline-separator
fix: AdbConnection: added automatic detection of new line separators
2016-03-29 09:26:06 +01:00
Patrick Bellasi
c2329bd80e fix: AdbConnection: added automatic detection of new line separators
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>
2016-03-28 12:29:45 +01:00
setrofim
10978b0fd7 Merge pull request #29 from ep1cman/fixes
AdbConnection: added automatic detection of new line separators
2016-03-23 15:20:58 +00:00
Sebastian Goscik
8de24b5601 AdbConnection: added automatic detection of new line separators 2016-03-23 15:10:26 +00:00
Morten Rasmussen
192fb52cae Fix typos in overview documentation 2016-03-21 15:15:26 +00:00
Sergei Trofimov
6bda8cb867 AndroidTarget: do not set executables_directory inside __init__
This is already being resolved inside the base's __init__.
2016-03-04 18:34:09 +00:00
setrofim
91f4f97a0b Merge pull request #25 from mdigiorgio/bg-as_root
ssh: add possibility to run command in background as root
2016-03-01 14:37:51 +00:00
Michele Di Giorgio
3bf3017f85 ssh: add possibility to run command in background as root
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>
2016-03-01 11:12:10 +00:00
setrofim
95aaa2662e Merge pull request #17 from derkling/ftrace_optional_confs
FTrace: optional function and events
2016-02-26 08:23:46 +00:00