Bug 1039633, part 2 - Only try to set ASan symbolizer in ASan runs. r=ted
☠☠ backed out by 3ea1bc86f28c ☠ ☠
authorAndrew McCreight <continuation@gmail.com>
Thu, 28 Aug 2014 12:53:47 -0700
changeset 202188 824144dd7cdf68bffa02360f042d4aa1533e7c59
parent 202187 b256487e7f7321cf306eb64b733b2468320f5f8f
child 202189 3d125a3bf25749e31bbabd0051508516b0123e90
push id48360
push useramccreight@mozilla.com
push dateThu, 28 Aug 2014 19:54:13 +0000
treeherdermozilla-inbound@824144dd7cdf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1039633
milestone34.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 1039633, part 2 - Only try to set ASan symbolizer in ASan runs. r=ted
testing/gtest/rungtests.py
--- a/testing/gtest/rungtests.py
+++ b/testing/gtest/rungtests.py
@@ -25,16 +25,17 @@ class GTests(object):
         * prog: The path to the test program to run.
         * env: The environment to use for running the program.
         * symbols_path: A path to a directory containing Breakpad-formatted
                         symbol files for producing stack traces on crash.
 
         Return True if the program exits with a zero status, False otherwise.
         """
         self.xre_path = xre_path
+        self.update_mozinfo()
         env = self.build_environment()
         log.info("Running gtest")
         proc = mozprocess.ProcessHandler([prog, "-unittest"],
                                          cwd=os.getcwd(),
                                          env=env)
         #TODO: After bug 811320 is fixed, don't let .run() kill the process,
         # instead use a timeout in .wait() and then kill to get a stack.
         proc.run(timeout=GTests.TEST_PROC_TIMEOUT,
@@ -83,29 +84,42 @@ class GTests(object):
             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:
+        asan = bool(mozinfo.info.get("asan"))
+        if asan and (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)
+                log.testFail("gtest | Failed to find ASan symbolizer at %s", llvmsym)
 
         return env
 
+    def update_mozinfo(self):
+        """walk up directories to find mozinfo.json update the info"""
+        # TODO: This should go in a more generic place, e.g. mozinfo
+
+        path = self.xre_path
+        dirs = set()
+        while path != os.path.expanduser('~'):
+            if path in dirs:
+                break
+            dirs.add(path)
+            path = os.path.split(path)[0]
+
+        mozinfo.find_and_update_from_json(*dirs)
+
 class gtestOptions(OptionParser):
     def __init__(self):
         OptionParser.__init__(self)
         self.add_option("--xre-path",
                         action = "store", type = "string", dest = "xre_path",
                         default = None,
                         help = "absolute path to directory containing XRE (probably xulrunner)")
         self.add_option("--symbols-path",