summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2017-10-06 20:53:40 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2017-10-06 20:53:40 +0000
commit0a4217c14b7b4204ffbf5299f973c5a0f584d686 (patch)
treebaab336855061394638e0278d226e4a0a1d83e90
parentf29ee9a050f14cbf073676aafab8b6e803cd32a0 (diff)
downloadbcm5719-llvm-0a4217c14b7b4204ffbf5299f973c5a0f584d686.tar.gz
bcm5719-llvm-0a4217c14b7b4204ffbf5299f973c5a0f584d686.zip
Factor out default_(a|ub)sanitizer_opts in lit.
Reviewers: vitalybuka Subscribers: srhines, llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D38644 llvm-svn: 315106
-rw-r--r--compiler-rt/test/asan/lit.cfg34
-rw-r--r--compiler-rt/test/lit.common.cfg10
-rw-r--r--compiler-rt/test/ubsan/lit.common.cfg9
3 files changed, 22 insertions, 31 deletions
diff --git a/compiler-rt/test/asan/lit.cfg b/compiler-rt/test/asan/lit.cfg
index fc8daaaf0f5..ad4e6a49d69 100644
--- a/compiler-rt/test/asan/lit.cfg
+++ b/compiler-rt/test/asan/lit.cfg
@@ -31,29 +31,19 @@ def push_dynamic_library_lookup_path(config, new_path):
config.name = 'AddressSanitizer' + config.name_suffix
# Platform-specific default ASAN_OPTIONS for lit tests.
-default_asan_opts = ''
-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'.
- # Also, make sure we do not overwhelm the syslog while testing.
- default_asan_opts = 'abort_on_error=0'
- default_asan_opts += ':log_to_syslog=0'
-
- # On Darwin, leak checking is not enabled by default. Enable for x86_64
- # tests to prevent regressions
- if config.target_arch == 'x86_64':
- default_asan_opts += ':detect_leaks=1'
-elif config.android:
- # The same as on Darwin, we default to "abort_on_error=1" which slows down
- # testing. Also, all existing tests are using "not" instead of "not --crash"
- # which does not work for abort()-terminated programs.
- default_asan_opts = 'abort_on_error=0'
-
-if default_asan_opts:
- config.environment['ASAN_OPTIONS'] = default_asan_opts
- default_asan_opts += ':'
+default_asan_opts = list(config.default_sanitizer_opts)
+
+# On Darwin, leak checking is not enabled by default. Enable for x86_64
+# tests to prevent regressions
+if config.host_os == 'Darwin' and config.target_arch == 'x86_64':
+ default_asan_opts += ['detect_leaks=1']
+
+default_asan_opts_str = ':'.join(default_asan_opts)
+if default_asan_opts_str:
+ config.environment['ASAN_OPTIONS'] = default_asan_opts_str
+ default_asan_opts_str += ':'
config.substitutions.append(('%env_asan_opts=',
- 'env ASAN_OPTIONS=' + default_asan_opts))
+ 'env ASAN_OPTIONS=' + default_asan_opts_str))
# Setup source root.
config.test_source_root = os.path.dirname(__file__)
diff --git a/compiler-rt/test/lit.common.cfg b/compiler-rt/test/lit.common.cfg
index bd4f3ac56a9..9636f9211c9 100644
--- a/compiler-rt/test/lit.common.cfg
+++ b/compiler-rt/test/lit.common.cfg
@@ -11,7 +11,6 @@ import subprocess
import lit.formats
import lit.util
-
# Choose between lit's internal shell pipeline runner and a real shell. If
# LIT_USE_INTERNAL_SHELL is in the environment, we use that as an override.
use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL")
@@ -295,3 +294,12 @@ elif config.host_os == 'Linux':
config.substitutions.append( ("%dynamiclib", '%T/%xdynamiclib_filename') )
config.substitutions.append( ("%xdynamiclib_filename", 'lib%xdynamiclib_namespec.so') )
config.substitutions.append( ("%xdynamiclib_namespec", '%basename_t.dynamic') )
+
+config.default_sanitizer_opts = []
+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'.
+ config.default_sanitizer_opts += ['abort_on_error=0']
+ config.default_sanitizer_opts += ['log_to_syslog=0']
+elif config.android:
+ config.default_sanitizer_opts += ['abort_on_error=0']
diff --git a/compiler-rt/test/ubsan/lit.common.cfg b/compiler-rt/test/ubsan/lit.common.cfg
index 8365194d8a0..718d66741d2 100644
--- a/compiler-rt/test/ubsan/lit.common.cfg
+++ b/compiler-rt/test/ubsan/lit.common.cfg
@@ -14,7 +14,7 @@ def get_required_attr(config, attr_name):
# Setup source root.
config.test_source_root = os.path.dirname(__file__)
-default_ubsan_opts = []
+default_ubsan_opts = list(config.default_sanitizer_opts)
# Choose between standalone and UBSan+ASan modes.
ubsan_lit_test_mode = get_required_attr(config, 'ubsan_lit_test_mode')
if ubsan_lit_test_mode == "Standalone":
@@ -41,13 +41,6 @@ else:
if config.target_arch == 's390x':
# On SystemZ we need -mbackchain to make the fast unwinder work.
clang_ubsan_cflags.append("-mbackchain")
-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'.
- default_ubsan_opts += ['abort_on_error=0']
- default_ubsan_opts += ['log_to_syslog=0']
-elif config.android:
- default_ubsan_opts += ['abort_on_error=0']
default_ubsan_opts_str = ':'.join(default_ubsan_opts)
if default_ubsan_opts_str:
OpenPOWER on IntegriCloud