Bug 1573555 - [mozdevice] detect pidof via execution, r=gbrown.

Depends on D42861

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Bob Clary 2019-08-21 14:42:33 +00:00
Родитель 98678c381c
Коммит 51b52e6ee0
1 изменённых файлов: 19 добавлений и 3 удалений

Просмотреть файл

@ -782,11 +782,27 @@ class ADBDevice(ADBCommand):
self.enforcing = 'Permissive'
# Do we have pidof?
if self.version >= version_codes.N:
self._have_pidof = self.shell_bool("type pidof", timeout=timeout)
else:
if self.version < version_codes.N:
# unexpected pidof behavior observed on Android 6 in bug 1514363
self._have_pidof = False
else:
boot_completed = False
while not boot_completed and (time.time() - start_time) <= float(timeout):
try:
self.shell_output('pidof --help', timeout=timeout)
boot_completed = True
self._have_pidof = True
except ADBError as e:
if 'not found' in e.message:
self._have_pidof = False
boot_completed = True
elif 'known option' in e.message:
self._have_pidof = True
boot_completed = True
if not boot_completed:
time.sleep(2)
if not boot_completed:
raise ADBTimeoutError("ADBDevice: pidof not found.")
self._logger.info("Native pidof support: {}".format(self._have_pidof))
# Bug 1529960 observed pidof intermittently returning no results for a