Bug 917242 - Symbolize ASan traces in automation. r=ted

This commit is contained in:
Christian Holler 2013-09-20 13:37:53 +02:00
parent 0989c0d0ea
commit 8fc307d856
7 changed files with 35 additions and 1 deletions

View File

@ -798,3 +798,7 @@ bin/libfreebl_32int64_3.so
@BINPATH@/metro/defaults
@BINPATH@/metro/modules
#endif
#ifdef MOZ_ASAN
@BINPATH@/llvm-symbolizer
#endif

View File

@ -512,6 +512,12 @@ class Automation(object):
# ASan specific environment stuff
if self.IS_ASAN and (self.IS_LINUX or self.IS_MAC):
# Symbolizer support
llvmsym = os.path.join(xrePath, "llvm-symbolizer")
if os.path.isfile(llvmsym):
env["ASAN_SYMBOLIZER_PATH"] = llvmsym
self.log.info("INFO | automation.py | ASan using symbolizer at %s", llvmsym)
try:
totalMemory = int(os.popen("free").readlines()[1].split()[1])

View File

@ -6,6 +6,14 @@
SDK_BINARY = run-mozilla.sh
ifneq ($(LLVM_SYMBOLIZER),)
# Install a copy of the llvm-symbolizer binary to dist/bin, so it can
# be used for symbolizing traces for e.g. AddressSanitizer
LLVMSYM_EXECUTABLES=$(LLVM_SYMBOLIZER)
LLVMSYM_DEST=$(FINAL_TARGET)
INSTALL_TARGETS += LLVMSYM
endif
include $(topsrcdir)/config/rules.mk
libs:: $(srcdir)/run-mozilla.sh

View File

@ -3,6 +3,7 @@
# Use Clang as specified in manifest
export CC="$topsrcdir/clang/bin/clang -fgnu89-inline"
export CXX="$topsrcdir/clang/bin/clang++"
export LLVM_SYMBOLIZER="$topsrcdir/clang/bin/llvm-symbolizer"
# Mandatory flags for ASan
export ASANFLAGS="-fsanitize=address -Dxmalloc=myxmalloc -fPIC"

View File

@ -1212,8 +1212,10 @@ MOZ_ARG_ENABLE_BOOL(address-sanitizer,
if test -n "$MOZ_ASAN"; then
MOZ_LLVM_HACKS=1
AC_DEFINE(MOZ_ASAN)
MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
fi
AC_SUBST(MOZ_ASAN)
AC_SUBST(LLVM_SYMBOLIZER)
dnl ========================================================
dnl = Enable hacks required for LLVM instrumentations

View File

@ -298,11 +298,18 @@ JITTEST_VALGRIND_FLAG = --valgrind
endif
endif
ifdef MOZ_ASAN
ifneq ($(LLVM_SYMBOLIZER),)
# Use the LLVM symbolizer when running jit-tests under ASan, if available
JITTEST_ASAN_ENV=ASAN_SYMBOLIZER_PATH='$(LLVM_SYMBOLIZER)'
endif
endif
check-style::
(cd $(srcdir) && $(PYTHON) config/check_spidermonkey_style.py);
check-jit-test::
$(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(srcdir)/jit-test/jit_test.py \
$(JITTEST_ASAN_ENV) $(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(srcdir)/jit-test/jit_test.py \
--no-slow --no-progress --tinderbox --tbpl $(JITTEST_VALGRIND_FLAG) \
$(DIST)/bin/$(JS_SHELL_NAME)$(BIN_SUFFIX)

View File

@ -89,6 +89,12 @@ class CPPUnitTests(object):
env[pathvar] = "%s%s%s" % (self.xre_path, os.pathsep, env[pathvar])
else:
env[pathvar] = self.xre_path
# Use llvm-symbolizer for ASan if available/required
llvmsym = os.path.join(self.xre_path, "llvm-symbolizer")
if os.path.isfile(llvmsym):
env["ASAN_SYMBOLIZER_PATH"] = llvmsym
return env
def run_tests(self, programs, xre_path, symbols_path=None):