Bug 1061670 - Log failures in automationutils.py at the warning level for visibility when running locally. r=ahal
This commit is contained in:
@@ -214,6 +214,7 @@ def processSingleLeakFile(leakLogFileName, processType, leakThreshold):
|
|||||||
|
|
||||||
crashedOnPurpose = False
|
crashedOnPurpose = False
|
||||||
totalBytesLeaked = None
|
totalBytesLeaked = None
|
||||||
|
logAsWarning = False
|
||||||
leakAnalysis = []
|
leakAnalysis = []
|
||||||
leakedObjectNames = []
|
leakedObjectNames = []
|
||||||
with open(leakLogFileName, "r") as leaks:
|
with open(leakLogFileName, "r") as leaks:
|
||||||
@@ -239,12 +240,18 @@ def processSingleLeakFile(leakLogFileName, processType, leakThreshold):
|
|||||||
if size < 0 or bytesLeaked < 0 or numLeaked < 0:
|
if size < 0 or bytesLeaked < 0 or numLeaked < 0:
|
||||||
leakAnalysis.append("TEST-UNEXPECTED-FAIL | leakcheck |%s negative leaks caught!"
|
leakAnalysis.append("TEST-UNEXPECTED-FAIL | leakcheck |%s negative leaks caught!"
|
||||||
% processString)
|
% processString)
|
||||||
|
logAsWarning = True
|
||||||
continue
|
continue
|
||||||
if name != "TOTAL" and numLeaked != 0:
|
if name != "TOTAL" and numLeaked != 0:
|
||||||
leakedObjectNames.append(name)
|
leakedObjectNames.append(name)
|
||||||
leakAnalysis.append("TEST-INFO | leakcheck |%s leaked %d %s (%s bytes)"
|
leakAnalysis.append("TEST-INFO | leakcheck |%s leaked %d %s (%s bytes)"
|
||||||
% (processString, numLeaked, name, bytesLeaked))
|
% (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:
|
if totalBytesLeaked is None:
|
||||||
# We didn't see a line with name 'TOTAL'
|
# 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")
|
log.info("WARNING | leakcheck | ignoring leaks in tab process")
|
||||||
prefix = "WARNING"
|
prefix = "WARNING"
|
||||||
else:
|
else:
|
||||||
|
logAsWarning = True
|
||||||
# Fail the run if we're over the threshold (which defaults to 0)
|
# Fail the run if we're over the threshold (which defaults to 0)
|
||||||
prefix = "TEST-UNEXPECTED-FAIL"
|
prefix = "TEST-UNEXPECTED-FAIL"
|
||||||
else:
|
else:
|
||||||
@@ -280,8 +288,13 @@ def processSingleLeakFile(leakLogFileName, processType, leakThreshold):
|
|||||||
leakedObjectSummary = ', '.join(leakedObjectNames[:maxSummaryObjects])
|
leakedObjectSummary = ', '.join(leakedObjectNames[:maxSummaryObjects])
|
||||||
if len(leakedObjectNames) > maxSummaryObjects:
|
if len(leakedObjectNames) > maxSummaryObjects:
|
||||||
leakedObjectSummary += ', ...'
|
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):
|
def processLeakLog(leakLogFile, leakThreshold = 0):
|
||||||
"""Process the leak log, including separate leak logs created
|
"""Process the leak log, including separate leak logs created
|
||||||
@@ -520,14 +533,14 @@ class ShutdownLeaks(object):
|
|||||||
|
|
||||||
def process(self):
|
def process(self):
|
||||||
if not self.seenShutdown:
|
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 test in self._parseLeakingTests():
|
||||||
for url, count in self._zipLeakedWindows(test["leakedWindows"]):
|
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"]:
|
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):
|
def _logWindow(self, line):
|
||||||
created = line[:2] == "++"
|
created = line[:2] == "++"
|
||||||
@@ -536,7 +549,7 @@ class ShutdownLeaks(object):
|
|||||||
|
|
||||||
# log line has invalid format
|
# log line has invalid format
|
||||||
if not pid or not serial:
|
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
|
return
|
||||||
|
|
||||||
key = pid + "." + serial
|
key = pid + "." + serial
|
||||||
@@ -557,7 +570,7 @@ class ShutdownLeaks(object):
|
|||||||
|
|
||||||
# log line has invalid format
|
# log line has invalid format
|
||||||
if not pid or not id:
|
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
|
return
|
||||||
|
|
||||||
key = pid + "." + id
|
key = pid + "." + id
|
||||||
@@ -679,7 +692,7 @@ class LSANLeaks(object):
|
|||||||
|
|
||||||
def process(self):
|
def process(self):
|
||||||
for f in self.foundFrames:
|
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):
|
def _finishStack(self):
|
||||||
if self.recordMoreFrames and len(self.currStack) == 0:
|
if self.recordMoreFrames and len(self.currStack) == 0:
|
||||||
|
|||||||
@@ -1412,12 +1412,12 @@ class Mochitest(MochitestUtilsMixin):
|
|||||||
args.append(testUrl)
|
args.append(testUrl)
|
||||||
|
|
||||||
if detectShutdownLeaks:
|
if detectShutdownLeaks:
|
||||||
shutdownLeaks = ShutdownLeaks(self.log.info)
|
shutdownLeaks = ShutdownLeaks(self.log)
|
||||||
else:
|
else:
|
||||||
shutdownLeaks = None
|
shutdownLeaks = None
|
||||||
|
|
||||||
if mozinfo.info["asan"] and (mozinfo.isLinux or mozinfo.isMac):
|
if mozinfo.info["asan"] and (mozinfo.isLinux or mozinfo.isMac):
|
||||||
lsanLeaks = LSANLeaks(self.log.info)
|
lsanLeaks = LSANLeaks(self.log)
|
||||||
else:
|
else:
|
||||||
lsanLeaks = None
|
lsanLeaks = None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user