Bug 1067664, part 1 - Allow different leak thresholds for different types of processes. r=jmaher
This commit is contained in:
@@ -311,7 +311,7 @@ def processSingleLeakFile(leakLogFileName, processType, leakThreshold):
|
||||
log.info("%s | leakcheck | %s %d bytes leaked (%s)"
|
||||
% (prefix, processString, totalBytesLeaked, leakedObjectSummary))
|
||||
|
||||
def processLeakLog(leakLogFile, leakThreshold = 0):
|
||||
def processLeakLog(leakLogFile, leakThresholds):
|
||||
"""Process the leak log, including separate leak logs created
|
||||
by child processes.
|
||||
|
||||
@@ -326,14 +326,28 @@ def processLeakLog(leakLogFile, leakThreshold = 0):
|
||||
optional.
|
||||
|
||||
All other file names are treated as being for default processes.
|
||||
|
||||
leakThresholds should be a dict mapping process types to leak thresholds,
|
||||
in bytes. If a process type is not present in the dict the threshold
|
||||
will be 0.
|
||||
"""
|
||||
|
||||
if not os.path.exists(leakLogFile):
|
||||
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)
|
||||
# This list is based on kGeckoProcessTypeString. ipdlunittest processes likely
|
||||
# are not going to produce leak logs we will ever see.
|
||||
knownProcessTypes = ["default", "plugin", "tab", "geckomediaplugin"]
|
||||
|
||||
for processType in knownProcessTypes:
|
||||
log.info("TEST-INFO | leakcheck | %s process: leak threshold set at %d bytes"
|
||||
% (processType, leakThresholds.get(processType, 0)))
|
||||
|
||||
for processType in leakThresholds:
|
||||
if not processType in knownProcessTypes:
|
||||
log.info("TEST-UNEXPECTED-FAIL | leakcheck | Unknown process type %s in leakThresholds"
|
||||
% processType)
|
||||
|
||||
(leakLogFileDir, leakFileBase) = os.path.split(leakLogFile)
|
||||
if leakFileBase[-4:] == ".log":
|
||||
@@ -350,6 +364,10 @@ def processLeakLog(leakLogFile, leakThreshold = 0):
|
||||
processType = m.group(1)
|
||||
else:
|
||||
processType = "default"
|
||||
if not processType in knownProcessTypes:
|
||||
log.info("TEST-UNEXPECTED-FAIL | leakcheck | Leak log with unknown process type %s"
|
||||
% processType)
|
||||
leakThreshold = leakThresholds.get(processType, 0)
|
||||
processSingleLeakFile(thisFile, processType, leakThreshold)
|
||||
|
||||
def replaceBackSlashes(input):
|
||||
|
||||
Reference in New Issue
Block a user