Bug 1027802 - Try to get ANR report and stack trace when Fennec hangs; r=jmaher

This commit is contained in:
Geoff Brown 2014-07-03 22:11:41 -06:00
Родитель 842d9dfddd
Коммит b4e0468ee6
2 изменённых файлов: 50 добавлений и 16 удалений

Просмотреть файл

@ -86,7 +86,7 @@ class RemoteAutomation(Automation):
topActivity = self._devicemanager.getTopActivity()
if topActivity == proc.procName:
proc.kill()
proc.kill(True)
if status == 1:
if maxTime:
print "TEST-UNEXPECTED-FAIL | %s | application ran for longer than " \
@ -287,5 +287,26 @@ class RemoteAutomation(Automation):
return status
def kill(self):
self.dm.killProcess(self.procName)
def kill(self, stagedShutdown = False):
if stagedShutdown:
# Trigger an ANR report with "kill -3" (SIGQUIT)
self.dm.killProcess(self.procName, 3)
time.sleep(3)
# Trigger a breakpad dump with "kill -6" (SIGABRT)
self.dm.killProcess(self.procName, 6)
# Wait for process to end
retries = 0
while retries < 3:
pid = self.dm.processExist(self.procName)
if pid and pid > 0:
print "%s still alive after SIGABRT: waiting..." % self.procName
time.sleep(5)
else:
return
retries += 1
self.dm.killProcess(self.procName, 9)
pid = self.dm.processExist(self.procName)
if pid and pid > 0:
self.dm.killProcess(self.procName)
else:
self.dm.killProcess(self.procName)

Просмотреть файл

@ -537,20 +537,33 @@ class DeviceManagerSUT(DeviceManager):
def killProcess(self, appname, sig=None):
if sig:
self._logger.warn("killProcess(): sig parameter unsupported on SUT")
retries = 0
while retries < self.retryLimit:
try:
if self.processExist(appname):
self._runCmds([{ 'cmd': 'kill ' + appname }])
return
except DMError, err:
retries +=1
self._logger.warn("try %d of %d failed to kill %s" %
(retries, self.retryLimit, appname))
self._logger.debug(err)
if retries >= self.retryLimit:
pid = self.processExist(appname)
if pid and pid > 0:
try:
self.shellCheckOutput(['kill', '-%d' % sig, str(pid)],
root=True)
except DMError, err:
self._logger.warn("unable to kill -%d %s (pid %s)" %
(sig, appname, str(pid)))
self._logger.debug(err)
raise err
else:
self._logger.warn("unable to kill -%d %s -- not running?" %
(sig, appname))
else:
retries = 0
while retries < self.retryLimit:
try:
if self.processExist(appname):
self._runCmds([{ 'cmd': 'kill ' + appname }])
return
except DMError, err:
retries += 1
self._logger.warn("try %d of %d failed to kill %s" %
(retries, self.retryLimit, appname))
self._logger.debug(err)
if retries >= self.retryLimit:
raise err
def getTempDir(self):
return self._runCmds([{ 'cmd': 'tmpd' }]).strip()