1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

606 Commits

Author SHA1 Message Date
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
a1e58cd8b1b293d5a18f204effbe1f37efcbecd4 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
sergei Trofimov
7e39ecf142 cpufreq: add missing get_driver() method
Add a method to read the name of the driver for cpufreq policy for a
cpu.
2018-05-01 11:38:11 +01:00
Marc Bonnici
1e839028a1 target.py: Update default shell prompt 2018-04-25 17:25:06 +01:00
Sascha Bischoff
9eb88cd598 trace: Add screencapture
Add a poller which takes a screenshot at a configurable interval
(`period`). Files are named based on the device timestamp, and are
placed into a configurable output directory.
2018-04-24 10:04:15 +01:00
Marc Bonnici
bb3ae48d25 exception: Update "TargetNotRespondingError" syntax.
Update the syntax of the TargetNotRespondingError to conform with the
other exceptions of expecting a full message to be displayed rather than just
a target name.
2018-04-24 09:04:28 +01:00
Marc Bonnici
58c0d30b26 target: Make sure xml is encoded properly before writing to file
Some UI elements can contain non ASCII characters so ensure we encode the
output to utf-8 before writing to file.
2018-04-24 09:04:28 +01:00
sergei Trofimov
87b235638a utis/misc: make check_output thread-safe
subprocess.Popen (used internally by check_output) is not thread-safe
and may cause a thread to lock up if called simultaneously from multiple
threads. See

	https://bugs.python.org/issue12739

This is fixed in Python 3.2, but since we're currently still on 2.7,
work around the issue by protecting the call with a lock.
2018-04-20 15:03:33 +01:00
Sergei Trofimov
b88b400d8d doc: document capture_screen timestamp
Updated documentation for capture_screen with the information about the
optional timestamp format tag.
2018-04-11 11:01:45 +01:00
Sergei Trofimov
8370c8fba3 target: timestamp for capture_screen
Add an option to format an ISO8601 timestamp into the screenshot file
name.
2018-04-11 10:51:38 +01:00
Marc Bonnici
2a23c435d4 README: Add link to documentation on readthedocs 2018-04-10 17:36:04 +01:00
Marc Bonnici
59e2f2d126 docs/target: Add install_if_neeeded method info 2018-04-10 17:36:04 +01:00
Sergei Trofimov
56e9147e58 setup.py: update URL
Update the url entry in the package metadata to be a valid URL. This is
now required for upload to PyPI.
2018-03-22 11:10:43 +00:00
Sergei Trofimov
9678c7372e AndroidTarget: add capture_ui_hierarchy
Add a method to dump XML UI hierarchy from uiautomator.
2018-03-21 15:02:02 +00:00
Sascha Bischoff
078f0dc641 derived/energy: Fix energy calculation
Correctly detect whether or not the energy should be calculated from
power or extracted directly. Previously both methods were being used
at the same time, resulting in incorrect total energy values.
2018-03-21 11:48:50 +00:00
Sascha Bischoff
335fa77e4e AndroidTarget: add get_pacakge_info
Add a method to get info (apk path) for an installed package.
2018-03-15 17:06:02 +00:00
Marc Bonnici
c585a4e489 uitils/android: Fix logcat monitor on older devices
The `-e` argument to match logcat output with a regex expression is not
present on older devices. If the target is running pre marshmallow fall
back to pipeing logcat into grep.
2018-03-15 12:26:15 +00:00
Marc Bonnici
a992a890b8 AndroidTarget: Add additional permission error to ignore
Also ignore any errors that granting a permission on an Android device
is not permitted.
2018-03-15 12:26:15 +00:00
Anouk Van Laer
5001fae516 gem5: Update to telnet connection method
gem5 prints a string, to communicate which telnet port can be used to connect
to the gem5 system.  The exact string has recently changed. This commit ensures
both the old and new string are taken into account when devlib parses gem5
output to determine the telnet port.
2018-03-13 14:26:35 +00:00
Douglas Raillard
f515420387 cgroups: fix Controller.tasks()
Fix cgroups tasks parsing in Controller.tasks() method, to ignore lines
that are not formatted properly.
2018-03-13 14:22:43 +00:00
Sergei Trofimov
e3d9c4b2fd bin/trace-cmd: add x86-64
Add an x86-64 version of the statically linked trace-cmd binary.
2018-03-12 16:17:31 +00:00
Marc Bonnici
e22d278267 AndroidTarget: Add method to open a url in the default browser 2018-03-12 11:25:48 +00:00
Sergei Trofimov
17d32a4d40 acmecape: fix warning formatting 2018-03-07 18:19:59 +00:00
Sergei Trofimov
7a8f98720d target: add wait_boot_complete to LinuxTarget
Add an empty implementation, as there is currently no generic way of
detecting boot completion for a random Linux system, and it is
considered to be "fully booted" as soon as it ready to accept
connections.
2018-03-07 18:19:59 +00:00
Sergei Trofimov
328e0ade4b target: fix connect on reboot
Previously, commit

	commit 17bcabd461b22434db00552056e7de995fc7f498

	    target: Install busybox before updating modules

moved busybox deployment into Target.connect() so that modules could
make use of it. This means this now happens before AndroidTarget waits
for the boot to complete at the end of its connect(). This means that
an attempt to create the devlib working directory may be made too early.

To get around this, move wait_boot_completed() into Target, and ensure
it returns before attempting to create the working directory.
2018-03-07 18:19:59 +00:00
Sergei Trofimov
d5ff73290e module/vexpress catch CalledProcessError
Depending on what goes wrong, this may also be raised.
2018-03-07 18:19:59 +00:00
Sergei Trofimov
f39631293e utils/android: change adb_shell error type
Re-raise CalledProcessError originating inside adb_shell as a
TargetError to be consistent with other errors pertaining to the target.
2018-03-07 18:19:59 +00:00
Sergei Trofimov
c706e693ba utils/serial_port: fix exception message
SerialError does not populate it's message attribute, so the message was
lost when re-raising as HostError. Pass the string representation of
SerialError into HostError instead.
2018-03-07 18:19:59 +00:00
Sergei Trofimov
f490a55be2 target: conditionally raise from check_responsive
Add an option to check_responsive() to not throw an exception if
unresponsive target is detected, but to act as a predicate instead.
2018-03-07 18:19:59 +00:00
Sergei Trofimov
0e017ddf9f module/vexpress: fix reboot for Juno
- The autoboot message in the firmware has changed; detect both the old
  and the new messages.
- Depending on where exactly the boot was interrupted, either a "reboot"
  or a "reset" may be required; so send both.
2018-03-07 18:19:59 +00:00