Bug 1038943: Turn on leak checking on B2G with an initial threshold of 400000 bytes. r=ahal,dbaron

This commit is contained in:
Kyle Huey 2014-08-05 14:11:53 -07:00
Родитель f249f2de1f
Коммит 66021be422
5 изменённых файлов: 52 добавлений и 24 удалений

Просмотреть файл

@ -476,7 +476,10 @@ def environment(xrePath, env=None, crashreporter=True, debugger=False, dmdPath=N
envVar = None
dmdLibrary = None
preloadEnvVar = None
if mozinfo.isUnix:
if mozinfo.info['toolkit'] == "gonk":
# Skip all of this, it's only valid for the host.
pass
elif mozinfo.isUnix:
envVar = "LD_LIBRARY_PATH"
env['MOZILLA_FIVE_HOME'] = xrePath
dmdLibrary = "libdmd.so"

Просмотреть файл

@ -755,6 +755,8 @@ class B2GOptions(MochitestOptions):
defaults["closeWhenDone"] = True
defaults["testPath"] = ""
defaults["extensionsToExclude"] = ["specialpowers"]
# See dependencies of bug 1038943.
defaults["leakThreshold"] = 5200
self.set_defaults(**defaults)
def verifyRemoteOptions(self, options):

Просмотреть файл

@ -1161,15 +1161,16 @@ class Mochitest(MochitestUtilsMixin):
# This is fatal for desktop environments.
raise EnvironmentError('Could not find gmp-fake')
def buildBrowserEnv(self, options, debugger=False):
def buildBrowserEnv(self, options, debugger=False, env=None):
"""build the environment variables for the specific test and operating system"""
if mozinfo.info["asan"]:
lsanPath = SCRIPT_DIR
else:
lsanPath = None
browserEnv = self.environment(xrePath=options.xrePath, debugger=debugger,
dmdPath=options.dmdPath, lsanPath=lsanPath)
browserEnv = self.environment(xrePath=options.xrePath, env=env,
debugger=debugger, dmdPath=options.dmdPath,
lsanPath=lsanPath)
# These variables are necessary for correct application startup; change
# via the commandline at your own risk.

Просмотреть файл

@ -14,6 +14,7 @@ import traceback
here = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, here)
from automationutils import processLeakLog
from runtests import Mochitest
from runtests import MochitestUtilsMixin
from runtests import MessageLogger
@ -121,7 +122,6 @@ class B2GMochitest(MochitestUtilsMixin):
""" Prepare, configure, run tests and cleanup """
manifest = self.build_profile(options)
self.leak_report_file = os.path.join(options.profilePath, "runtests_leaks.log")
# configuring the message logger's buffering
self.message_logger.buffering = options.quiet
@ -160,6 +160,19 @@ class B2GMochitest(MochitestUtilsMixin):
if not self.app_ctx.dm.dirExists(posixpath.dirname(self.remote_log)):
self.app_ctx.dm.mkDirs(self.remote_log)
self.leak_report_file = posixpath.join(self.app_ctx.remote_test_root,
'log', 'runtests_leaks.log')
# We don't want to copy the host env onto the device, so pass in an
# empty env.
self.browserEnv = self.buildBrowserEnv(options, env={})
# XXXkhuey MOZ_DISABLE_NONLOCAL_CONNECTIONS is busted on b2g, so make
# sure we don't pass it through (bug 1039019).
if 'MOZ_DISABLE_NONLOCAL_CONNECTIONS' in self.browserEnv:
del self.browserEnv['MOZ_DISABLE_NONLOCAL_CONNECTIONS']
self.runner.env.update(self.browserEnv)
self.startServers(options, None)
self.buildURLOptions(options, {'MOZ_HIDE_RESULTS_TABLE': '1'})
self.test_script_args.append(not options.emulator)
@ -193,6 +206,12 @@ class B2GMochitest(MochitestUtilsMixin):
if status is None:
# the runner has timed out
status = 124
local_leak_file = tempfile.NamedTemporaryFile()
self.app_ctx.dm.getFile(self.leak_report_file, local_leak_file.name)
self.app_ctx.dm.removeFile(self.leak_report_file)
processLeakLog(local_leak_file.name, options.leakThreshold)
except KeyboardInterrupt:
log.info("runtests.py | Received keyboard interrupt.\n");
status = -1

Просмотреть файл

@ -19,37 +19,34 @@ class DeviceRunner(BaseRunner):
The base runner class used for running gecko on
remote devices (or emulators), such as B2G.
"""
env = { 'MOZ_CRASHREPORTER': '1',
'MOZ_CRASHREPORTER_NO_REPORT': '1',
'MOZ_CRASHREPORTER_SHUTDOWN': '1',
'MOZ_HIDE_RESULTS_TABLE': '1',
'NSPR_LOG_MODULES': 'signaling:5,mtransport:5,datachannel:5',
'R_LOG_LEVEL': '6',
'R_LOG_DESTINATION': 'stderr',
'R_LOG_VERBOSE': '1',
'NO_EM_RESTART': '1', }
def __init__(self, device_class, device_args=None, **kwargs):
process_log = tempfile.NamedTemporaryFile(suffix='pidlog')
self._env = dict(self.env)
self._env['MOZ_PROCESS_LOG'] = process_log.name
self._env.update(kwargs.pop('env', {}) or {})
process_args = {'stream': sys.stdout,
'processOutputLine': self.on_output,
'onTimeout': self.on_timeout }
process_args.update(kwargs.get('process_args') or {})
kwargs['process_args'] = process_args
kwargs['env'] = {}
BaseRunner.__init__(self, **kwargs)
device_args = device_args or {}
self.device = device_class(**device_args)
process_log = tempfile.NamedTemporaryFile(suffix='pidlog')
self._env = { 'MOZ_CRASHREPORTER': '1',
'MOZ_CRASHREPORTER_NO_REPORT': '1',
'MOZ_CRASHREPORTER_SHUTDOWN': '1',
'MOZ_HIDE_RESULTS_TABLE': '1',
'MOZ_PROCESS_LOG': process_log.name,
'NSPR_LOG_MODULES': 'signaling:5,mtransport:5,datachannel:5',
'R_LOG_LEVEL': '6',
'R_LOG_DESTINATION': 'stderr',
'R_LOG_VERBOSE': '1',
'NO_EM_RESTART': '1', }
if kwargs.get('env'):
self._env.update(kwargs['env'])
# In this case we need to pass in env as part of the command.
# Make this empty so runner doesn't pass anything into the
# process class.
self.env = None
@property
def command(self):
cmd = [self.app_ctx.adb]
@ -79,7 +76,13 @@ class DeviceRunner(BaseRunner):
raise Exception("Network did not come up when starting device")
self.app_ctx.stop_application()
# In this case we need to pass in env as part of the command.
# Make this empty so BaseRunner doesn't pass anything into the
# process class.
self._env = self.env
self.env = None
BaseRunner.start(self, *args, **kwargs)
self.env = self._env
timeout = 10 # seconds
starttime = datetime.datetime.now()