зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1061670 - Log failures in automationutils.py at the warning level for visibility when running locally. r=ahal
This commit is contained in:
Родитель
4a35f7937b
Коммит
6a79dce6d7
|
@ -214,6 +214,7 @@ def processSingleLeakFile(leakLogFileName, processType, leakThreshold):
|
|||
|
||||
crashedOnPurpose = False
|
||||
totalBytesLeaked = None
|
||||
logAsWarning = False
|
||||
leakAnalysis = []
|
||||
leakedObjectNames = []
|
||||
with open(leakLogFileName, "r") as leaks:
|
||||
|
@ -239,13 +240,19 @@ 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))
|
||||
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'
|
||||
if crashedOnPurpose:
|
||||
|
@ -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,6 +288,11 @@ def processSingleLeakFile(leakLogFileName, processType, leakThreshold):
|
|||
leakedObjectSummary = ', '.join(leakedObjectNames[:maxSummaryObjects])
|
||||
if len(leakedObjectNames) > maxSummaryObjects:
|
||||
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))
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче