Bug 1806222 - Set llvm-symbolizer path for TSAN cpptests & gtests. r=glandium

Differential Revision: https://phabricator.services.mozilla.com/D164960
This commit is contained in:
Ryan VanderMeulen 2022-12-20 14:25:34 +00:00
Родитель a9f8e921e5
Коммит 721455b1c2
2 изменённых файлов: 24 добавлений и 17 удалений

Просмотреть файл

@ -161,23 +161,26 @@ class GTests(object):
else:
env[pathvar] = self.xre_path
# ASan specific environment stuff
symbolizer_path = None
if mozinfo.info["asan"]:
# Symbolizer support
if "ASAN_SYMBOLIZER_PATH" in env and os.path.isfile(
env["ASAN_SYMBOLIZER_PATH"]
):
llvmsym = env["ASAN_SYMBOLIZER_PATH"]
symbolizer_path = "ASAN_SYMBOLIZER_PATH"
elif mozinfo.info["tsan"]:
symbolizer_path = "TSAN_SYMBOLIZER_PATH"
if symbolizer_path is not None:
# Use llvm-symbolizer for ASan/TSan if available/required
if symbolizer_path in env and os.path.isfile(env[symbolizer_path]):
llvmsym = env[symbolizer_path]
else:
llvmsym = os.path.join(
self.xre_path, "llvm-symbolizer" + mozinfo.info["bin_suffix"]
)
if os.path.isfile(llvmsym):
env["ASAN_SYMBOLIZER_PATH"] = llvmsym
log.info("gtest | ASan using symbolizer at %s", llvmsym)
env[symbolizer_path] = llvmsym
log.info("Using LLVM 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.info("Failed to find LLVM symbolizer at %s", llvmsym)
# webrender needs gfx.webrender.all=true, gtest doesn't use prefs
env["MOZ_WEBRENDER"] = "1"

Просмотреть файл

@ -145,21 +145,25 @@ class CPPUnitTests(object):
else:
env[pathvar] = libpath
symbolizer_path = None
if mozinfo.info["asan"]:
# Use llvm-symbolizer for ASan if available/required
if "ASAN_SYMBOLIZER_PATH" in env and os.path.isfile(
env["ASAN_SYMBOLIZER_PATH"]
):
llvmsym = env["ASAN_SYMBOLIZER_PATH"]
symbolizer_path = "ASAN_SYMBOLIZER_PATH"
elif mozinfo.info["tsan"]:
symbolizer_path = "TSAN_SYMBOLIZER_PATH"
if symbolizer_path is not None:
# Use llvm-symbolizer for ASan/TSan if available/required
if symbolizer_path in env and os.path.isfile(env[symbolizer_path]):
llvmsym = env[symbolizer_path]
else:
llvmsym = os.path.join(
self.xre_path, "llvm-symbolizer" + mozinfo.info["bin_suffix"]
)
if os.path.isfile(llvmsym):
env["ASAN_SYMBOLIZER_PATH"] = llvmsym
self.log.info("ASan using symbolizer at %s" % llvmsym)
env[symbolizer_path] = llvmsym
self.log.info("Using LLVM symbolizer at %s" % llvmsym)
else:
self.log.info("Failed to find ASan symbolizer at %s" % llvmsym)
self.log.info("Failed to find LLVM symbolizer at %s" % llvmsym)
return env