Bug 823452: Check logcat for Java exceptions; r=jmaher

This commit is contained in:
Geoff Brown 2013-02-13 11:42:15 -07:00
Родитель 3d174e413f
Коммит 8f0f5d7559
1 изменённых файлов: 34 добавлений и 0 удалений

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

@ -87,7 +87,41 @@ class RemoteAutomation(Automation):
return status
def checkForJavaException(self, logcat):
found_exception = False
for i, line in enumerate(logcat):
if "REPORTING UNCAUGHT EXCEPTION" in line:
# Strip away the date, time, logcat tag and pid from the next two lines and
# concatenate the remainder to form a concise summary of the exception.
#
# For example:
#
# 01-30 20:15:41.937 E/GeckoAppShell( 1703): >>> REPORTING UNCAUGHT EXCEPTION FROM THREAD 9 ("GeckoBackgroundThread")
# 01-30 20:15:41.937 E/GeckoAppShell( 1703): java.lang.NullPointerException
# 01-30 20:15:41.937 E/GeckoAppShell( 1703): at org.mozilla.gecko.GeckoApp$21.run(GeckoApp.java:1833)
# 01-30 20:15:41.937 E/GeckoAppShell( 1703): at android.os.Handler.handleCallback(Handler.java:587)
# 01-30 20:15:41.937 E/GeckoAppShell( 1703): at android.os.Handler.dispatchMessage(Handler.java:92)
# 01-30 20:15:41.937 E/GeckoAppShell( 1703): at android.os.Looper.loop(Looper.java:123)
# 01-30 20:15:41.937 E/GeckoAppShell( 1703): at org.mozilla.gecko.util.GeckoBackgroundThread.run(GeckoBackgroundThread.java:31)
#
# -> java.lang.NullPointerException at org.mozilla.gecko.GeckoApp$21.run(GeckoApp.java:1833)
found_exception = True
logre = re.compile(r".*\):\s(.*)")
m = logre.search(logcat[i+1])
if m and m.group(1):
top_frame = m.group(1)
m = logre.search(logcat[i+2])
if m and m.group(1):
top_frame = top_frame + m.group(1)
print "PROCESS-CRASH | java-exception | %s" % top_frame
break
return found_exception
def checkForCrashes(self, directory, symbolsPath):
logcat = self._devicemanager.getLogcat(filterOutRegexps=fennecLogcatFilters)
javaException = self.checkForJavaException(logcat)
if javaException:
return True
try:
remoteCrashDir = self._remoteProfile + '/minidumps/'
if not self._devicemanager.dirExists(remoteCrashDir):