Skip to content

Commit

Permalink
Bug 1160351 - Improve newline handling in getLogcat; r=bc
Browse files Browse the repository at this point in the history
  • Loading branch information
gbrownmozilla committed May 4, 2015
1 parent 47e7595 commit 8f916d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion testing/mozbase/mozcrash/mozcrash/mozcrash.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def check_for_java_exception(logcat, quiet=False):
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
8 changes: 5 additions & 3 deletions testing/mozbase/mozdevice/mozdevice/devicemanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,13 @@ def getLogcat(self, filterSpecs=["dalvikvm:I", "ConnectivityService: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)]
Expand Down

0 comments on commit 8f916d8

Please sign in to comment.