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 109769 f7736e47130df9d854989439bc11a2e05907a840
parent 109768 e6f57c8e6f1eff333263176967b3a400604dcbc2
child 109770 5c86e35ea6fcb40ef4bfbbebb8ecf8f338339396
push id1664
push useremorley@mozilla.com
push dateSat, 03 Nov 2012 19:49:50 +0000
treeherdermozilla-beta@9de15654e484 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher, test-only
bugs757838
milestone17.0
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):
         dumpDir = tempfile.mkdtemp()
@@ -161,19 +162,18 @@ class RemoteAutomation(Automation):
             if (hexpid == None):
                 hexpid = "0x0"
             return int(hexpid, 0)
 
         @property
         def stdout(self):
             t = self.dm.getFile(self.proc)
             if t == None: return ''
-            tlen = len(t)
             retVal = t[self.stdoutlen:]
-            self.stdoutlen = tlen
+            self.stdoutlen = len(t)
             return retVal.strip('\n').strip()
 
         def wait(self, timeout = None):
             timer = 0
             interval = 5
 
             if timeout == None:
                 timeout = self.timeout
@@ -181,14 +181,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)