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
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).
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.
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.
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.
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.
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.
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.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.