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

634 Commits

Author SHA1 Message Date
Marc Bonnici
454b94501c pylint fixes 2018-07-13 16:05:49 +01:00
Marc Bonnici
5cb551b315 utils/parse_aep: Fix typo when retrieving initial timestamp 2018-07-13 16:05:49 +01:00
Marc Bonnici
3b0df282a9 utils/parse_aep: Correct typo in method arguments 2018-07-13 16:05:49 +01:00
Marc Bonnici
27fc75f74c utils/android: Remove uncessary parameter from method 2018-07-13 16:05:49 +01:00
Marc Bonnici
473f37f1bc utils/ssh: Remove unused paramter from method 2018-07-13 16:05:49 +01:00
Sergei Trofimov
ae8db119a9 doc: document Target.model
Add missing documentation for Target.model
2018-07-13 13:18:39 +01:00
Sergei Trofimov
472c5a3294 target: add system_id
Add system_id attribute to targets. This ID is supposed unique for a
combination of hardware, kernel, and the file system, and contains
elements from each.

1. Hardware is identified by the concatenation of MAC addresses of
   'link/ether' network  interfaces on the system. This method is used,
   as DMI tables are often unimplemented on ARM targets.
2. The kernel is identified by its version.
3. The file system is identified by the concatenation of UUID's of the
   target's partitions. It would be more correct to only use UUID of
   the root partition, as system_id is not intended to be affected by
   removable, media, however, there is no straight-forward way of
   reliably identifying that without root.

system_id is intended to be used as an key for the purposes of caching
information about a particular device (e.g. so that it does not need to
be probed on each run).
2018-07-13 13:18:39 +01:00
Sergei Trofimov
8ac89fe9ed utils/version: do not decode bytes
Check that the resulting output inside get_commit() is a str before
attempting to decode it when running on Python 3.
2018-07-11 09:38:55 +01:00
Sergei Trofimov
56f3b1c317 setup.py: add -s flag to sdist
Add -s flag to sdist command, which, when used, strips away the git
commit hash from the package version. This is needed for upload to PyPI.
2018-07-06 17:15:10 +01:00
Marc Bonnici
34c6d1983b version: Release version 1.0.0 2018-07-06 14:56:47 +01:00
Marc Bonnici
c4ababcd50 utils/misc: Ensure outputs are strings when raising exceptions
If the process was killed, either the output or error can
be `None` which causes an error when attempting to join the outputs.
Also update existing error message to prevent 'None' appearing in the error
message.
2018-07-05 10:17:32 +01:00
Sergei Trofimov
9fd690efb3 Update copyrights
- Update the year in the copyrights to match the last year the file was
  modified.
- Add the copyright header to files that did not already have one.
2018-07-04 16:01:47 +01:00
Marc Bonnici
e16c42fe2c target: Add new attribute to Target to indicate a container
Allow for a flag to be set to indicate that the target is a container
and therefore may have limited functionality.
2018-07-02 10:49:43 +01:00
Marc Bonnici
8aa9d672a1 devlib: Replace errors when decoding output from subprocess
If an error occurs when attempting to decode the output from subprocess
replace the offending character rather than raising an error.
2018-06-28 12:48:00 +01:00
Marc Bonnici
533a2fd2c1 doc/target: Fix typo in method description 2018-06-28 12:48:00 +01:00
Sergei Trofimov
8e1dc1359a target: fix new line handling in os_version
Use convert_new_lines() before stripping out '\n' character from OS
version strings to ensure no stray '\r's are left in.
2018-06-27 14:41:48 +01:00
Marc Bonnici
fec0868734 setup.py: Change format of version to conform with PEP440
When installing from source devlib attempts to include the commit ID in the
version of the installed pacakge however this caused issues with package
managers like pip. PEP440 specifies that local identifiers must be in the
form `<public version identifier>[+<localversion label>]` so update the
version to conform.

https://www.python.org/dev/peps/pep-0440/#local-version-identifiers
2018-06-27 11:41:28 +01:00
Michele Di Giorgio
0915d97f71 module: Add devfreq module
Add support for devfreq. This is used for example to get/set the frequency
and/or governor of the GPU.
2018-06-26 12:18:06 +01:00
Valentin Schneider
d81b72a91b trace: Add a Systrace TraceCollector 2018-06-22 14:55:26 +01:00
Valentin Schneider
96ffa64ad8 AndroidTarget: Add some more screen utility methods 2018-06-22 10:23:18 +01:00
Valentin Schneider
38037850b6 AndroidTarget: Add force_new parameter to open_url
When True, this will force whatever application Android deems best
for viewing that url to be relaunched.

This can be useful when trying to open e.g. Google Maps search URLs,
as the actual search result can be influenced by the location being
currently displayed. Forcing the app the be relaunched allows us to
have reproducible behaviours.
2018-06-22 10:23:18 +01:00
Valentin Schneider
56a7394d58 utils/android: Add the definition of some intent flags 2018-06-22 10:23:18 +01:00
Valentin Schneider
bda1115adb AndroidTarget: Fix escape_double_quote typo 2018-06-22 10:23:18 +01:00
Sergei Trofimov
cc04e1a839 Implement PEP396
Implement PEP396 which specifies that a package should advertise its
version via __version__ attribute.

As devlib is often used as a development version directly from source,
also add a __full_version__ attribute which appends the current commit
ID to the version.

Use the __full_version__ inside setup.py
2018-06-15 08:58:35 +01:00
Sergei Trofimov
4a862d06bb utils/version: add get_commit
Add a function to get the commit ID of the devlib repository (if running
from source, e.g. via "setup.py develop").
2018-06-15 08:58:35 +01:00
Sergei Trofimov
f1c945bb5e utils/types: implement __ne__ for caseless_string
This should have been handled by the @total_ordering decorator, but
isn't due to

	https://bugs.python.org/issue25732

(briefly, total_ordering is back-ported from Python 3, where the base
object provides the default implementation of __ne__ based on __eq__, so
total_ordering did not override it; this, however does not happen in
Python 2).
2018-06-14 15:04:35 +01:00
Valentin Schneider
51452d204c module: Add sched module
This module is a collection of scheduler data getters.
2018-06-14 12:09:25 +01:00
Valentin Schneider
7231030991 target: Add strict option to KernelConfig.get()
Defaults to False. If True, will raise an exception when a requested
config name is not exposed in the config instance.
2018-06-14 12:09:25 +01:00
Sascha Bischoff
085737bbfa gem5: Add checkpoint support
We add the ability to explicitly take checkpoints when running with a
gem5 system. As we cannot have any state which is shared between the
host and simulated system, we first unmount the VirtIO device, take
the checkpoint, and then remount the VirtIO device into the simulated
system.
2018-06-14 11:35:56 +01:00
Sascha Bischoff
9e45d65c94 gem5: Unmount the VirtIO device at the end of the run
We explicitly unmount the VirtIO device (used to transfer files into
the simulated system) at the end of a run (when the connection is
closed) in order to make checkpointing the simulated system
easier. gem5 supports checkpointing the state of the simulation when
it is terminated, and future simulations are able to resume from this
snapshot. However, for the checkpoint to work correctly, we need to
make sure that there is no shared state between the simulated system
and the host. This mandates that we disconnect the VirtIO device prior
to taking a checkpoint.
2018-06-14 11:35:56 +01:00
Sergei Trofimov
008f96673f utils/android: add recent Android versions
Add the more recent android versions to the version map.
2018-06-14 11:35:09 +01:00
Sergei Trofimov
77a6de9453 utils/android: include stderr in adb_shell output
Include stderr output of the executed command in the output returned by
adb_shell. This will align the AdbConnection behavior with that of
SshConnection and ensure that target.execute() behaves consistently
across Android and Linux targets.
2018-06-14 11:34:55 +01:00
Sergei Trofimov
d4b0dedc2a utils/misc: add combined output option to check_output
Add an option to combine stderr and stdout into a single stream.
2018-06-14 11:34:55 +01:00
Sergei Trofimov
69cd3be96c target: ensure shell_prompt is a bytes_regex
shell_prompt gets passed into expect and therefore must be encoded as
bytes on Python 3.
2018-06-14 11:34:16 +01:00
Sergei Trofimov
7e942cdd4a utils/types: add regex types
Add types for regex and bytes_regex. In Python 3, regular expression
objects differ based on whether they were created with a str  or a
bytes instance as the pattern, and can only match against instances of
the corresponding type.

To make sure we always end up using the right version (e.g. pexpect
needs bytes regexes), create functions to do the appropriate
conversions.
2018-06-14 11:34:16 +01:00
Sascha Bischoff
41f460afbe trace/serial_trace: Flush data to file before copying
We add a missing flush which esures that all data has been synced to
the temporary file before we copy it. Prior to this commit, we would
sometimes miss the last few lines of the trace.
2018-06-14 11:33:10 +01:00
Waleed El-Geresy
804a044efc platform/arm: Add import sys 2018-06-13 15:16:19 +01:00
Waleed El-Geresy
b06035fb12 Fix Python3 Byte and Regex Handling
Convert bytes to strings (utf-8 encoding) to make compatible with
Python3 in arm.py
Use the pattern property to extract the string from the regex pattern,
to pass as a string to tty.expect.
Drop problematic characters when decoding stdout and stderr in misc.py
by setting errors='replace' in the string decode method.
2018-06-13 15:16:19 +01:00
Sascha Bischoff
6abe6067da trace/serial_trace: Add capability to trace serial traffic
We add a TraceCollector which logs the traffic on a serial port. This
can then be used to debug why a board crashes, or to extract extra
information from the device whilst it is running a workload.
2018-06-13 14:36:17 +01:00
Pierre-Clement Tosi
c4f6a1a85f Instrument: Fix & restructure reset()
Calling `Instrument.reset(kinds='some string')` leaves
`self.active_channels` as `[]` which is probably not the expected
behaviour. This is caused by the last nested `else` which refers to
the condition `if isinstance(kinds, basestring)` and might have been
overlooked because of having been confused with the top-level `else`.
Anyhow, an `else` does not seem to be needed there.

This bug illustrates the risk of having too many nested levels and
execution paths which also impact the readability of the code. We
modify the implementation to solve the bug on top of which we:

  - Reduce the maximum order of nested levels from 4 to 3;

  - Express more clearly the potential paths of execution
    (less nested conditions);

  - Replace unnecessary `for`-loops by list comprehensions,
    removing the need for an initialisation of `active_channels`
    and making clearer what each path of execution ends up with;

  - Removed unnecessary `List` copies of `self.channels.values()`;

  - Used the fact that the message of a `KeyError` is the unknown
    key.
2018-06-08 17:32:14 +01:00
Marc Bonnici
fe0d6eda2a utils/android: Try to ping adb devices regardless of connection type
Previously if a device was connected over usb then the adb_connect
method would assume the device was already connected. This can cause
issues when rebooting and the device is not ready by the time devlib
attempts to reconnect to it causing the next command to fail. Now still
only execute the 'connect' command when the device is connected over the
network, however always trying pinging the device to see if it is
connected before returning.
2018-06-07 15:18:23 +01:00
Sergei Trofimov
5cafd2ec4d Add support for Python 3
Add support for running on Python 3 while maintaining Python 2
compatibility.
2018-06-07 14:45:43 +01:00
Sergei Trofimov
0d63386343 module/cpufreq: include policy0 in probe path
Check /sys/devices/system/cpu/cpufreq/policy0 rather than its parent
during the probe. This is to handle the edge case where cpufreq has
been enabled in the kernel, but no frequency domains have been defined
(in which case, the module should not install).
2018-06-06 15:37:10 +01:00
Marc Bonnici
a35f715b63 doc/cpufreq: Add docs for max/min frequency methods.
Adds documentation for the previously added methods in commit
a1e58cd8b1 and clarify existing method
documentation.
2018-06-01 17:27:37 +01:00
Marc Bonnici
55762edf19 cpufreq: Add methods to retrieve max/min available frequencies for a cpu
Adds usability methods methods to allow easy retrieval of the maximum
and minimum frequencies available for a given cpu
2018-05-31 09:49:37 +01:00
Marc Bonnici
1d9dc42af5 target: Increase timeout for checking if rooted.
One some devices executing this command takes longer than the original 2
seconds allowed causing devlib to incorrectly think it was not rooted.
2018-05-31 09:49:37 +01:00
Vincent Guittot
be4f01ebaf cgroups: add execute as root
On latest hikey960 android image, only root can execute: cat /proc/cgroups

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
2018-05-30 11:45:34 +01:00
Sergei Trofimov
d6ccbb44c3 module/cpuidle: ensure get_states() returns a list
Ensure that cpuidle.get_states() always returns a list, even if no idle
states are available on the target.
2018-05-23 10:31:38 +01:00
Marc Bonnici
329df6f42e AndroidTarget: Ensure path is correctly quoted when listing directories
Previously the path for listing a directory on the device was not quoted
causing it to fail on paths containing spaces. Now ensure the string is
quoted and any quotes contained in the string as escaped.
2018-05-10 11:12:25 +01:00
Marc Bonnici
63bf68b49d LinuxTarget: Ensure path is correctly quoted when listing directories
Previously the path for listing a directory on the device was not quoted
causing it to fail on paths containing spaces. Now ensure the string is
quoted and any quotes contained in the string as escaped.
2018-05-10 10:57:59 +01:00