зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1631819 - Allow disabling lsan entirely for directories, r=mccr8,maja_zf
This adds a new property lsan-disabled to wpt metadata files, which takes a boolean to determine if lsan should be entirely disabled for that directory. Differential Revision: https://phabricator.services.mozilla.com/D73918
This commit is contained in:
Родитель
90060db218
Коммит
88cdbbdcc1
|
@ -13,7 +13,8 @@ class LSANLeaks(object):
|
||||||
in allocation stacks
|
in allocation stacks
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, logger, scope=None, allowed=None, maxNumRecordedFrames=None):
|
def __init__(self, logger, scope=None, allowed=None, maxNumRecordedFrames=None,
|
||||||
|
allowAll=False):
|
||||||
self.logger = logger
|
self.logger = logger
|
||||||
self.inReport = False
|
self.inReport = False
|
||||||
self.fatalError = False
|
self.fatalError = False
|
||||||
|
@ -25,6 +26,7 @@ class LSANLeaks(object):
|
||||||
self.summaryData = None
|
self.summaryData = None
|
||||||
self.scope = scope
|
self.scope = scope
|
||||||
self.allowedMatch = None
|
self.allowedMatch = None
|
||||||
|
self.allowAll = allowAll
|
||||||
self.sawError = False
|
self.sawError = False
|
||||||
|
|
||||||
# Don't various allocation-related stack frames, as they do not help much to
|
# Don't various allocation-related stack frames, as they do not help much to
|
||||||
|
@ -54,7 +56,7 @@ class LSANLeaks(object):
|
||||||
self.setAllowed(allowed)
|
self.setAllowed(allowed)
|
||||||
|
|
||||||
def setAllowed(self, allowedLines):
|
def setAllowed(self, allowedLines):
|
||||||
if not allowedLines:
|
if not allowedLines or self.allowAll:
|
||||||
self.allowedRegexp = None
|
self.allowedRegexp = None
|
||||||
else:
|
else:
|
||||||
self.allowedRegexp = re.compile(
|
self.allowedRegexp = re.compile(
|
||||||
|
@ -118,6 +120,10 @@ class LSANLeaks(object):
|
||||||
def process(self):
|
def process(self):
|
||||||
failures = 0
|
failures = 0
|
||||||
|
|
||||||
|
if self.allowAll:
|
||||||
|
self.logger.info("LeakSanitizer | Leak checks disabled")
|
||||||
|
return
|
||||||
|
|
||||||
if self.summaryData:
|
if self.summaryData:
|
||||||
allowed = all(allowed for _, allowed in self.foundFrames)
|
allowed = all(allowed for _, allowed in self.foundFrames)
|
||||||
self.logger.lsan_summary(*self.summaryData, allowed=allowed)
|
self.logger.lsan_summary(*self.summaryData, allowed=allowed)
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
prefs: [dom.serviceWorkers.enabled:true]
|
prefs: [dom.serviceWorkers.enabled:true]
|
||||||
lsan-allowed: [Alloc, CompareNetwork, Create, EntrySlotOrCreate, GetClientInfo, MakeUnique, Malloc, NS_NewLoadGroup, NewChannelFromURIWithProxyFlagsInternal, NewPage, PLDHashTable::Add, Realloc, SetPropertyAsInterface, SharedMutex, Then, WeakPtr, createTable, mozilla::BasePrincipal::CreateContentPrincipal, mozilla::ThrottledEventQueue::Create, mozilla::WeakPtr, mozilla::detail::UniqueSelector, mozilla::dom::BrowserParent::GetLoadContext, mozilla::dom::ContentParent::CreateBrowser, mozilla::dom::DocGroup::Create, mozilla::dom::PerformanceStorageWorker::Create, mozilla::dom::ServiceWorkerJobQueue::RunJob, mozilla::dom::ServiceWorkerManager::Unregister, mozilla::dom::ServiceWorkerRegistrationMainThread::Unregister, mozilla::dom::UnregisterCallback::UnregisterCallback, mozilla::dom::WorkerCSPEventListener::Create, mozilla::dom::WorkerPrivate::EnsurePerformanceCounter, mozilla::dom::WorkerPrivate::WorkerPrivate, mozilla::dom::cache::CacheOpChild::Recv__delete__, mozilla::dom::serviceWorkerScriptCache::, mozilla::extensions::ChannelWrapper::ChannelWrapper, mozilla::net::HttpBaseChannel::CloneLoadInfoForRedirect, mozilla::net::HttpBaseChannel::HttpBaseChannel, mozilla::net::HttpChannelChild::HttpChannelChild, mozilla::net::nsHttpHandler::NewProxiedChannel, mozilla::net::nsIOService::NewChannelFromURIWithProxyFlagsInternal, mozilla::net::nsStandardURL::TemplatedMutator, nsDynamicAtom::Create, nsHashPropertyBagBase::SetPropertyAsInterface, nsNodeSupportsWeakRefTearoff::GetWeakReference, nsPermission::Create, nsStringBuffer::Alloc, nsTimer, nsTimer::WithEventTarget, operator]
|
lsan-disabled: true
|
||||||
leak-threshold: [default:102400, tab:51200]
|
leak-threshold: [default:102400, tab:51200]
|
||||||
|
|
|
@ -442,8 +442,8 @@ class OutputHandler(object):
|
||||||
self.line_buffer = []
|
self.line_buffer = []
|
||||||
self.setup_ran = False
|
self.setup_ran = False
|
||||||
|
|
||||||
def setup(self, instance=None, group_metadata=None, lsan_allowed=None,
|
def setup(self, instance=None, group_metadata=None, lsan_disabled=False,
|
||||||
lsan_max_stack_depth=None, mozleak_allowed=None,
|
lsan_allowed=None, lsan_max_stack_depth=None, mozleak_allowed=None,
|
||||||
mozleak_thresholds=None, **kwargs):
|
mozleak_thresholds=None, **kwargs):
|
||||||
"""Configure the output handler"""
|
"""Configure the output handler"""
|
||||||
self.instance = instance
|
self.instance = instance
|
||||||
|
@ -459,7 +459,8 @@ class OutputHandler(object):
|
||||||
self.lsan_handler = mozleak.LSANLeaks(self.logger,
|
self.lsan_handler = mozleak.LSANLeaks(self.logger,
|
||||||
scope=group_metadata.get("scope", "/"),
|
scope=group_metadata.get("scope", "/"),
|
||||||
allowed=lsan_allowed,
|
allowed=lsan_allowed,
|
||||||
maxNumRecordedFrames=lsan_max_stack_depth)
|
maxNumRecordedFrames=lsan_max_stack_depth,
|
||||||
|
allowAll=lsan_disabled)
|
||||||
else:
|
else:
|
||||||
self.lsan_handler = None
|
self.lsan_handler = None
|
||||||
|
|
||||||
|
@ -709,6 +710,7 @@ class FirefoxBrowser(Browser):
|
||||||
|
|
||||||
def settings(self, test):
|
def settings(self, test):
|
||||||
return {"check_leaks": self.leak_check and not test.leaks,
|
return {"check_leaks": self.leak_check and not test.leaks,
|
||||||
|
"lsan_disabled": test.lsan_disabled,
|
||||||
"lsan_allowed": test.lsan_allowed,
|
"lsan_allowed": test.lsan_allowed,
|
||||||
"lsan_max_stack_depth": test.lsan_max_stack_depth,
|
"lsan_max_stack_depth": test.lsan_max_stack_depth,
|
||||||
"mozleak_allowed": self.leak_check and test.mozleak_allowed,
|
"mozleak_allowed": self.leak_check and test.mozleak_allowed,
|
||||||
|
|
|
@ -32,7 +32,7 @@ def data_cls_getter(output_node, visited_node):
|
||||||
def bool_prop(name, node):
|
def bool_prop(name, node):
|
||||||
"""Boolean property"""
|
"""Boolean property"""
|
||||||
try:
|
try:
|
||||||
return node.get(name)
|
return bool(node.get(name))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -292,6 +292,10 @@ class ExpectedManifest(ManifestItem):
|
||||||
def prefs(self):
|
def prefs(self):
|
||||||
return prefs(self)
|
return prefs(self)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def lsan_disabled(self):
|
||||||
|
return bool_prop("lsan-disabled", self)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def lsan_allowed(self):
|
def lsan_allowed(self):
|
||||||
return set_prop("lsan-allowed", self)
|
return set_prop("lsan-allowed", self)
|
||||||
|
@ -354,6 +358,10 @@ class DirectoryManifest(ManifestItem):
|
||||||
def prefs(self):
|
def prefs(self):
|
||||||
return prefs(self)
|
return prefs(self)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def lsan_disabled(self):
|
||||||
|
return bool_prop("lsan-disabled", self)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def lsan_allowed(self):
|
def lsan_allowed(self):
|
||||||
return set_prop("lsan-allowed", self)
|
return set_prop("lsan-allowed", self)
|
||||||
|
@ -435,6 +443,10 @@ class TestNode(ManifestItem):
|
||||||
def prefs(self):
|
def prefs(self):
|
||||||
return prefs(self)
|
return prefs(self)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def lsan_disabled(self):
|
||||||
|
return bool_prop("lsan-disabled", self)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def lsan_allowed(self):
|
def lsan_allowed(self):
|
||||||
return set_prop("lsan-allowed", self)
|
return set_prop("lsan-allowed", self)
|
||||||
|
|
|
@ -258,6 +258,13 @@ class Test(object):
|
||||||
return count
|
return count
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@property
|
||||||
|
def lsan_disabled(self):
|
||||||
|
for meta in self.itermeta():
|
||||||
|
if meta.lsan_disabled is not None:
|
||||||
|
return meta.lsan_disabled
|
||||||
|
return False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def lsan_allowed(self):
|
def lsan_allowed(self):
|
||||||
lsan_allowed = set()
|
lsan_allowed = set()
|
||||||
|
|
Загрузка…
Ссылка в новой задаче