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

228 Commits

Author SHA1 Message Date
setrofim
b7ac9e7edc Merge pull request #89 from derkling/android-support-updates
Android support updates
2017-02-16 15:21:08 +00:00
Brendan Jackman
baa32ec716 AndroidTarget: Add charging_enabled property
Disabling battery charging can be useful for measuring power efficiency of
Android devices with hardware modified for this purpose.
2017-02-16 15:09:44 +00:00
Patrick Bellasi
9ce57c0875 AndroidTarget: add support to reboot a device via ADB
This adds a couple of commodity ADB commands to reboot in bootloader
mode and to restart ADB in root mode.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2017-02-16 15:07:18 +00:00
Patrick Bellasi
da588ea091 android: allow to specify a target for fastboot commands
ADB commands always expect a device ID as first parameter, here
unfortunately we need to pass it as an optional one to avoid breaking
existing clients.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2017-02-16 13:08:31 +00:00
setrofim
9d5b1062dd Merge pull request #88 from bjackman/localconnection-platform-param
LocalConnection: Add ignored `platform` param to __init__ method
2017-02-14 12:05:26 +00:00
Brendan Jackman
680406bc37 LocalConnection: Add ignored platform param to __init__ method
This parameter is used by the other connection classes and as of
21f40035d7 ("gem5: Small tweaks in target to allow gem5 simulations") is
passed by to the connection class constructor via expansion of
Target.connection_settings (see Target.get_connection)
2017-02-14 11:30:32 +00:00
Sergei Trofimov
28891a822b utils/misc: walk_modules always raises HostError
Previously, if an error had occured while attempting to load a module
during walk_modules, it was propagated to the loading code. This
meant that walk_modules could, in theory, raise any exception at all,
and that it was not always possible to tell exactly where the exception
originated.

Now, all encounted errors are re-raised as HostError, which preserves
the original exception in an attribute and sets "modpath" attribute to
point to the module that originated it.
2017-02-08 11:30:33 +00:00
Sergei Trofimov
a9265031ba TimeoutError: moved to devlib.exception
Moved TimeoutError from devlib.util.misc to devlib.exception. It was
previously defined in misc because it needed to be there when the code
was part of WA in order to prevent an import cycle. This is not
necessary in devlib, so it is moved to be with the other exception
definitions.
2017-02-08 11:29:42 +00:00
marcbonnici
8abdfdc1ef Merge pull request #83 from avanlaer/gem5_integration
Gem5 integration
2017-02-08 11:24:44 +00:00
Anouk Van Laer
a02d68decd gem5: Updated the documentation on the use of gem5 in devlib
modified:   doc/connection.rst
	modified:   doc/index.rst
	modified:   doc/platform.rst
2017-02-08 11:16:23 +00:00
Anouk Van Laer
c6b77432ba gem5: Addition of m5 binaries
The m5 binary allows the user to interact with gem5 simulation (e.g. reset stats).
See www.m5sim.org/M5ops for more information

 Changes to be committed:
	new file:   devlib/bin/arm64/m5
	new file:   devlib/bin/armeabi/m5
2017-02-08 11:12:18 +00:00
Anouk Van Laer
21f40035d7 gem5: Small tweaks in target to allow gem5 simulations
The target knows as little as possible about gem5 as a platform
but these tweaks add gem5 as a valid platform.

	modified:   devlib/target.py
2017-02-08 11:12:18 +00:00
Anouk Van Laer
e9cf93e754 gem5: Addition of gem5 simulation platform
This commit adds a gem5 simulation platform. The platform is responsible for starting the gem5 simulation.

 Changes to be committed:
	modified:   devlib/__init__.py
	modified:   devlib/platform/__init__.py
	new file:   devlib/platform/gem5.py
2017-02-08 11:12:17 +00:00
Anouk Van Laer
29a7940731 gem5: Addition of a gem5 connection
This is the first in a series of commits to allow for the use of gem5 as a target in devlib.
The interaction with the gem5 simulation is done by the Gem5Connection, a type of TelnetConnection.
There are two types of Gem5Connections (Linux and Android) as they differ slightly in the implementation
of some methods. Other types of connections have only been changed to make them uniform (e.g. arguments for init method)

 Changes to be committed:
	modified:   devlib/__init__.py
	modified:   devlib/host.py
	modified:   devlib/utils/android.py
	modified:   devlib/utils/ssh.py
2017-02-08 11:12:17 +00:00
setrofim
5472b671ef Merge pull request #87 from bjackman/localconnection-glob
Enhancements for LocalConnection
2017-02-01 08:50:38 +00:00
Brendan Jackman
179e45f98e LocalConnection: Enrich TargetError message from execute method
Add exit code, command, and output to TargetError exception message when execute
fails. This brings LocalConnection into line with AdbConnection and
SshConnection.
2017-01-31 19:21:11 +00:00
Brendan Jackman
b587049eb9 LocalConnection: Support glob patterns in pull 2017-01-31 18:38:03 +00:00
Brendan Jackman
1cb4eb2285 doc/connection: Document the fact that pull supports globs
This feature is supported implicitly by SshConnection and explicitly by
AdbConnection. A subsequent commit implements it for LocalConnection.
2017-01-31 18:38:00 +00:00
Sergei Trofimov
6351a3bad9 Target.killall: catch TargetError on individual kills
killall() is implemented by discovering all PIDs who's name matches the
specified process, and then sending individual kills for each PID. If a
PID no longer exists by the time the kill is sent (e.g. if it was a
child of one of the previously killed PIDs), this will result in a
TargetError, which for the purposes of killall() should be ignored.
2017-01-30 11:14:36 +00:00
Brendan Jackman
adedad8e32 doc/connection: Fix missing word 2017-01-27 19:32:02 +00:00
setrofim
9038339373 Merge pull request #86 from bjackman/adb-exit-code-fix
android: Handle variation in ADB behaviour
2017-01-25 15:58:38 +00:00
Brendan Jackman
44fe0370f8 android: Handle variation in ADB behaviour
On older combinations of ADB/Android versions, the adb host command always
exits with 0 if it was able to run the command on the target, even if the
command failed (https://code.google.com/p/android/issues/detail?id=3254).

When we need the target's exit code (check_exit_code=True), we currently work
around this behaviour by echoing the target's exit code after the command and
parsing it out of the output.

The ADB behaviour is now "fixed" on newer versions with newer Androids (It's not
clear which versions these are and it appears that different builds of ADB with
the same version number differ in this respect). For those version combinations
adb_shell will currently raise a CalledProcessError when check_exit_code=False
and the target command fails.

So lets now use the "echo $?" trick whether or not we need the exit code.

Fixes https://github.com/ARM-software/devlib/issues/85
2017-01-25 15:27:13 +00:00
setrofim
76c4a725ed Merge pull request #84 from bjackman/cgroups-fix-run-into
Some fixes for running commands into cgroups
2017-01-12 17:04:58 +00:00
Brendan Jackman
de61937d09 cgroups: Strip shutils log message from run_into output 2017-01-12 17:03:10 +00:00
Brendan Jackman
d0e28f0a89 cgroups: Fix run_into method
The current run_into method attempts to execute:

  <...>/shutils CGMOUNT=<...> cgroups_run_into <...>

Which should instead be:

  CGMOUNT=<...> <...>/shutils cgroups_run_into <...>

So just use cgroups_run_into_cmd to generate the command, then execute that.
2017-01-12 16:49:24 +00:00
Brendan Jackman
dbd12994fb cgroups: Extend docstrings for run_into[_cmd] 2017-01-12 16:49:24 +00:00
marcbonnici
9f9910bc64 Merge pull request #82 from bjackman/hwmon-root
hwmon: Use as_root=True when listing directories
2017-01-11 10:23:20 +00:00
Brendan Jackman
beaa229279 hwmon: Use as_root=True when listing directories 2017-01-10 14:00:42 +00:00
setrofim
e88c6880ab Merge pull request #81 from bjackman/master
LocalConnection: Add ignored 'timeout' __init__ param
2016-12-14 14:46:12 +00:00
Brendan Jackman
be2775a29a LocalConnection: Add ignored 'timeout' __init__ param
Target::get_connection requires this.
2016-12-14 14:41:04 +00:00
Sergei Trofimov
d5460e1185 android: pick ANDROID_HOME/platform-tools over PATH
When ANDROID_HOME is defined, ANDROID_HOME/platform-tools was appended
to the PATH in the environment of the Python interpreter. That meant
that if an adb binary was in PATH, it would be picked in preference to
the one under ANDROID_HOME. This is now reversed so that ANDROID_HOME
takes precedence.
2016-12-13 11:26:32 +00:00
Sergei Trofimov
1ba7fbdc9a doc: documenting Platforms and Modules
Adding documentation for Platforms and Modules API.
2016-12-09 15:06:35 +00:00
Sergei Trofimov
b3cea0c0d2 TelnetConnction: splitting from SshConnection
Perviously, a parameter passed into SshConnection controlled whether the
connection was established over SSH or Telnet. Now, there is a separate
class for Telnet connections.
2016-12-08 11:50:17 +00:00
Sergei Trofimov
1ed29a8385 JunoEnergyInstrument: removed a stray print
Removed a stray print statement from take_measurement() method.
2016-12-08 09:54:30 +00:00
Sergei Trofimov
8528568c1c gitignore update. 2016-12-07 18:13:55 +00:00
Sergei Trofimov
01253100cd doc: documeting connections 2016-12-07 18:13:55 +00:00
Sergei Trofimov
925fccb4f9 LocalConnection: remove unused timeout parameter
`timeout` parameter passed to LocalConnection gets assigned to an
instance variable, however it is not used for anything.
2016-12-07 18:13:55 +00:00
Sergei Trofimov
889f72c883 Adding connection classes to main __init__.py
Now that connection classes can be passed as arguments on Target
instatiation, they are part of the user-facing API and are marked as
such by exporting them in the main __init__.py
2016-12-07 18:13:55 +00:00
Sergei Trofimov
beaf8d48ac target: switching conn_cls to an __init__ parameter
conn_cls is no longer a class attribute and is specified on
instantiaation as well. This more flexible -- new connection types no
longer require a corresponding new Target subclass but can be used with
existing targets. This is also more consistent with how Platforms are
handled.
2016-12-07 18:13:55 +00:00
Sergei Trofimov
c35230890e AndroidTarget: removing unused parameter
external_storage_directory parmeter of __init__ was not being set is
entrirely used.
2016-12-07 18:13:55 +00:00
setrofim
689c478ca8 Merge pull request #79 from bjackman/cpuidle-additions
Cpuidle additions
2016-12-07 17:46:44 +00:00
Brendan Jackman
c9f7e0e066 cpuidle: Add docstrings for properties requiring units
Unit info from comments on `struct cpuidle_state` definition in
include/linux/cpuidle.h in Linux 4.9 source (see drivers/cpuidle/sysfs.c
for the code that exposes that data to userspace)
2016-12-07 17:44:55 +00:00
Brendan Jackman
7cc8675fa0 cpuidle: Add getter for target residency 2016-12-06 11:46:16 +00:00
setrofim
d1263567d0 Merge pull request #78 from derkling/cgroups-multi-controller
Cgroups multi controller
2016-11-29 13:17:19 +00:00
Sergei Trofimov
5d492ca957 utils/misc: Adding Kryo cores to CPU part map
Adding part IDs of Qualcomm Kryo Gold and Silver cores to the CPU part
map.
2016-11-29 13:11:04 +00:00
Patrick Bellasi
b569a561a4 cgroups: add support for multi-controller hierarchies
Some systems mount multiple CGroup controllers in the same hierarchy, this
happens in desktop systems using systemd but it's also the default for
systems using CGroups v2. Unfortunately the current CGroup modules can
mount only single-controller hierarchies, thus failing when a controller
is already mounted with others in a single hierarchy.

This patch fixes this issue by:
- keeping track of which controllers are mounted in each hierarchy
- muting hierarchies instead of controllers
- creating Controller objects which reference the hierarchy they belong to

Thus, the new constructor of the Controller object requires to specify
the hierarchy ID as well as the list of controller which have to be
mounted in that hierarchy. The hierarchy ID is used to create a single
mount point for all the controllers in that hierarchy. This single mount
points are now named:
  <CGMOUNT>/devlib_cgh<ID>
where "cgh" stands for "CGroup Hierarchy" and <ID> is the specified
numerical identified of that hierarchy.

This patch removes also the Controller::__new__() method, which seems not to
have sense anymore, as well as the Controller::probe() method, which is
not more used. Indeed, all and only the available hierarchies are pre-mounted
at module initialization time.



Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-11-29 10:39:28 +00:00
Patrick Bellasi
103f792736 cgroups: use subsystems namedtuple in the controllers mounting loop
This is just a simple re-factoring patch in preparation of the following
one. Since we have a list of CGroups subsystems, which includes the
hierarchy ID for each entry, let's use directly these namedtuples in the
mouting loop. The following patch will make use of the hierarchy ID to
properly mount each controller.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-11-29 10:13:01 +00:00
Patrick Bellasi
b2ec957bf8 shutils/cgroups: fix run_into support
In the previous patch:
  cgroups: Mount cgroups controllers in devlib working dir
we changed the default mount point for devlib managed CGroups but forgot to
update the support for execution of a workload within a specified CGroup.

The run_into support is provide by a shutil script, which still has hardcoded
the old path (i.e. /sys/fs/cgroup/devlib_*). This patch fixes this by:
- resetting the default path to the Linux standard /sys/fs/cgroup
- use-sing the existing CGMOUNT env variable to specify which CGroups mount
  point to use

The cgroups::run_into is also updated to use the self.cgroup_root via
CGMOUNT when the shutils' script is called.
Moreover, an additional cgroups::run_into_cmd method is added which just
returns a properly formatted run_into shutils' call.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-11-29 10:02:57 +00:00
setrofim
68f7585ac2 Merge pull request #77 from bjackman/cgroups-shutils-fix
shutils/cgroups: Don't fail when racing with process exit
2016-11-28 14:40:42 +00:00
Brendan Jackman
454a2d5db5 shutils/cgroups: Don't fail when racing with process exit
If a process is added to $PIDS but then exits before the
cgroups_task_move invokation finishes, then echoing its PID to
cgroups.procs results in an I/O error. If that process is the last in
$PIDS, then that failing echo command is the last of the function, so
the script exits with an error and devlib raises an exception.

Add `|| true` to avoid this problem.
2016-11-28 12:41:41 +00:00