blob: f2d3fec6baa2643fb74461d4cf10f2bdb84aa6fa [file] [log] [blame]
Stephen Hines2d1fdb22014-05-28 23:58:16 -07001# -*- Python -*-
2
3# Setup source root.
4config.test_source_root = os.path.join(os.path.dirname(__file__), "TestCases")
5
6config.name = "SanitizerCommon-" + config.tool_name
7
8if config.tool_name == "asan":
9 tool_cflags = ["-fsanitize=address"]
Stephen Hines6d186232014-11-26 17:56:19 -080010 tool_options = "ASAN_OPTIONS"
Stephen Hines2d1fdb22014-05-28 23:58:16 -070011elif config.tool_name == "tsan":
12 tool_cflags = ["-fsanitize=thread"]
Stephen Hines6d186232014-11-26 17:56:19 -080013 tool_options = "TSAN_OPTIONS"
Stephen Hines2d1fdb22014-05-28 23:58:16 -070014elif config.tool_name == "msan":
15 tool_cflags = ["-fsanitize=memory"]
Stephen Hines6d186232014-11-26 17:56:19 -080016 tool_options = "MSAN_OPTIONS"
Stephen Hines6a211c52014-07-21 00:49:56 -070017elif config.tool_name == "lsan":
18 tool_cflags = ["-fsanitize=leak"]
Stephen Hines6d186232014-11-26 17:56:19 -080019 tool_options = "LSAN_OPTIONS"
Stephen Hines2d1fdb22014-05-28 23:58:16 -070020else:
21 lit_config.fatal("Unknown tool for sanitizer_common tests: %r" % config.tool_name)
22
23config.available_features.add(config.tool_name)
24
Stephen Hines6d186232014-11-26 17:56:19 -080025clang_cflags = config.debug_info_flags + tool_cflags + [config.target_cflags]
Stephen Hines2d1fdb22014-05-28 23:58:16 -070026clang_cxxflags = config.cxx_mode_flags + clang_cflags
27
28def build_invocation(compile_flags):
29 return " " + " ".join([config.clang] + compile_flags) + " "
30
31config.substitutions.append( ("%clang ", build_invocation(clang_cflags)) )
32config.substitutions.append( ("%clangxx ", build_invocation(clang_cxxflags)) )
Pirama Arumuga Nainarcdce50b2015-07-01 12:26:56 -070033config.substitutions.append( ("%tool_name", config.tool_name) )
Stephen Hines6d186232014-11-26 17:56:19 -080034config.substitutions.append( ("%tool_options", tool_options) )
Stephen Hines2d1fdb22014-05-28 23:58:16 -070035
36config.suffixes = ['.c', '.cc', '.cpp']
37
38if config.host_os not in ['Linux', 'Darwin']:
39 config.unsupported = True