Bug 650828 - change runtestremote and remotereftests to generate pid file. r=ctalbert

This commit is contained in:
Joel Maher 2011-04-19 15:17:01 -07:00
parent 81d4a765c4
commit c491e58d06
2 changed files with 32 additions and 0 deletions

View File

@ -101,6 +101,12 @@ class RemoteOptions(ReftestOptions):
type = "string", dest = "remoteLogFile",
help = "Name of log file on the device relative to device root. PLEASE USE ONLY A FILENAME.")
defaults["remoteLogFile"] = None
self.add_option("--pidfile", action = "store",
type = "string", dest = "pidFile",
help = "name of the pidfile to generate")
defaults["pidFile"] = ""
defaults["localLogName"] = None
self.set_defaults(**defaults)
@ -153,6 +159,11 @@ class RemoteOptions(ReftestOptions):
options.logFile = options.remoteLogFile
if (options.pidFile != ""):
f = open(options.pidFile, 'w')
f.write("%s" % os.getpid())
f.close()
# TODO: Copied from main, but I think these are no longer used in a post xulrunner world
#options.xrePath = options.remoteTestRoot + self._automation._product + '/xulrunner'
#options.utilityPath = options.testRoot + self._automation._product + '/bin'
@ -238,6 +249,7 @@ class RemoteReftest(RefTest):
self.remoteTestRoot = options.remoteTestRoot
self.remoteLogFile = options.remoteLogFile
self.localLogName = options.localLogName
self.pidFile = options.pidFile
if self.automation.IS_DEBUG_BUILD:
self.SERVER_STARTUP_TIMEOUT = 180
else:
@ -336,6 +348,11 @@ class RemoteReftest(RefTest):
self._devicemanager.removeDir(self.remoteProfile)
self._devicemanager.removeDir(self.remoteTestRoot)
RefTest.cleanup(self, profileDir)
if (self.pidFile != ""):
try:
os.remove(self.pidFile)
except:
print "Warning: cleaning up pidfile '%s' was unsuccessful from the test harness" % self.pidFile
def main():
dm_none = DeviceManager(None, None)

View File

@ -96,6 +96,11 @@ class RemoteOptions(MochitestOptions):
help = "ip address where the remote web server is hosted at")
defaults["sslPort"] = automation.DEFAULT_SSL_PORT
self.add_option("--pidfile", action = "store",
type = "string", dest = "pidFile",
help = "name of the pidfile to generate")
defaults["pidFile"] = ""
defaults["remoteTestRoot"] = None
defaults["logFile"] = "mochitest.log"
defaults["autorun"] = True
@ -149,6 +154,11 @@ class RemoteOptions(MochitestOptions):
else:
options.xrePath = options.utilityPath
if (options.pidFile != ""):
f = open(options.pidFile, 'w')
f.write("%s" % os.getpid())
f.close()
return options
def verifyOptions(self, options, mochitest):
@ -183,6 +193,11 @@ class MochiRemote(Mochitest):
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)
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: