diff --git a/clang/test/Unit/lit.cfg.py b/clang/test/Unit/lit.cfg.py --- a/clang/test/Unit/lit.cfg.py +++ b/clang/test/Unit/lit.cfg.py @@ -30,10 +30,19 @@ if 'TEMP' in os.environ: config.environment['TEMP'] = os.environ['TEMP'] -# Propagate path to symbolizer for ASan/MSan. -for symbolizer in ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH']: - if symbolizer in os.environ: - config.environment[symbolizer] = os.environ[symbolizer] +# Propagate sanitizer options. +for var in [ + 'ASAN_SYMBOLIZER_PATH', + 'MSAN_SYMBOLIZER_PATH', + 'TSAN_SYMBOLIZER_PATH', + 'UBSAN_SYMBOLIZER_PATH', + 'ASAN_OPTIONS', + 'MSAN_OPTIONS', + 'TSAN_OPTIONS', + 'UBSAN_OPTIONS', +]: + if var in os.environ: + config.environment[var] = os.environ[var] def find_shlibpath_var(): if platform.system() in ['Linux', 'FreeBSD', 'NetBSD', 'SunOS']: diff --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py --- a/clang/test/lit.cfg.py +++ b/clang/test/lit.cfg.py @@ -49,10 +49,6 @@ config.substitutions.append( ('%target_triple', config.target_triple)) -# Propagate path to symbolizer for ASan/MSan. -llvm_config.with_system_environment( - ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH']) - config.substitutions.append(('%PATH%', config.environment['PATH'])) diff --git a/cross-project-tests/lit.cfg.py b/cross-project-tests/lit.cfg.py --- a/cross-project-tests/lit.cfg.py +++ b/cross-project-tests/lit.cfg.py @@ -83,11 +83,6 @@ if 'compiler-rt' in config.llvm_enabled_projects: config.available_features.add('compiler-rt') -if config.llvm_use_sanitizer: - # Propagate path to symbolizer for ASan/MSan. - llvm_config.with_system_environment( - ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH']) - # Check which debuggers are available: lldb_path = llvm_config.use_llvm_tool('lldb', search_env='LLDB') diff --git a/llvm/test/Unit/lit.cfg.py b/llvm/test/Unit/lit.cfg.py --- a/llvm/test/Unit/lit.cfg.py +++ b/llvm/test/Unit/lit.cfg.py @@ -33,10 +33,19 @@ if 'HOME' in os.environ: config.environment['HOME'] = os.environ['HOME'] -# Propagate path to symbolizer for ASan/MSan. -for symbolizer in ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH']: - if symbolizer in os.environ: - config.environment[symbolizer] = os.environ[symbolizer] +# Propagate sanitizer options. +for var in [ + 'ASAN_SYMBOLIZER_PATH', + 'MSAN_SYMBOLIZER_PATH', + 'TSAN_SYMBOLIZER_PATH', + 'UBSAN_SYMBOLIZER_PATH', + 'ASAN_OPTIONS', + 'MSAN_OPTIONS', + 'TSAN_OPTIONS', + 'UBSAN_OPTIONS', +]: + if var in os.environ: + config.environment[var] = os.environ[var] # Win32 seeks DLLs along %PATH%. if sys.platform in ['win32', 'cygwin'] and os.path.isdir(config.shlibdir): diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py --- a/llvm/test/lit.cfg.py +++ b/llvm/test/lit.cfg.py @@ -40,7 +40,7 @@ # Propagate some variables from the host environment. llvm_config.with_system_environment( - ['HOME', 'INCLUDE', 'LIB', 'TMP', 'TEMP', 'ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH']) + ['HOME', 'INCLUDE', 'LIB', 'TMP', 'TEMP']) # Set up OCAMLPATH to include newly built OCaml libraries. diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py --- a/llvm/utils/lit/lit/llvm/config.py +++ b/llvm/utils/lit/lit/llvm/config.py @@ -56,6 +56,17 @@ if not self.use_lit_shell: features.add('shell') + self.with_system_environment([ + 'ASAN_SYMBOLIZER_PATH', + 'MSAN_SYMBOLIZER_PATH', + 'TSAN_SYMBOLIZER_PATH', + 'UBSAN_SYMBOLIZER_PATH' + 'ASAN_OPTIONS', + 'MSAN_OPTIONS', + 'TSAN_OPTIONS', + 'UBSAN_OPTIONS', + ]) + # Running on Darwin OS if platform.system() == 'Darwin': # FIXME: lld uses the first, other projects use the second. diff --git a/mlir/test/Unit/lit.cfg.py b/mlir/test/Unit/lit.cfg.py --- a/mlir/test/Unit/lit.cfg.py +++ b/mlir/test/Unit/lit.cfg.py @@ -33,7 +33,16 @@ if 'HOME' in os.environ: config.environment['HOME'] = os.environ['HOME'] -# Propagate path to symbolizer for ASan/MSan. -for symbolizer in ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH']: - if symbolizer in os.environ: - config.environment[symbolizer] = os.environ[symbolizer] +# Propagate sanitizer options. +for var in [ + 'ASAN_SYMBOLIZER_PATH', + 'MSAN_SYMBOLIZER_PATH', + 'TSAN_SYMBOLIZER_PATH', + 'UBSAN_SYMBOLIZER_PATH', + 'ASAN_OPTIONS', + 'MSAN_OPTIONS', + 'TSAN_OPTIONS', + 'UBSAN_OPTIONS', +]: + if var in os.environ: + config.environment[var] = os.environ[var] diff --git a/polly/test/Unit/lit.cfg b/polly/test/Unit/lit.cfg --- a/polly/test/Unit/lit.cfg +++ b/polly/test/Unit/lit.cfg @@ -32,10 +32,19 @@ if 'TEMP' in os.environ: config.environment['TEMP'] = os.environ['TEMP'] -# Propagate path to symbolizer for ASan/MSan. -for symbolizer in ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH']: - if symbolizer in os.environ: - config.environment[symbolizer] = os.environ[symbolizer] +# Propagate sanitizer options. +for var in [ + 'ASAN_SYMBOLIZER_PATH', + 'MSAN_SYMBOLIZER_PATH', + 'TSAN_SYMBOLIZER_PATH', + 'UBSAN_SYMBOLIZER_PATH', + 'ASAN_OPTIONS', + 'MSAN_OPTIONS', + 'TSAN_OPTIONS', + 'UBSAN_OPTIONS', +]: + if var in os.environ: + config.environment[var] = os.environ[var] if platform.system() == 'Darwin': shlibpath_var = 'DYLD_LIBRARY_PATH'