Bug 1061670 - Log failures in automationutils.py at the warning level for visibility when running locally. r=ahal

This commit is contained in:
Chris Manchester 2014-09-16 22:32:13 -04:00
Родитель 4a35f7937b
Коммит 6a79dce6d7
2 изменённых файлов: 24 добавлений и 11 удалений

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

@ -214,6 +214,7 @@ def processSingleLeakFile(leakLogFileName, processType, leakThreshold):
crashedOnPurpose = False
totalBytesLeaked = None
logAsWarning = False
leakAnalysis = []
leakedObjectNames = []
with open(leakLogFileName, "r") as leaks:
@ -239,12 +240,18 @@ def processSingleLeakFile(leakLogFileName, processType, leakThreshold):
if size < 0 or bytesLeaked < 0 or numLeaked < 0:
leakAnalysis.append("TEST-UNEXPECTED-FAIL | leakcheck |%s negative leaks caught!"
% processString)
logAsWarning = True
continue
if name != "TOTAL" and numLeaked != 0:
leakedObjectNames.append(name)
leakAnalysis.append("TEST-INFO | leakcheck |%s leaked %d %s (%s bytes)"
% (processString, numLeaked, name, bytesLeaked))
log.info('\n'.join(leakAnalysis))
if logAsWarning:
log.warning('\n'.join(leakAnalysis))
else:
log.info('\n'.join(leakAnalysis))
logAsWarning = False
if totalBytesLeaked is None:
# We didn't see a line with name 'TOTAL'
@ -269,6 +276,7 @@ def processSingleLeakFile(leakLogFileName, processType, leakThreshold):
log.info("WARNING | leakcheck | ignoring leaks in tab process")
prefix = "WARNING"
else:
logAsWarning = True
# Fail the run if we're over the threshold (which defaults to 0)
prefix = "TEST-UNEXPECTED-FAIL"
else:
@ -280,8 +288,13 @@ def processSingleLeakFile(leakLogFileName, processType, leakThreshold):
leakedObjectSummary = ', '.join(leakedObjectNames[:maxSummaryObjects])
if len(leakedObjectNames) > maxSummaryObjects:
leakedObjectSummary += ', ...'
log.info("%s | leakcheck |%s %d bytes leaked (%s)"
% (prefix, processString, totalBytesLeaked, leakedObjectSummary))
if logAsWarning:
log.warning("%s | leakcheck |%s %d bytes leaked (%s)"
% (prefix, processString, totalBytesLeaked, leakedObjectSummary))
else:
log.info("%s | leakcheck |%s %d bytes leaked (%s)"
% (prefix, processString, totalBytesLeaked, leakedObjectSummary))
def processLeakLog(leakLogFile, leakThreshold = 0):
"""Process the leak log, including separate leak logs created
@ -520,14 +533,14 @@ class ShutdownLeaks(object):
def process(self):
if not self.seenShutdown:
self.logger("TEST-UNEXPECTED-FAIL | ShutdownLeaks | process() called before end of test suite")
self.logger.warning("TEST-UNEXPECTED-FAIL | ShutdownLeaks | process() called before end of test suite")
for test in self._parseLeakingTests():
for url, count in self._zipLeakedWindows(test["leakedWindows"]):
self.logger("TEST-UNEXPECTED-FAIL | %s | leaked %d window(s) until shutdown [url = %s]" % (test["fileName"], count, url))
self.logger.warning("TEST-UNEXPECTED-FAIL | %s | leaked %d window(s) until shutdown [url = %s]" % (test["fileName"], count, url))
if test["leakedDocShells"]:
self.logger("TEST-UNEXPECTED-FAIL | %s | leaked %d docShell(s) until shutdown" % (test["fileName"], len(test["leakedDocShells"])))
self.logger.warning("TEST-UNEXPECTED-FAIL | %s | leaked %d docShell(s) until shutdown" % (test["fileName"], len(test["leakedDocShells"])))
def _logWindow(self, line):
created = line[:2] == "++"
@ -536,7 +549,7 @@ class ShutdownLeaks(object):
# log line has invalid format
if not pid or not serial:
self.logger("TEST-UNEXPECTED-FAIL | ShutdownLeaks | failed to parse line <%s>" % line)
self.logger.warning("TEST-UNEXPECTED-FAIL | ShutdownLeaks | failed to parse line <%s>" % line)
return
key = pid + "." + serial
@ -557,7 +570,7 @@ class ShutdownLeaks(object):
# log line has invalid format
if not pid or not id:
self.logger("TEST-UNEXPECTED-FAIL | ShutdownLeaks | failed to parse line <%s>" % line)
self.logger.warning("TEST-UNEXPECTED-FAIL | ShutdownLeaks | failed to parse line <%s>" % line)
return
key = pid + "." + id
@ -679,7 +692,7 @@ class LSANLeaks(object):
def process(self):
for f in self.foundFrames:
self.logger("TEST-UNEXPECTED-FAIL | LeakSanitizer | leak at " + f)
self.logger.warning("TEST-UNEXPECTED-FAIL | LeakSanitizer | leak at " + f)
def _finishStack(self):
if self.recordMoreFrames and len(self.currStack) == 0:

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

@ -1412,12 +1412,12 @@ class Mochitest(MochitestUtilsMixin):
args.append(testUrl)
if detectShutdownLeaks:
shutdownLeaks = ShutdownLeaks(self.log.info)
shutdownLeaks = ShutdownLeaks(self.log)
else:
shutdownLeaks = None
if mozinfo.info["asan"] and (mozinfo.isLinux or mozinfo.isMac):
lsanLeaks = LSANLeaks(self.log.info)
lsanLeaks = LSANLeaks(self.log)
else:
lsanLeaks = None