[libcxxabi] r220464 - [libcxxabi] Add support for running libc++abi tests with sanitizers
Eric Fiselier
eric at efcs.ca
Wed Oct 22 20:10:43 PDT 2014
Author: ericwf
Date: Wed Oct 22 22:10:43 2014
New Revision: 220464
URL: http://llvm.org/viewvc/llvm-project?rev=220464&view=rev
Log:
[libcxxabi] Add support for running libc++abi tests with sanitizers
Summary: Add support for LLVM_USE_SANITIZER to the libc++abi tests. Currently, if libc++abi is configured with LLVM_USE_SANITIZER then none of the tests will pass.
Reviewers: jroelofs, mclow.lists, danalbert
Reviewed By: danalbert
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D5926
Modified:
libcxxabi/trunk/test/lit.cfg
libcxxabi/trunk/test/lit.site.cfg.in
Modified: libcxxabi/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/lit.cfg?rev=220464&r1=220463&r2=220464&view=diff
==============================================================================
--- libcxxabi/trunk/test/lit.cfg (original)
+++ libcxxabi/trunk/test/lit.cfg Wed Oct 22 22:10:43 2014
@@ -222,6 +222,31 @@ include_paths = ['-I' + libcxxabi_src_ro
library_paths = ['-L' + libcxxabi_obj_root + '/lib']
compile_flags = ['-std=c++11']
+
+san = lit_config.params.get('llvm_use_sanitizer', None)
+if san is None:
+ san = getattr(config, 'llvm_use_sanitizer', None)
+if san:
+ if not sys.platform.startswith('freebsd'):
+ link_flags += ['-ldl']
+ if san == 'Address':
+ compile_flags += ['-fsanitize=address']
+ config.available_features.add('asan')
+ elif san == 'Memory' or san == 'MemoryWithOrigins':
+ compile_flags += ['-fsanitize=memory']
+ config.available_features.add('msan')
+ if san == 'MemoryWithOrigins':
+ compile_flags += ['-fsanitize-memory-track-origins']
+ elif san == 'Undefined':
+ compile_flags += ['-fsanitize=undefined',
+ '-fno-sanitize=vptr,function',
+ '-fno-sanitize-recover']
+ config.available_features.add('ubsan')
+ else:
+ lit_config.fatal('unsupported value for '
+ 'llvm_use_sanitizer: {0}'.format(san))
+
+
# Configure extra linker parameters.
exec_env = {}
if sys.platform == 'darwin':
Modified: libcxxabi/trunk/test/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/lit.site.cfg.in?rev=220464&r1=220463&r2=220464&view=diff
==============================================================================
--- libcxxabi/trunk/test/lit.site.cfg.in (original)
+++ libcxxabi/trunk/test/lit.site.cfg.in Wed Oct 22 22:10:43 2014
@@ -6,6 +6,7 @@ config.python_executable = "@PYTHON_
config.enable_shared = @LIBCXXABI_ENABLE_SHARED@
config.libcxx_includes = "@LIBCXXABI_LIBCXX_INCLUDES@"
config.llvm_unwinder = @LIBCXXABI_USE_LLVM_UNWINDER@
+config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
# Let the main config do the real work.
lit_config.load_config(config, "@LIBCXXABI_SOURCE_DIR@/test/lit.cfg")
More information about the cfe-commits
mailing list