aboutsummaryrefslogtreecommitdiff
path: root/test/sanitizer_common/lit.common.cfg
diff options
context:
space:
mode:
Diffstat (limited to 'test/sanitizer_common/lit.common.cfg')
-rw-r--r--test/sanitizer_common/lit.common.cfg38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/sanitizer_common/lit.common.cfg b/test/sanitizer_common/lit.common.cfg
new file mode 100644
index 000000000000..fb37815ff472
--- /dev/null
+++ b/test/sanitizer_common/lit.common.cfg
@@ -0,0 +1,38 @@
+# -*- Python -*-
+
+# Setup source root.
+config.test_source_root = os.path.join(os.path.dirname(__file__), "TestCases")
+
+config.name = "SanitizerCommon-" + config.tool_name
+
+if config.tool_name == "asan":
+ tool_cflags = ["-fsanitize=address"]
+ tool_options = "ASAN_OPTIONS"
+elif config.tool_name == "tsan":
+ tool_cflags = ["-fsanitize=thread"]
+ tool_options = "TSAN_OPTIONS"
+elif config.tool_name == "msan":
+ tool_cflags = ["-fsanitize=memory"]
+ tool_options = "MSAN_OPTIONS"
+elif config.tool_name == "lsan":
+ tool_cflags = ["-fsanitize=leak"]
+ tool_options = "LSAN_OPTIONS"
+else:
+ lit_config.fatal("Unknown tool for sanitizer_common tests: %r" % config.tool_name)
+
+config.available_features.add(config.tool_name)
+
+clang_cflags = config.debug_info_flags + tool_cflags + [config.target_cflags]
+clang_cxxflags = config.cxx_mode_flags + clang_cflags
+
+def build_invocation(compile_flags):
+ return " " + " ".join([config.clang] + compile_flags) + " "
+
+config.substitutions.append( ("%clang ", build_invocation(clang_cflags)) )
+config.substitutions.append( ("%clangxx ", build_invocation(clang_cxxflags)) )
+config.substitutions.append( ("%tool_options", tool_options) )
+
+config.suffixes = ['.c', '.cc', '.cpp']
+
+if config.host_os not in ['Linux', 'Darwin']:
+ config.unsupported = True