Bug 774322 - use correct process name in RProcess; r=jmaher
authorGeoff Brown <gbrown@mozilla.com>
Tue, 17 Jul 2012 08:58:47 -0600
changeset 105013 64ca6f0f5c9f960f3ea081a042d53ef5e86d7406
parent 105012 2ee313f65ccf185a9e02d099ea96825b42f9398d
child 105014 0888a88ab4c7327e906dc2ef8fae15e4408242bf
push id1490
push userakeybl@mozilla.com
push dateMon, 08 Oct 2012 18:29:50 +0000
treeherdermozilla-beta@f335e7dacdc1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs774322
milestone17.0a1
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 774322 - use correct process name in RProcess; r=jmaher
build/mobile/remoteautomation.py
--- a/build/mobile/remoteautomation.py
+++ b/build/mobile/remoteautomation.py
@@ -124,16 +124,37 @@ class RemoteAutomation(Automation):
             if (self.proc is None):
               if cmd[0] == 'am':
                 self.proc = stdout
               else:
                 raise Exception("unable to launch process")
             exepath = cmd[0]
             name = exepath.split('/')[-1]
             self.procName = name
+            # Hack for Robocop: Derive the actual process name from the command line.
+            # We expect something like:
+            #  ['am', 'instrument', '-w', '-e', 'class', 'org.mozilla.fennec.tests.testBookmark', 'org.mozilla.roboexample.test/android.test.InstrumentationTestRunner']
+            # and want to derive 'org.mozilla.fennec'.
+            if cmd[0] == 'am' and cmd[1] == "instrument":
+              try:
+                i = cmd.index("class")
+              except ValueError:
+                # no "class" argument -- maybe this isn't robocop?
+                i = -1
+              if (i > 0):
+                classname = cmd[i+1]
+                parts = classname.split('.')
+                try:
+                  i = parts.index("tests")
+                except ValueError:
+                  # no "tests" component -- maybe this isn't robocop?
+                  i = -1
+                if (i > 0):
+                  self.procName = '.'.join(parts[0:i])
+                  print "Robocop derived process name: "+self.procName
 
             # Setting timeout at 1 hour since on a remote device this takes much longer
             self.timeout = 3600
             time.sleep(15)
 
         @property
         def pid(self):
             hexpid = self.dm.processExist(self.procName)