Bug 469518 - Enable Reftest leak log in tinderbox (log); (Av1b) Enable (bare) leak log; r=ted.mielczarek

This commit is contained in:
Serge Gautherie 2009-02-24 22:19:01 +01:00
parent e4c779d809
commit 99f7e9f16a

View File

@ -40,6 +40,7 @@
Runs the reftest test harness.
"""
import logging
import sys, shutil, os, os.path
SCRIPT_DIRECTORY = os.path.abspath(os.path.realpath(os.path.dirname(sys.argv[0])))
sys.path.append(SCRIPT_DIRECTORY)
@ -115,16 +116,39 @@ Are you executing $objdir/_tests/reftest/runreftest.py?""" \
browserEnv["MOZILLA_FIVE_HOME"] = appDir
browserEnv["GNOME_DISABLE_CRASH_DIALOG"] = "1"
# Retrieve the logger where to report the leaks to.
log = logging.getLogger()
# Enable leaks (only) detection to its own log file.
leakLogFile = os.path.join(profileDir, "runreftest_leaks.log")
browserEnv["XPCOM_MEM_LEAK_LOG"] = leakLogFile
def processLeakLog():
"Process the leak log."
# For the time being, don't warn (nor "info") if the log file is not there. (Bug 469518)
if os.path.exists(leakLogFile):
leaks = open(leakLogFile, "r")
# For the time being, simply copy the log. (Bug 469518)
log.info(leaks.read().rstrip())
leaks.close()
# run once with -silent to let the extension manager do its thing
# and then exit the app
log.info("REFTEST INFO | runreftest.py | Performing extension manager registration: start.\n")
(status, start) = automation.runApp(None, browserEnv, options.app,
profileDir,
extraArgs = ["-silent"])
# We don't care to call |processLeakLog()| for this step.
log.info("\nREFTEST INFO | runreftest.py | Performing extension manager registration: end.")
# then again to actually run reftest
log.info("REFTEST INFO | runreftest.py | Running tests: start.\n")
reftestlist = getFullPath(args[0])
(status, start) = automation.runApp(None, browserEnv, options.app,
profileDir,
extraArgs = ["-reftest", reftestlist])
processLeakLog()
log.info("\nREFTEST INFO | runreftest.py | Running tests: end.")
finally:
if profileDir is not None:
shutil.rmtree(profileDir)