summaryrefslogtreecommitdiff
path: root/test/hwasan/lit.cfg
diff options
context:
space:
mode:
Diffstat (limited to 'test/hwasan/lit.cfg')
-rw-r--r--test/hwasan/lit.cfg32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/hwasan/lit.cfg b/test/hwasan/lit.cfg
new file mode 100644
index 000000000000..4f099af5b7fc
--- /dev/null
+++ b/test/hwasan/lit.cfg
@@ -0,0 +1,32 @@
+# -*- Python -*-
+
+import os
+
+# Setup config name.
+config.name = 'HWAddressSanitizer' + getattr(config, 'name_suffix', 'default')
+
+# Setup source root.
+config.test_source_root = os.path.dirname(__file__)
+
+# Setup default compiler flags used with -fsanitize=memory option.
+clang_hwasan_cflags = ["-fsanitize=hwaddress", config.target_cflags] + config.debug_info_flags
+clang_hwasan_cxxflags = config.cxx_mode_flags + clang_hwasan_cflags
+
+def build_invocation(compile_flags):
+ return " " + " ".join([config.clang] + compile_flags) + " "
+
+config.substitutions.append( ("%clang_hwasan ", build_invocation(clang_hwasan_cflags)) )
+config.substitutions.append( ("%clangxx_hwasan ", build_invocation(clang_hwasan_cxxflags)) )
+
+default_hwasan_opts_str = ':'.join(['disable_allocator_tagging=1'] + config.default_sanitizer_opts)
+if default_hwasan_opts_str:
+ config.environment['HWASAN_OPTIONS'] = default_hwasan_opts_str
+ default_hwasan_opts_str += ':'
+config.substitutions.append(('%env_hwasan_opts=',
+ 'env HWASAN_OPTIONS=' + default_hwasan_opts_str))
+
+# Default test suffixes.
+config.suffixes = ['.c', '.cc', '.cpp']
+
+if config.host_os not in ['Linux', 'Android']:
+ config.unsupported = True