Bug 850681 - Part 6: Clean up log parsing conditionals & move the leak threshold reminder to the calling function; r=ted

The same threshold is used for all leak logs processed from the test run, so
unnecessary to repeat for each.
This commit is contained in:
Ed Morley 2013-03-18 17:18:06 +00:00
parent fff4f9ec3d
commit 09a9fa4aec

View File

@ -334,18 +334,16 @@ def processSingleLeakFile(leakLogFileName, PID, processType, leakThreshold):
size = int(matches.group("size"))
bytesLeaked = int(matches.group("bytesLeaked"))
numLeaked = int(matches.group("numLeaked"))
if name == "TOTAL":
totalBytesLeaked = bytesLeaked
if size < 0 or bytesLeaked < 0 or numLeaked < 0:
log.info("TEST-UNEXPECTED-FAIL %s| leakcheck | negative leaks caught!" %
processString)
if name == "TOTAL":
totalBytesLeaked = bytesLeaked
elif name == "TOTAL":
totalBytesLeaked = bytesLeaked
else:
if numLeaked != 0:
leakedObjectNames.append(name)
log.info("TEST-INFO %s| leakcheck | leaked %d %s (%s bytes)"
% (processString, numLeaked, name, bytesLeaked))
continue
if name != "TOTAL" and numLeaked != 0:
leakedObjectNames.append(name)
log.info("TEST-INFO %s| leakcheck | leaked %d %s (%s bytes)"
% (processString, numLeaked, name, bytesLeaked))
if totalBytesLeaked is None:
# We didn't see a line with name 'TOTAL'
@ -376,9 +374,6 @@ def processSingleLeakFile(leakLogFileName, PID, processType, leakThreshold):
leakedObjectSummary += ', ...'
log.info("%s %s| leakcheck | %d bytes leaked (%s)"
% (prefix, processString, totalBytesLeaked, leakedObjectSummary))
# Remind the threshold if it is not 0, which is the default/goal.
if leakThreshold != 0:
log.info("TEST-INFO | leakcheck | threshold set at %d bytes" % leakThreshold)
leaks.close()
def processLeakLog(leakLogFile, leakThreshold = 0):
@ -393,6 +388,9 @@ def processLeakLog(leakLogFile, leakThreshold = 0):
log.info("WARNING | leakcheck | refcount logging is off, so leaks can't be detected!")
return
if leakThreshold != 0:
log.info("TEST-INFO | leakcheck | threshold set at %d bytes" % leakThreshold)
(leakLogFileDir, leakFileBase) = os.path.split(leakLogFile)
pidRegExp = re.compile(r".*?_([a-z]*)_pid(\d*)$")
if leakFileBase[-4:] == ".log":