imported patch debug_process_list
authorGeoff Brown <gbrown@mozilla.com>
Mon, 04 Jun 2018 08:58:20 -0600
changeset 1530785 4e46e9219604c710f7ece9bd2f9a69281d40b013
parent 1530784 f35ce604d65cbf47f7a17f9f085989935971e497
child 1530786 f3672a2dff7bfcce06e3ce1ca8099362ce49c007
child 1530821 dc870b6a6282c43ade8ac9ae212807de4ebd2194
child 1530869 3fcfc08963742a466efbc5173c191a5f06b5077f
push id276472
push usergbrown@mozilla.com
push dateMon, 04 Jun 2018 15:01:39 +0000
treeherdertry@27c874bbf147 [default view] [failures only]
milestone62.0a1
imported patch debug_process_list
build/mobile/remoteautomation.py
testing/mozbase/mozdevice/mozdevice/adb.py
--- a/build/mobile/remoteautomation.py
+++ b/build/mobile/remoteautomation.py
@@ -270,17 +270,27 @@ class RemoteAutomation(Automation):
             # Temporarily increased to 90 minutes because no more chunks can be created.
             self.timeout = 5400
 
             # Used to buffer log messages until we meet a line break
             self.logBuffer = ""
 
         @property
         def pid(self):
-            procs = self.device.get_process_list()
+            procs = None
+            t = 0
+            while procs is None:
+                try:
+                    procs = self.device.get_process_list()
+                except Exception:
+                    print("ZZZ YYY retry in %d seconds" % t)
+                    time.sleep(t)
+                    t += 1
+                    if t > 5:
+                        t = 5
             # limit the comparison to the first 75 characters due to a
             # limitation in processname length in android.
             pids = [proc[0] for proc in procs if proc[1] == self.procName[:75]]
 
             if pids is None or len(pids) < 1:
                 return 0
             return pids[0]
 
--- a/testing/mozbase/mozdevice/mozdevice/adb.py
+++ b/testing/mozbase/mozdevice/mozdevice/adb.py
@@ -1967,34 +1967,37 @@ class ADBDevice(ADBCommand):
         :type timeout: integer or None
         :returns: list of (pid, name, user) tuples for running processes
             on the device.
         :raises: * ADBTimeoutError
                  * ADBError
         """
         adb_process = None
         try:
+            self._logger.error('ZZZ: ps sent')
             adb_process = self.shell("ps", timeout=timeout)
             if adb_process.timedout:
                 raise ADBTimeoutError("%s" % adb_process)
             elif adb_process.exitcode:
                 raise ADBProcessError(adb_process)
             # first line is the headers
             header = adb_process.stdout_file.readline()
+            self._logger.error('get_process_list: header=%s' % header)
             pid_i = -1
             user_i = -1
             els = header.split()
             for i in range(len(els)):
                 item = els[i].lower()
                 if item == 'user':
                     user_i = i
                 elif item == 'pid':
                     pid_i = i
             if user_i == -1 or pid_i == -1:
                 self._logger.error('get_process_list: %s' % header)
+                self._logger.error('      stdout: %s' % adb_process.stdout)
                 raise ADBError('get_process_list: Unknown format: %s: %s' % (
                     header, adb_process))
             ret = []
             line = adb_process.stdout_file.readline()
             while line:
                 els = line.split()
                 try:
                     ret.append([int(els[pid_i]), els[-1], els[user_i]])