Bug 1581006 - Allow mozdevice to find ls on unrooted devices. r=bc

Bug 1572563 wanted to be extra sure that `ls` could be found. To do
that it tries to run various `ls` variants in a loop until one such
variant exits with exit code 0. However, `ls` can be present and
functional and still exit with code 1. For many unrooted devices, bare
`ls` will exit with code 1 because there are files and directories for
which the shell user doesn't have read permission.

This works around by trying to list only the file that the loop is
trying to execute.

Differential Revision: https://phabricator.services.mozilla.com/D45770

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nick Alexander 2019-09-13 01:13:49 +00:00
parent f408d617b9
commit 21955fe91b

View File

@ -686,13 +686,13 @@ class ADBDevice(ADBCommand):
boot_completed = False
while not boot_completed and (time.time() - start_time) <= float(timeout):
try:
self.shell_output("/system/bin/ls", timeout=timeout)
self.shell_output("/system/bin/ls /system/bin/ls", timeout=timeout)
boot_completed = True
self._ls = "/system/bin/ls"
except ADBError as e1:
self._logger.info("detect /system/bin/ls {}".format(e1))
try:
self.shell_output("/system/xbin/ls", timeout=timeout)
self.shell_output("/system/xbin/ls /system/xbin/ls", timeout=timeout)
boot_completed = True
self._ls = "/system/xbin/ls"
except ADBError as e2: