2014-05-09 08:28:18 +08:00
|
|
|
# -*- 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"]
|
2014-10-25 02:34:43 +08:00
|
|
|
tool_options = "ASAN_OPTIONS"
|
2014-05-09 08:28:18 +08:00
|
|
|
elif config.tool_name == "tsan":
|
|
|
|
tool_cflags = ["-fsanitize=thread"]
|
2014-10-25 02:34:43 +08:00
|
|
|
tool_options = "TSAN_OPTIONS"
|
2014-05-09 08:28:18 +08:00
|
|
|
elif config.tool_name == "msan":
|
|
|
|
tool_cflags = ["-fsanitize=memory"]
|
2014-10-25 02:34:43 +08:00
|
|
|
tool_options = "MSAN_OPTIONS"
|
2014-07-04 15:30:34 +08:00
|
|
|
elif config.tool_name == "lsan":
|
|
|
|
tool_cflags = ["-fsanitize=leak"]
|
2014-10-25 02:34:43 +08:00
|
|
|
tool_options = "LSAN_OPTIONS"
|
2014-05-09 08:28:18 +08:00
|
|
|
else:
|
|
|
|
lit_config.fatal("Unknown tool for sanitizer_common tests: %r" % config.tool_name)
|
|
|
|
|
2014-05-26 21:08:08 +08:00
|
|
|
config.available_features.add(config.tool_name)
|
|
|
|
|
2014-09-06 06:05:32 +08:00
|
|
|
clang_cflags = config.debug_info_flags + tool_cflags + [config.target_cflags]
|
2014-05-09 08:28:18 +08:00
|
|
|
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)) )
|
2014-10-25 02:34:43 +08:00
|
|
|
config.substitutions.append( ("%tool_options", tool_options) )
|
2014-05-09 08:28:18 +08:00
|
|
|
|
|
|
|
config.suffixes = ['.c', '.cc', '.cpp']
|
|
|
|
|
|
|
|
if config.host_os not in ['Linux', 'Darwin']:
|
|
|
|
config.unsupported = True
|