зеркало из https://github.com/mozilla/pjs.git
Bug 469518 - Enable Reftest leak log in tinderbox (log); (Bv1b) Move leak log parsing code to automation.py.in from runtests.py.in; r=jwalden+bmo
This commit is contained in:
Родитель
278afa8413
Коммит
b5a0c2c171
|
@ -407,6 +407,80 @@ def environment(env = None, xrePath = DIST_BIN):
|
|||
# RUN THE APP #
|
||||
###############
|
||||
|
||||
def processLeakLog(LEAK_REPORT_FILE, leakThreshold):
|
||||
"Process the leak log."
|
||||
|
||||
if not os.path.exists(LEAK_REPORT_FILE):
|
||||
log.info("WARNING refcount logging is off, so leaks can't be detected!")
|
||||
else:
|
||||
# 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+)")
|
||||
|
||||
leaks = open(LEAK_REPORT_FILE, "r")
|
||||
for line in leaks:
|
||||
matches = lineRe.match(line)
|
||||
if (matches and
|
||||
int(matches.group("numLeaked")) == 0 and
|
||||
matches.group("name") != "TOTAL"):
|
||||
continue
|
||||
log.info(line.rstrip())
|
||||
leaks.close()
|
||||
|
||||
threshold = leakThreshold
|
||||
leaks = open(LEAK_REPORT_FILE, "r")
|
||||
seenTotal = False
|
||||
prefix = "TEST-PASS"
|
||||
for line in leaks:
|
||||
matches = lineRe.match(line)
|
||||
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:
|
||||
seenTotal = True
|
||||
# Check for leaks.
|
||||
if bytesLeaked < 0 or bytesLeaked > threshold:
|
||||
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" \
|
||||
" %d bytes during test execution" % bytesLeaked
|
||||
else:
|
||||
leakLog = "TEST-PASS | runtests-leaks | no leaks detected!"
|
||||
# Remind the threshold if it is not 0, which is the default/goal.
|
||||
if threshold != 0:
|
||||
leakLog += " (threshold set at %d bytes)" % threshold
|
||||
# Log the information.
|
||||
log.info(leakLog)
|
||||
else:
|
||||
if numLeaked != 0:
|
||||
if abs(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,
|
||||
"numLeaked": numLeaked,
|
||||
"instance": instance,
|
||||
"name": name,
|
||||
"size": matches.group("size"),
|
||||
"rest": rest })
|
||||
if not seenTotal:
|
||||
log.info("TEST-UNEXPECTED-FAIL | runtests-leaks | missing output line for total leaks!")
|
||||
leaks.close()
|
||||
|
||||
def runApp(testURL, env, app, profileDir, extraArgs, runSSLTunnel = False, utilityPath = DIST_BIN, xrePath = DIST_BIN, certPath = CERTS_SRC_DIR, debuggerInfo = None):
|
||||
"Run the app, log the duration it took to execute, return the status code."
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ import logging
|
|||
import optparse
|
||||
import os
|
||||
import os.path
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
import shutil
|
||||
|
@ -479,76 +478,7 @@ Are you executing $objdir/_tests/testing/mochitest/runtests.py?"""
|
|||
# spew to console shouldn't disrupt the leak information table we print next.
|
||||
server.stop()
|
||||
|
||||
if not os.path.exists(LEAK_REPORT_FILE):
|
||||
log.info("WARNING refcount logging is off, so leaks can't be detected!")
|
||||
else:
|
||||
# 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+)")
|
||||
|
||||
leaks = open(LEAK_REPORT_FILE, "r")
|
||||
for line in leaks:
|
||||
matches = lineRe.match(line)
|
||||
if (matches and
|
||||
int(matches.group("numLeaked")) == 0 and
|
||||
matches.group("name") != "TOTAL"):
|
||||
continue
|
||||
log.info(line.rstrip())
|
||||
leaks.close()
|
||||
|
||||
threshold = options.leakThreshold
|
||||
leaks = open(LEAK_REPORT_FILE, "r")
|
||||
seenTotal = False
|
||||
prefix = "TEST-PASS"
|
||||
for line in leaks:
|
||||
matches = lineRe.match(line)
|
||||
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:
|
||||
seenTotal = True
|
||||
# Check for leaks.
|
||||
if bytesLeaked < 0 or bytesLeaked > threshold:
|
||||
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" \
|
||||
" %d bytes during test execution" % bytesLeaked
|
||||
else:
|
||||
leakLog = "TEST-PASS | runtests-leaks | no leaks detected!"
|
||||
# Remind the threshold if it is not 0, which is the default/goal.
|
||||
if threshold != 0:
|
||||
leakLog += " (threshold set at %d bytes)" % threshold
|
||||
# Log the information.
|
||||
log.info(leakLog)
|
||||
else:
|
||||
if numLeaked != 0:
|
||||
if abs(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,
|
||||
"numLeaked": numLeaked,
|
||||
"instance": instance,
|
||||
"name": name,
|
||||
"size": matches.group("size"),
|
||||
"rest": rest })
|
||||
if not seenTotal:
|
||||
log.info("TEST-UNEXPECTED-FAIL | runtests-leaks | missing output line for total leaks!")
|
||||
leaks.close()
|
||||
automation.processLeakLog(LEAK_REPORT_FILE, options.leakThreshold)
|
||||
|
||||
# delete the profile and manifest
|
||||
os.remove(manifest)
|
||||
|
|
Загрузка…
Ссылка в новой задаче