• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# -*- 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"]
10  tool_options = "ASAN_OPTIONS"
11elif config.tool_name == "tsan":
12  tool_cflags = ["-fsanitize=thread"]
13  tool_options = "TSAN_OPTIONS"
14elif config.tool_name == "msan":
15  tool_cflags = ["-fsanitize=memory"]
16  tool_options = "MSAN_OPTIONS"
17elif config.tool_name == "lsan":
18  tool_cflags = ["-fsanitize=leak"]
19  tool_options = "LSAN_OPTIONS"
20else:
21  lit_config.fatal("Unknown tool for sanitizer_common tests: %r" % config.tool_name)
22
23config.available_features.add(config.tool_name)
24
25clang_cflags = config.debug_info_flags + tool_cflags + [config.target_cflags]
26clang_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)) )
33config.substitutions.append( ("%tool_options", tool_options) )
34
35config.suffixes = ['.c', '.cc', '.cpp']
36
37if config.host_os not in ['Linux', 'Darwin']:
38  config.unsupported = True
39