Bug 872244 - Dump ANR stack traces after Android tests; r=jmaher
authorGeoff Brown <gbrown@mozilla.com>
Thu, 16 May 2013 14:32:52 -0600
changeset 143652 88c2b93e07484c83f8ed219a5fc8fa5cdf8a8dbf
parent 143651 7abf0aab9cdec7332c154cacc6260235119b25fc
child 143653 ca7e571932c3020c8799d29447d6b1ed84930478
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs872244
milestone24.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 872244 - Dump ANR stack traces after Android tests; r=jmaher
build/mobile/remoteautomation.py
layout/tools/reftest/remotereftest.py
testing/mochitest/runtestsremote.py
--- a/build/mobile/remoteautomation.py
+++ b/build/mobile/remoteautomation.py
@@ -111,17 +111,43 @@ class RemoteAutomation(Automation):
                     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 deleteANRs(self):
+        # delete ANR traces.txt file; usually need root permissions
+        traces = "/data/anr/traces.txt"
+        try:
+            self._devicemanager.shellCheckOutput(['rm', traces], root=True)
+        except DMError:
+            print "Error deleting %s" % traces
+            pass
+
+    def checkForANRs(self):
+        traces = "/data/anr/traces.txt"
+        if self._devicemanager.fileExists(traces):
+            try:
+                t = self._devicemanager.pullFile(traces)
+                print "Contents of %s:" % traces
+                print t
+                # Once reported, delete traces
+                self.deleteANRs()
+            except DMError:
+                print "Error pulling %s" % traces
+                pass
+        else:
+            print "%s not found" % traces
+
     def checkForCrashes(self, directory, symbolsPath):
+        self.checkForANRs()
+
         logcat = self._devicemanager.getLogcat(filterOutRegexps=fennecLogcatFilters)
         javaException = self.checkForJavaException(logcat)
         if javaException:
             return True
 
         # If crash reporting is disabled (MOZ_CRASHREPORTER!=1), we can't say
         # anything.
         if not self.CRASHREPORTER:
--- a/layout/tools/reftest/remotereftest.py
+++ b/layout/tools/reftest/remotereftest.py
@@ -250,16 +250,17 @@ 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:
             self.SERVER_STARTUP_TIMEOUT = 90
+        self.automation.deleteANRs()
 
     def findPath(self, paths, filename = None):
         for path in paths:
             p = path
             if filename:
                 p = os.path.join(p, filename)
             if os.path.exists(self.getFullPath(p)):
                 return path
--- a/testing/mochitest/runtestsremote.py
+++ b/testing/mochitest/runtestsremote.py
@@ -207,16 +207,17 @@ class MochiRemote(Mochitest):
         self._automation = automation
         Mochitest.__init__(self, self._automation)
         self._dm = devmgr
         self.runSSLTunnel = False
         self.remoteProfile = options.remoteTestRoot + "/profile"
         self._automation.setRemoteProfile(self.remoteProfile)
         self.remoteLog = options.remoteLogFile
         self.localLog = options.logFile
+        self._automation.deleteANRs()
 
     def cleanup(self, manifest, options):
         if self._dm.fileExists(self.remoteLog):
             self._dm.getFile(self.remoteLog, self.localLog)
             self._dm.removeFile(self.remoteLog)
         else:
             print "WARNING: Unable to retrieve log file (%s) from remote " \
                 "device" % self.remoteLog