Bug 482236 - runtests.py.in : wrong leak detection on this case; (Av1a) Support a negative 'Total' value; r=(dbaron + jwalden+bmo)
--- a/build/automation.py.in
+++ b/build/automation.py.in
@@ -436,17 +436,17 @@ def processLeakLog(leakLogFile, leakThre
log.info("WARNING refcount logging is off, so leaks can't be detected!")
return
# Per-Inst Leaked Total Rem ...
# 0 TOTAL 17 192 419115886 2 ...
# 833 nsTimerImpl 60 120 24726 2 ...
lineRe = re.compile(r"^\s*\d+\s+(?P<name>\S+)\s+"
r"(?P<size>-?\d+)\s+(?P<bytesLeaked>-?\d+)\s+"
- r"\d+\s+(?P<numLeaked>-?\d+)")
+ r"-?\d+\s+(?P<numLeaked>-?\d+)")
leaks = open(leakLogFile, "r")
for line in leaks:
matches = lineRe.match(line)
if (matches and
int(matches.group("numLeaked")) == 0 and
matches.group("name") != "TOTAL"):
continue
@@ -461,17 +461,19 @@ def processLeakLog(leakLogFile, leakThre
if not matches:
continue
name = matches.group("name")
size = int(matches.group("size"))
bytesLeaked = int(matches.group("bytesLeaked"))
numLeaked = int(matches.group("numLeaked"))
if size < 0 or bytesLeaked < 0 or numLeaked < 0:
log.info("TEST-UNEXPECTED-FAIL | runtests-leaks | negative leaks caught!")
- if "TOTAL" == name:
+ if name == "TOTAL":
+ seenTotal = True
+ elif name == "TOTAL":
seenTotal = True
# Check for leaks.
if bytesLeaked < 0 or bytesLeaked > leakThreshold:
prefix = "TEST-UNEXPECTED-FAIL"
leakLog = "TEST-UNEXPECTED-FAIL | runtests-leaks | leaked" \
" %d bytes during test execution" % bytesLeaked
elif bytesLeaked > 0:
leakLog = "TEST-PASS | runtests-leaks | WARNING leaked" \
@@ -480,17 +482,17 @@ def processLeakLog(leakLogFile, leakThre
leakLog = "TEST-PASS | runtests-leaks | no leaks detected!"
# Remind the threshold if it is not 0, which is the default/goal.
if leakThreshold != 0:
leakLog += " (threshold set at %d bytes)" % leakThreshold
# Log the information.
log.info(leakLog)
else:
if numLeaked != 0:
- if abs(numLeaked) > 1:
+ if numLeaked > 1:
instance = "instances"
rest = " each (%s bytes total)" % matches.group("bytesLeaked")
else:
instance = "instance"
rest = ""
log.info("%(prefix)s | runtests-leaks | leaked %(numLeaked)d %(instance)s of %(name)s "
"with size %(size)s bytes%(rest)s" %
{ "prefix": prefix,