Add Target{Stable,Transient}CalledProcessError exceptions, with an
.returncode and .output attributes, raised by Target.execute(),
mirroring subprocess.CalledProcessError.
This is very useful in client code that uses "exit N" to signal an
abnormal condition, and then inspects the output to find out more.
Handle in one place the decision of what is the real destination of each
file in push/pull operations.
The following can now be assumed by the connection:
* The destination does not exist.
* The folder containing the destination does exist.
This ensures consistent errors and behaviors across all connection
types, at the cost of:
* At least an extra execute() per source (up to 2 if the destination
is a file that needs to be removed to make room).
* For now, globbing will lead to a separate request for each file,
rather than a merged one. This is because the destination of each
source is prepared so that the connection will not have any
interpretation work to do.
Since we have the guarantee to have a different SshConnection per
thread, we can memoize paramiko's SFTPClient. This provides a great
performance boost.
The main path is reading /proc/config.gz. If it does not exists, the
following paths are tested:
'/boot/config', '/boot/config-$(uname -r)'
Since the 2nd path contains a command to be executed, remove quoting of
the path when using "cat".
Newer Android versions do not include any of the attributes that we're
currently looking for in the "dumpsys power" output. Instead they have
"mWakefulness" which can either be "Asleep" or "Awake". Adjust the regex to
look for that attribute as well.
Build of commit 2191498dc35d629003591f727b604120fabbe02d, which is a few
commits after 2.9.1 release. This version has been in use in LISA for
months now so it should work well.
Add a communicate() method in the style of Popen.communicate().
Unlike Popen.communicate, it will raise a CalledProcessError if the
command exit with non-zero code.
The Popen object created for background command currently has no stdin
pipe, preventing the user from writing to it (it will be None instead of
being a file-like object).
Fix that by passing stdin=subprocess.PIPE to Popen constructor.
When using an ssh background command, the data is read from paramiko as
it comes and stored in a buffering pipe by a thread. Currently, the
ParamikoBackgroundCommand API will report the command as having
completed as soon as paramiko reports it. This however does not
necessarily mean that the pipe-filling thread is finished copying the
streams, and the client will end up assuming there is no more data to
read even though it's not the case.
Fix that by ensuring that when poll() returns non-None, the output
streams are ready to be drained.
Move methods related to the scp command into TelnetConnection, since
SshConnection do not use it at all anymore (it has been replaced by the
"scp" python package, piggy backing on paramiko).
Scheduler debug information is being unified under /sys/kernel/debug/sched
for Linux v5.13. Plug in awareness for the new path while still trying the
old one(s) for backwards compatibility.
When Target.conn property is required while the current connection is
already in use, provide a fresh connection to avoid deadlocks. This is
enabled by the @call_conn decorator that is used on all Target methods
that use self.conn directly.
Check that all CPUs are effectively online after a call to
target.hotplug.online_all(), as hotplug issues are common and failure to
bring back up a CPU can be quite problematic.
When SFTP is not available on OpenSSH, paramiko will raise a generic
exception:
paramiko.ssh_exception.SSHException: EOF during negotiation
In order to make it easier to debug, raise a TargetStableError telling
the user to enable SFTP on their server. On OpenSSH, this means
installing the sftp subsystem and enabling it in sshd_config.
The original BusyBox binaries were statically linked
against glibc, which caused segmentation faults to occur
on __nss_* calls. This switches the libc implementation
to uClibc in both cases.
busybox ver bump to 1.32.1 for arm64 and x86_64
update x86_64-linux-uclibc busybox
update aarch64-linux-uclibc busybox
Update the ppc64le busybox implementation to v1.32.1
to match other architecture binaries.
Note: This binary is linked with musl as glibc has been
reported to cause issues however uclibc does not appear
to be a support build configuration.
Update the arm32 and add i368 v1.32.1 busybox binaries statically linked
with uclibc rather than the previous version with glibc which
caused segfaults on some devices.
The Linux HP path is composed of a series of states the CPU has to execute
to perform a complete hotplug or hotunplug. Devlib now exposes this
information. get_state() gives the current state of a CPU. get_states()
gives the list of all the states that composes the HP path.
The Linux HP 'fail' interface allows to simulate a failure during the
hotplug path. It helps to test the rollback mechanism. Devlib exposes this
interface with the method fail().
last_sample is initialized in the PopenTransferManager constructor.
However, there is only one PopenTransferManager instance, which is
initialized during the construction of AdbConnection. Afterwards, the
transfer manager is reused for every file transfer, without going
through __init__(). Therefore, after pushing/pulling a big file, the
next file transfer has compares the current size to the last sample of
the previous file transfer. This makes it believe that the transfer
is inactive.
Reinitialize last_sample every time we start a new transfer to avoid
this.