Bug 1039633 - Always try to set the ASan symbolizer in gtest runs. r=ted, a=test-only
authorAndrew McCreight <continuation@gmail.com>
Fri, 15 Aug 2014 11:10:53 -0700
changeset 288084 e0e150f31ffea6346a8a9653611921481737d83e
parent 288083 92aead6bd5fb5452170da0fc084d4d8ef0b28605
child 288085 45953c4613d276bffd7d39cb36a4ae326637c9a3
push id218
push userryanvm@gmail.com
push dateWed, 16 Dec 2015 22:58:33 +0000
reviewersted, test-only
bugs1039633
milestone32.0
Bug 1039633 - Always try to set the ASan symbolizer in gtest runs. r=ted, a=test-only
testing/gtest/rungtests.py
--- a/testing/gtest/rungtests.py
+++ b/testing/gtest/rungtests.py
@@ -81,16 +81,29 @@ class GTests(object):
             pathvar = "DYLD_LIBRARY_PATH"
         elif mozinfo.os == "win":
             pathvar = "PATH"
         if pathvar:
             if pathvar in env:
                 env[pathvar] = "%s%s%s" % (self.xre_path, os.pathsep, env[pathvar])
             else:
                 env[pathvar] = self.xre_path
+
+        # ASan specific environment stuff
+        # mozinfo is not set up properly to detect if ASan is enabled, so just always set these.
+        if mozinfo.isLinux or mozinfo.isMac:
+            # Symbolizer support
+            llvmsym = os.path.join(self.xre_path, "llvm-symbolizer")
+            if os.path.isfile(llvmsym):
+                env["ASAN_SYMBOLIZER_PATH"] = llvmsym
+                log.info("gtest | ASan using symbolizer at %s", llvmsym)
+            else:
+                # This should be |testFail| instead of |info|. See bug 1050891.
+                log.info("gtest | Failed to find ASan symbolizer at %s", llvmsym)
+
         return env
 
 class gtestOptions(OptionParser):
     def __init__(self):
         OptionParser.__init__(self)
         self.add_option("--xre-path",
                         action = "store", type = "string", dest = "xre_path",
                         default = None,