Bug 636534 - support incremental log output from remote testing harnesses. r=ctalbert, a=NPOTB
authorJoel Maher <jmaher@mozilla.com>
Sat, 26 Feb 2011 13:19:55 -0500
changeset 63138 e4b73866be7d4943dc2a53a8bbd6a4775445a4e2
parent 63137 151d55505c10300e89e4cca795d79597e1705e0f
child 63139 a95e6e05435177ce307cd5c1e264b221ab8cd9b9
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersctalbert, NPOTB
bugs636534
milestone2.0b13pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 636534 - support incremental log output from remote testing harnesses. r=ctalbert, a=NPOTB
build/mobile/remoteautomation.py
--- a/build/mobile/remoteautomation.py
+++ b/build/mobile/remoteautomation.py
@@ -114,27 +114,28 @@ class RemoteAutomation(Automation):
 #        return app, ['--environ:NO_EM_RESTART=1'] + args
         return app, args
 
     def getLanIp(self):
         nettools = NetworkTools()
         return nettools.getLanIp()
 
     def Process(self, cmd, stdout = None, stderr = None, env = None, cwd = '.'):
-        if stdout == None or stdout == -1:
+        if stdout == None or stdout == -1 or stdout == subprocess.PIPE:
           stdout = self._remoteLog
 
         return self.RProcess(self._devicemanager, cmd, stdout, stderr, env, cwd)
 
     # be careful here as this inner class doesn't have access to outer class members    
     class RProcess(object):
         # device manager process
         dm = None
         def __init__(self, dm, cmd, stdout = None, stderr = None, env = None, cwd = '.'):
             self.dm = dm
+            self.stdoutlen = 0
             self.proc = dm.launchProcess(cmd, stdout, cwd, env, True)
             if (self.proc is None):
               raise Exception("unable to launch process")
             exepath = cmd[0]
             name = exepath.split('/')[-1]
             self.procName = name
 
             # Setting timeout at 1 hour since on a remote device this takes much longer
@@ -145,26 +146,33 @@ class RemoteAutomation(Automation):
         def pid(self):
             hexpid = self.dm.processExist(self.procName)
             if (hexpid == None):
                 hexpid = "0x0"
             return int(hexpid, 0)
     
         @property
         def stdout(self):
-            return self.dm.getFile(self.proc)
+            t = self.dm.getFile(self.proc)
+            if t == None: return ''
+            tlen = len(t)
+            retVal = t[self.stdoutlen:]
+            self.stdoutlen = tlen
+            return retVal.strip('\n').strip()
  
         def wait(self, timeout = None):
             timer = 0
             interval = 5
 
             if timeout == None:
                 timeout = self.timeout
 
             while (self.dm.processExist(self.procName)):
+                t = self.stdout
+                if t != '': print t
                 time.sleep(interval)
                 timer += interval
                 if (timer > timeout):
                     break
 
             if (timer >= timeout):
                 return 1
             return 0