blob: c7438c082db2c32e28f987aa5416b41d274ddf57 [file] [log] [blame]
Sergey Matveeve850b872013-05-23 12:58:56 +00001# -*- Python -*-
2
3import os
4
5def get_required_attr(config, attr_name):
6 attr_value = getattr(config, attr_name, None)
7 if not attr_value:
8 lit.fatal("No attribute %r in test configuration! You may need to run "
9 "tests from your build directory or add this attribute "
10 "to lit.site.cfg " % attr_name)
11 return attr_value
12
13# Setup attributes common for all compiler-rt projects.
14llvm_src_root = get_required_attr(config, 'llvm_src_root')
15compiler_rt_lit_unit_cfg = os.path.join(llvm_src_root, "projects",
16 "compiler-rt", "lib",
17 "lit.common.unit.cfg")
18lit.load_config(config, compiler_rt_lit_unit_cfg)
19
20# Setup config name.
21config.name = 'LeakSanitizer'
22
23# Setup source root.
24config.test_source_root = os.path.dirname(__file__)
25
26# Setup attributes common for all compiler-rt projects.
27compiler_rt_lit_cfg = os.path.join(llvm_src_root, "projects", "compiler-rt",
28 "lib", "lit.common.cfg")
29if (not compiler_rt_lit_cfg) or (not os.path.exists(compiler_rt_lit_cfg)):
30 lit.fatal("Can't find common compiler-rt lit config at: %r"
31 % compiler_rt_lit_cfg)
32lit.load_config(config, compiler_rt_lit_cfg)
33
34# Setup default compiler flags used with -fsanitize=leak option.
35clang_lsan_cxxflags = ("-ccc-cxx "
36 + "-fsanitize=leak "
37 + "-g")
38config.substitutions.append( ("%clangxx_lsan ", (" " + config.clang + " " +
39 clang_lsan_cxxflags + " ")) )
40
41# Default test suffixes.
42config.suffixes = ['.c', '.cc', '.cpp']
43
44# LeakSanitizer tests are currently supported on x86-64 Linux only.
45if config.host_os not in ['Linux'] or config.host_arch not in ['x86_64']:
46 config.unsupported = True