Bug 757838 - Misc remoteautomation.py cleanup; r=jmaher a=test-only
authorEd Morley <emorley@mozilla.com>
Fri, 02 Nov 2012 18:57:50 +0000
changeset 116664 3ca9fbeb5d6f97b85133d24b2770aded88a624de
parent 116663 18270cef7783e939c9d261f5c5d4001510f897f9
child 116665 518d8fac93c4a79ebeb1a00e2447fca80ac95161
push id1708
push userakeybl@mozilla.com
push dateMon, 19 Nov 2012 21:10:21 +0000
treeherdermozilla-beta@27b14fe50103 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher, test-only
bugs757838
milestone18.0a2
Bug 757838 - Misc remoteautomation.py cleanup; r=jmaher a=test-only
build/mobile/remoteautomation.py
--- a/build/mobile/remoteautomation.py
+++ b/build/mobile/remoteautomation.py
@@ -56,22 +56,23 @@ class RemoteAutomation(Automation):
         if crashreporter:
             env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
             env['MOZ_CRASHREPORTER'] = '1'
         else:
             env['MOZ_CRASHREPORTER_DISABLE'] = '1'
 
         return env
 
-    def waitForFinish(self, proc, utilityPath, timeout, maxTime, startTime, debuggerInfo, symbolsDir):
+    def waitForFinish(self, proc, utilityPath, timeout, maxTime, startTime, debuggerInfo, symbolsPath):
+        """ Wait for tests to finish (as evidenced by the process exiting),
+            or for maxTime elapse, in which case kill the process regardless.
+        """
         # maxTime is used to override the default timeout, we should honor that
         status = proc.wait(timeout = maxTime)
 
-        print proc.stdout
-
         if (status == 1 and self._devicemanager.processExist(proc.procName)):
             # Then we timed out, make sure Fennec is dead
             proc.kill()
 
         return status
 
     def checkForCrashes(self, directory, symbolsPath):
         remoteCrashDir = self._remoteProfile + '/minidumps/'
@@ -180,19 +181,18 @@ class RemoteAutomation(Automation):
             if self.dm.fileExists(self.proc):
                 try:
                     t = self.dm.pullFile(self.proc)
                 except DMError:
                     # we currently don't retry properly in the pullFile
                     # function in dmSUT, so an error here is not necessarily
                     # the end of the world
                     return ''
-                tlen = len(t)
                 retVal = t[self.stdoutlen:]
-                self.stdoutlen = tlen
+                self.stdoutlen = len(t)
                 return retVal.strip('\n').strip()
             else:
                 return ''
 
         def wait(self, timeout = None):
             timer = 0
             interval = 5
 
@@ -202,14 +202,17 @@ class RemoteAutomation(Automation):
             while (self.dm.processExist(self.procName)):
                 t = self.stdout
                 if t != '': print t
                 time.sleep(interval)
                 timer += interval
                 if (timer > timeout):
                     break
 
+            # Flush anything added to stdout during the sleep
+            print self.stdout
+
             if (timer >= timeout):
                 return 1
             return 0
 
         def kill(self):
             self.dm.killProcess(self.procName)