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:
@@ -334,18 +334,16 @@ def processSingleLeakFile(leakLogFileName, PID, processType, leakThreshold):
|
|||||||
size = int(matches.group("size"))
|
size = int(matches.group("size"))
|
||||||
bytesLeaked = int(matches.group("bytesLeaked"))
|
bytesLeaked = int(matches.group("bytesLeaked"))
|
||||||
numLeaked = int(matches.group("numLeaked"))
|
numLeaked = int(matches.group("numLeaked"))
|
||||||
|
if name == "TOTAL":
|
||||||
|
totalBytesLeaked = bytesLeaked
|
||||||
if size < 0 or bytesLeaked < 0 or numLeaked < 0:
|
if size < 0 or bytesLeaked < 0 or numLeaked < 0:
|
||||||
log.info("TEST-UNEXPECTED-FAIL %s| leakcheck | negative leaks caught!" %
|
log.info("TEST-UNEXPECTED-FAIL %s| leakcheck | negative leaks caught!" %
|
||||||
processString)
|
processString)
|
||||||
if name == "TOTAL":
|
continue
|
||||||
totalBytesLeaked = bytesLeaked
|
if name != "TOTAL" and numLeaked != 0:
|
||||||
elif name == "TOTAL":
|
leakedObjectNames.append(name)
|
||||||
totalBytesLeaked = bytesLeaked
|
log.info("TEST-INFO %s| leakcheck | leaked %d %s (%s bytes)"
|
||||||
else:
|
% (processString, numLeaked, name, bytesLeaked))
|
||||||
if numLeaked != 0:
|
|
||||||
leakedObjectNames.append(name)
|
|
||||||
log.info("TEST-INFO %s| leakcheck | leaked %d %s (%s bytes)"
|
|
||||||
% (processString, numLeaked, name, bytesLeaked))
|
|
||||||
|
|
||||||
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'
|
||||||
@@ -376,9 +374,6 @@ def processSingleLeakFile(leakLogFileName, PID, processType, leakThreshold):
|
|||||||
leakedObjectSummary += ', ...'
|
leakedObjectSummary += ', ...'
|
||||||
log.info("%s %s| leakcheck | %d bytes leaked (%s)"
|
log.info("%s %s| leakcheck | %d bytes leaked (%s)"
|
||||||
% (prefix, processString, totalBytesLeaked, leakedObjectSummary))
|
% (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()
|
leaks.close()
|
||||||
|
|
||||||
def processLeakLog(leakLogFile, leakThreshold = 0):
|
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!")
|
log.info("WARNING | leakcheck | refcount logging is off, so leaks can't be detected!")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if leakThreshold != 0:
|
||||||
|
log.info("TEST-INFO | leakcheck | threshold set at %d bytes" % leakThreshold)
|
||||||
|
|
||||||
(leakLogFileDir, leakFileBase) = os.path.split(leakLogFile)
|
(leakLogFileDir, leakFileBase) = os.path.split(leakLogFile)
|
||||||
pidRegExp = re.compile(r".*?_([a-z]*)_pid(\d*)$")
|
pidRegExp = re.compile(r".*?_([a-z]*)_pid(\d*)$")
|
||||||
if leakFileBase[-4:] == ".log":
|
if leakFileBase[-4:] == ".log":
|
||||||
|
|||||||
Reference in New Issue
Block a user