Bug 1160351 - Improve newline handling in getLogcat; r=bc
authorGeoff Brown <gbrown@mozilla.com>
Mon, 04 May 2015 10:32:44 -0600
changeset 242287 57c6c589cfa1115645df5d0bad32e11b1f5a3302
parent 242286 312707328997a7ed66ae71ff70d605e49853b24a
child 242288 75514dac86e93d48c78f871943680870b46b3d59
push id28689
push usercbook@mozilla.com
push dateTue, 05 May 2015 10:05:09 +0000
treeherderautoland@754579ec0e68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbc
bugs1160351
milestone40.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 1160351 - Improve newline handling in getLogcat; r=bc
testing/mozbase/mozcrash/mozcrash/mozcrash.py
testing/mozbase/mozdevice/mozdevice/devicemanager.py
--- a/testing/mozbase/mozcrash/mozcrash/mozcrash.py
+++ b/testing/mozbase/mozcrash/mozcrash/mozcrash.py
@@ -330,12 +330,12 @@ def check_for_java_exception(logcat, qui
                 if m and m.group(1):
                     exception_type = m.group(1)
                 m = logre.search(logcat[i+2])
                 if m and m.group(1):
                     exception_location = m.group(1)
                 if not quiet:
                     print "PROCESS-CRASH | java-exception | %s %s" % (exception_type, exception_location)
             else:
-                print "Automation Error: Logcat is truncated!"
+                print "Automation Error: java exception in logcat at line %d of %d: %s" % (i, len(logcat), line)
             break
 
     return found_exception
--- a/testing/mozbase/mozdevice/mozdevice/devicemanager.py
+++ b/testing/mozbase/mozdevice/mozdevice/devicemanager.py
@@ -147,21 +147,23 @@ class DeviceManager(object):
         self.shellCheckOutput(['/system/bin/logcat', '-c'], root=self._logcatNeedsRoot)
 
     def getLogcat(self, filterSpecs=["dalvikvm:I", "ConnectivityService:S",
                                       "WifiMonitor:S", "WifiStateTracker:S",
                                       "wpa_supplicant:S", "NetworkStateTracker:S"],
                   format="time",
                   filterOutRegexps=[]):
         """
-        Returns the contents of the logcat file as a list of strings
+        Returns the contents of the logcat file as a list of
+        '\n' terminated strings
         """
         cmdline = ["/system/bin/logcat", "-v", format, "-d"] + filterSpecs
-        lines = self.shellCheckOutput(cmdline,
-                                      root=self._logcatNeedsRoot).split('\r')
+        output = self.shellCheckOutput(cmdline,
+                                      root=self._logcatNeedsRoot)
+        lines = output.replace('\r\n', '\n').splitlines(keepends=True)
 
         for regex in filterOutRegexps:
             lines = [line for line in lines if not re.search(regex, line)]
 
         return lines
 
     def saveScreenshot(self, filename):
         """