summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/tsan/lit.cfg
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/test/tsan/lit.cfg')
-rw-r--r--compiler-rt/test/tsan/lit.cfg13
1 files changed, 9 insertions, 4 deletions
diff --git a/compiler-rt/test/tsan/lit.cfg b/compiler-rt/test/tsan/lit.cfg
index 54112f7b8bf..2be10dae1c8 100644
--- a/compiler-rt/test/tsan/lit.cfg
+++ b/compiler-rt/test/tsan/lit.cfg
@@ -18,14 +18,19 @@ config.name = 'ThreadSanitizer'
config.test_source_root = os.path.dirname(__file__)
# Setup environment variables for running ThreadSanitizer.
-tsan_options = "atexit_sleep_ms=0"
+default_tsan_opts = "atexit_sleep_ms=0"
if config.host_os == 'Darwin':
# On Darwin, we default to `abort_on_error=1`, which would make tests run
# much slower. Let's override this and run lit tests with 'abort_on_error=0'.
- tsan_options += ':abort_on_error=0'
-
-config.environment['TSAN_OPTIONS'] = tsan_options
+ default_tsan_opts += ':abort_on_error=0'
+
+# Platform-specific default TSAN_OPTIONS for lit tests.
+if default_tsan_opts:
+ config.environment['TSAN_OPTIONS'] = default_tsan_opts
+ default_tsan_opts += ':'
+config.substitutions.append(('%env_tsan_opts=',
+ 'env TSAN_OPTIONS=' + default_tsan_opts))
# GCC driver doesn't add necessary compile/link flags with -fsanitize=thread.
if config.compiler_id == 'GNU':
OpenPOWER on IntegriCloud