Bug 1287877 - Fail when LeakSanitizer encounters a fatal error. r=jgriffin
authorAndrew McCreight <continuation@gmail.com>
Wed, 27 Jul 2016 10:11:40 -0700
changeset 349035 9bc69f649d323ac099c1868d58cb81a61c573688
parent 349034 8830f07a659b22aa291704ff0eb8c42fd7368871
child 349036 60d7601e512787e8265f0c3ed52e67517a857b58
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgriffin
bugs1287877
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 1287877 - Fail when LeakSanitizer encounters a fatal error. r=jgriffin
testing/mochitest/leaks.py
--- a/testing/mochitest/leaks.py
+++ b/testing/mochitest/leaks.py
@@ -153,16 +153,17 @@ class LSANLeaks(object):
     """
     Parses the log when running an LSAN build, looking for interesting stack frames
     in allocation stacks, and prints out reports.
     """
 
     def __init__(self, logger):
         self.logger = logger
         self.inReport = False
+        self.fatalError = False
         self.foundFrames = set([])
         self.recordMoreFrames = None
         self.currStack = None
         self.maxNumRecordedFrames = 4
 
         # Don't various allocation-related stack frames, as they do not help much to
         # distinguish different leaks.
         unescapedSkipList = [
@@ -172,25 +173,31 @@ class LSANLeaks(object):
             "new",
             "js::MallocProvider",
         ]
         self.skipListRegExp = re.compile(
             "^" + "|".join([re.escape(f) for f in unescapedSkipList]) + "$")
 
         self.startRegExp = re.compile(
             "==\d+==ERROR: LeakSanitizer: detected memory leaks")
+        self.fatalErrorRegExp = re.compile(
+            "==\d+==LeakSanitizer has encountered a fatal error.")
         self.stackFrameRegExp = re.compile("    #\d+ 0x[0-9a-f]+ in ([^(</]+)")
         self.sysLibStackFrameRegExp = re.compile(
             "    #\d+ 0x[0-9a-f]+ \(([^+]+)\+0x[0-9a-f]+\)")
 
     def log(self, line):
         if re.match(self.startRegExp, line):
             self.inReport = True
             return
 
+        if re.match(self.fatalErrorRegExp, line):
+            self.fatalError = True
+            return
+
         if not self.inReport:
             return
 
         if line.startswith("Direct leak") or line.startswith("Indirect leak"):
             self._finishStack()
             self.recordMoreFrames = True
             self.currStack = []
             return
@@ -216,16 +223,20 @@ class LSANLeaks(object):
             # System library stack frames will never match the skip list,
             # so don't bother checking if they do.
             self._recordFrame(sysLibStackFrame.group(1))
 
         # 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.")
+
         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: