• 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"]
10elif config.tool_name == "tsan":
11  tool_cflags = ["-fsanitize=thread"]
12elif config.tool_name == "msan":
13  tool_cflags = ["-fsanitize=memory"]
14elif config.tool_name == "lsan":
15  tool_cflags = ["-fsanitize=leak"]
16else:
17  lit_config.fatal("Unknown tool for sanitizer_common tests: %r" % config.tool_name)
18
19config.available_features.add(config.tool_name)
20
21clang_cflags = ["-g"] + tool_cflags + [config.target_cflags]
22clang_cxxflags = config.cxx_mode_flags + clang_cflags
23
24def build_invocation(compile_flags):
25  return " " + " ".join([config.clang] + compile_flags) + " "
26
27config.substitutions.append( ("%clang ", build_invocation(clang_cflags)) )
28config.substitutions.append( ("%clangxx ", build_invocation(clang_cxxflags)) )
29
30config.suffixes = ['.c', '.cc', '.cpp']
31
32if config.host_os not in ['Linux', 'Darwin']:
33  config.unsupported = True
34
35