[Mlir-commits] [mlir] d33c362 - [lit] Fix setup of sanitizer environment
Vitaly Buka
llvmlistbot at llvm.org
Thu May 19 19:24:27 PDT 2022
Author: Vitaly Buka
Date: 2022-05-19T19:24:16-07:00
New Revision: d33c36235df1925b894acd1352ba0d541e97afac
URL: https://github.com/llvm/llvm-project/commit/d33c36235df1925b894acd1352ba0d541e97afac
DIFF: https://github.com/llvm/llvm-project/commit/d33c36235df1925b894acd1352ba0d541e97afac.diff
LOG: [lit] Fix setup of sanitizer environment
Not all options were propageted into tests.
Reviewed By: ychen
Differential Revision: https://reviews.llvm.org/D122869
Added:
Modified:
clang/test/Unit/lit.cfg.py
clang/test/lit.cfg.py
cross-project-tests/lit.cfg.py
llvm/test/Unit/lit.cfg.py
llvm/test/lit.cfg.py
llvm/utils/lit/lit/llvm/config.py
mlir/test/Unit/lit.cfg.py
polly/test/Unit/lit.cfg
Removed:
################################################################################
diff --git a/clang/test/Unit/lit.cfg.py b/clang/test/Unit/lit.cfg.py
index a6e906b3a87aa..1aa3abc13d7d1 100644
--- 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
index 44f5ed1d63525..bf1fa141fc48b 100644
--- 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
index 0eeec7908fe47..7bda584dc317f 100644
--- a/cross-project-tests/lit.cfg.py
+++ b/cross-project-tests/lit.cfg.py
@@ -83,11 +83,6 @@ def get_required_attr(config, attr_name):
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
index 3a5c40dc14da6..81e8dc04acea4 100644
--- 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
index 7227c92479342..b6fb8aa9fab76 100644
--- 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
index a8e73ce43dc90..b653161281464 100644
--- a/llvm/utils/lit/lit/llvm/config.py
+++ b/llvm/utils/lit/lit/llvm/config.py
@@ -56,6 +56,17 @@ def __init__(self, lit_config, config):
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
index d645971074f54..bf77dcbfb1621 100644
--- 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
index eca3aaeb33089..4763c455e6b34 100644
--- a/polly/test/Unit/lit.cfg
+++ b/polly/test/Unit/lit.cfg
@@ -32,10 +32,19 @@ if 'TMP' in os.environ:
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'
More information about the Mlir-commits
mailing list