Bug 654116 - need pidfile generated for xpcshell process. r=bear, a=test-only
authorJoel Maher <jmaher@mozilla.com>
Thu, 12 May 2011 12:47:38 -0400
changeset 69399 6a34c2c9b880f51339129db48a9e4cbb331b4572
parent 69398 1ed335816a227a6f1fa19eb49fdb968872ac1e69
child 69400 8ad0dfefa6fa95d7cfcae02a57826e93bddfc632
push id19961
push userjmaher@mozilla.com
push dateThu, 12 May 2011 17:10:23 +0000
treeherdermozilla-central@43949eb48546 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbear, test-only
bugs654116
milestone6.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 654116 - need pidfile generated for xpcshell process. r=bear, a=test-only
layout/tools/reftest/remotereftest.py
testing/mochitest/runtestsremote.py
--- a/layout/tools/reftest/remotereftest.py
+++ b/layout/tools/reftest/remotereftest.py
@@ -183,16 +183,17 @@ class ReftestServer:
     def __init__(self, automation, options, scriptDir):
         self._automation = automation
         self._utilityPath = options.utilityPath
         self._xrePath = options.xrePath
         self._profileDir = options.serverProfilePath
         self.webServer = options.remoteWebServer
         self.httpPort = options.httpPort
         self.scriptDir = scriptDir
+        self.pidFile = options.pidFile
         self.shutdownURL = "http://%(server)s:%(port)s/server/shutdown" % { "server" : self.webServer, "port" : self.httpPort }
 
     def start(self):
         "Run the Refest server, returning the process ID of the server."
           
         env = self._automation.environment(xrePath = self._xrePath)
         env["XPCOM_DEBUG_BREAK"] = "warn"
         if self._automation.IS_WIN32:
@@ -209,16 +210,21 @@ class ReftestServer:
                                 "xpcshell" + self._automation.BIN_SUFFIX)
         self._process = self._automation.Process([xpcshell] + args, env = env)
         pid = self._process.pid
         if pid < 0:
             print "Error starting server."
             sys.exit(2)
         self._automation.log.info("INFO | remotereftests.py | Server pid: %d", pid)
 
+        if (self.pidFile != ""):
+            f = open(self.pidFile + ".xpcshell.pid", 'w')
+            f.write("%s" % pid)
+            f.close()
+
     def ensureReady(self, timeout):
         assert timeout >= 0
 
         aliveFile = os.path.join(self._profileDir, "server_alive.txt")
         i = 0
         while i < timeout:
             if os.path.exists(aliveFile):
                 break
@@ -359,16 +365,17 @@ user_pref("capability.principal.codebase
         if (self.remoteLogFile):
             self._devicemanager.getFile(self.remoteLogFile, self.localLogName)
         self._devicemanager.removeDir(self.remoteProfile)
         self._devicemanager.removeDir(self.remoteTestRoot)
         RefTest.cleanup(self, profileDir)
         if (self.pidFile != ""):
             try:
                 os.remove(self.pidFile)
+                os.remove(self.pidFile + ".xpcshell.pid")
             except:
                 print "Warning: cleaning up pidfile '%s' was unsuccessful from the test harness" % self.pidFile
 
 def main():
     dm_none = DeviceManager(None, None)
     automation = RemoteAutomation(dm_none)
     parser = RemoteOptions(automation)
     options, args = parser.parse_args()
--- a/testing/mochitest/runtestsremote.py
+++ b/testing/mochitest/runtestsremote.py
@@ -191,16 +191,17 @@ class MochiRemote(Mochitest):
 
     def cleanup(self, manifest, options):
         self._dm.getFile(self.remoteLog, self.localLog)
         self._dm.removeFile(self.remoteLog)
         self._dm.removeDir(self.remoteProfile)
         if (options.pidFile != ""):
             try:
                 os.remove(options.pidFile)
+                os.remove(options.pidFile + ".xpcshell.pid")
             except:
                 print "Warning: cleaning up pidfile '%s' was unsuccessful from the test harness" % options.pidFile
 
     def findPath(self, paths, filename = None):
         for path in paths:
             p = path
             if filename:
                 p = os.path.join(p, filename)
@@ -246,17 +247,22 @@ class MochiRemote(Mochitest):
         if options.utilityPath == None:
             print "ERROR: unable to find utility path for %s, please specify with --utility-path" % (os.name)
             sys.exit(1)
 
         options.profilePath = tempfile.mkdtemp()
         self.server = MochitestServer(localAutomation, options)
         self.server.start()
 
+        if (options.pidFile != ""):
+            f = open(options.pidFile + ".xpcshell.pid", 'w')
+            f.write("%s" % self.server._process.pid)
+            f.close()
         self.server.ensureReady(self.SERVER_STARTUP_TIMEOUT)
+
         options.xrePath = remoteXrePath
         options.utilityPath = remoteUtilityPath
         options.profilePath = remoteProfilePath
          
     def stopWebServer(self, options):
         self.server.stop()
         
     def buildProfile(self, options):