Bug 1195777 - When LSan detects leaks, tell the user about the report_objects option. r=chmanchester
authorAndrew McCreight <continuation@gmail.com>
Fri, 29 Jul 2016 16:08:06 -0700
changeset 307376 fcc56a97afb3beb1786a205d4634e377efbf4ebe
parent 307375 5f0c9095c0ff59de08caa34270c6139deef86f3b
child 307377 2882620cd75fe1984479f4d6a9b1982ee95a00e4
push id30508
push usercbook@mozilla.com
push dateSat, 30 Jul 2016 14:21:21 +0000
treeherdermozilla-central@e5859dfe0bcb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1195777
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1195777 - When LSan detects leaks, tell the user about the report_objects option. r=chmanchester MozReview-Commit-ID: KWNye8GdEKv
testing/mochitest/leaks.py
testing/mozbase/mozrunner/mozrunner/utils.py
--- a/testing/mochitest/leaks.py
+++ b/testing/mochitest/leaks.py
@@ -227,16 +227,20 @@ class LSANLeaks(object):
         # If we don't match either of these, just ignore the frame.
         # We'll end up with "unknown stack" if everything is ignored.
 
     def process(self):
         if self.fatalError:
             self.logger.warning(
                 "TEST-UNEXPECTED-FAIL | LeakSanitizer | LeakSanitizer has encountered a fatal error.")
 
+        if self.foundFrames:
+            self.logger.info("TEST-INFO | LeakSanitizer | To show the addresses of leaked objects add report_objects=1 to LSAN_OPTIONS")
+            self.logger.info("TEST-INFO | LeakSanitizer | This can be done in testing/mozbase/mozrunner/mozrunner/utils.py")
+
         for f in self.foundFrames:
             self.logger.warning(
                 "TEST-UNEXPECTED-FAIL | LeakSanitizer | leak at " + f)
 
     def _finishStack(self):
         if self.recordMoreFrames and len(self.currStack) == 0:
             self.currStack = ["unknown stack"]
         if self.currStack:
--- a/testing/mozbase/mozrunner/mozrunner/utils.py
+++ b/testing/mozbase/mozrunner/mozrunner/utils.py
@@ -180,16 +180,18 @@ def test_environment(xrePath, env=None, 
                     'quarantine_size=50331648', 'malloc_context_size=5']
             else:
                 message = message % 'default memory'
 
             if lsanPath:
                 log.info("LSan enabled.")
                 asanOptions.append('detect_leaks=1')
                 lsanOptions = ["exitcode=0"]
+                # Uncomment out the next line to report the addresses of leaked objects.
+                #lsanOptions.append("report_objects=1")
                 suppressionsFile = os.path.join(
                     lsanPath, 'lsan_suppressions.txt')
                 if os.path.exists(suppressionsFile):
                     log.info("LSan using suppression file " + suppressionsFile)
                     lsanOptions.append("suppressions=" + suppressionsFile)
                 else:
                     log.info("WARNING | runtests.py | LSan suppressions file"
                              " does not exist! " + suppressionsFile)