aboutsummaryrefslogtreecommitdiff
path: root/test/asan/lit.cfg
diff options
context:
space:
mode:
Diffstat (limited to 'test/asan/lit.cfg')
-rw-r--r--test/asan/lit.cfg39
1 files changed, 26 insertions, 13 deletions
diff --git a/test/asan/lit.cfg b/test/asan/lit.cfg
index c5164713dbe4..835547090a17 100644
--- a/test/asan/lit.cfg
+++ b/test/asan/lit.cfg
@@ -29,12 +29,19 @@ def push_dynamic_library_lookup_path(config, new_path):
# Setup config name.
config.name = 'AddressSanitizer' + config.name_suffix
-# Setup default ASAN_OPTIONS
-config.environment['ASAN_OPTIONS'] = 'symbolize_vs_style=false'
-
-# testFormat: The test format to use to interpret tests.
-external_bash = (not sys.platform in ['win32'])
-config.test_format = lit.formats.ShTest(external_bash)
+# 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'
+if default_asan_opts:
+ config.environment['ASAN_OPTIONS'] = default_asan_opts
+ default_asan_opts += ':'
+config.substitutions.append(('%env_asan_opts=',
+ 'env ASAN_OPTIONS=' + default_asan_opts))
# Setup source root.
config.test_source_root = os.path.dirname(__file__)
@@ -52,6 +59,11 @@ if config.compiler_id == 'GNU':
else:
extra_linkflags = []
+# BFD linker in 64-bit android toolchains fails to find libm.so, which is a
+# transitive shared library dependency (via asan runtime).
+if config.android:
+ extra_linkflags += ["-lm"]
+
# Setup default compiler flags used with -fsanitize=address option.
# FIXME: Review the set of required flags and check if it can be reduced.
target_cflags = [get_required_attr(config, "target_cflags")] + extra_linkflags
@@ -105,8 +117,10 @@ if platform.system() == 'Windows':
clang_invocation = build_invocation(clang_cl_asan_cxxflags)
clang_cl_invocation = clang_invocation.replace("clang.exe","clang-cl.exe")
config.substitutions.append( ("%clang_cl_asan ", clang_cl_invocation) )
- config.substitutions.append( ("%asan_dll_thunk",
- os.path.join(config.compiler_rt_libdir, "clang_rt.asan_dll_thunk-i386.lib")))
+ base_lib = os.path.join(config.compiler_rt_libdir, "clang_rt.asan%%s-%s.lib" % config.target_arch)
+ config.substitutions.append( ("%asan_lib", base_lib % "") )
+ config.substitutions.append( ("%asan_cxx_lib", base_lib % "_cxx") )
+ config.substitutions.append( ("%asan_dll_thunk", base_lib % "_dll_thunk") )
# FIXME: De-hardcode this path.
asan_source_dir = os.path.join(
@@ -153,8 +167,8 @@ config.substitutions.append( ("%dynamiclib", '%T/lib%xdynamiclib_namespec.so') )
config.substitutions.append( ("%xdynamiclib_namespec", '$(basename %t).dynamic') )
# Allow tests to use REQUIRES=stable-runtime. For use when you cannot use XFAIL
-# because the test hangs.
-if config.target_arch != 'arm':
+# because the test hangs. Adding armhf as we now have two modes.
+if config.target_arch != 'arm' and config.target_arch != 'armhf' and config.target_arch != 'aarch64':
config.available_features.add('stable-runtime')
# Turn on leak detection on 64-bit Linux.
@@ -176,7 +190,6 @@ config.suffixes = ['.c', '.cc', '.cpp']
if config.host_os == 'Darwin':
config.suffixes.append('.mm')
-# AddressSanitizer tests are currently supported on Linux, Darwin and
-# FreeBSD only.
-if config.host_os not in ['Linux', 'Darwin', 'FreeBSD']:
+# Only run the tests on supported OSs.
+if config.host_os not in ['Linux', 'Darwin', 'FreeBSD', 'Windows']:
config.unsupported = True