blob: 48e1453334d095748f1b4043fce83ecf5255b6e8 [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.
Alexey Samsonov57434a32013-05-27 09:35:24 +000014compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')
15compiler_rt_lit_unit_cfg = os.path.join(compiler_rt_src_root, "lib",
Sergey Matveeve850b872013-05-23 12:58:56 +000016 "lit.common.unit.cfg")
17lit.load_config(config, compiler_rt_lit_unit_cfg)
18
19# Setup config name.
20config.name = 'LeakSanitizer'
21
22# Setup source root.
23config.test_source_root = os.path.dirname(__file__)
24
25# Setup attributes common for all compiler-rt projects.
Alexey Samsonov57434a32013-05-27 09:35:24 +000026compiler_rt_lit_cfg = os.path.join(compiler_rt_src_root, "lib",
27 "lit.common.cfg")
Sergey Matveeve850b872013-05-23 12:58:56 +000028if (not compiler_rt_lit_cfg) or (not os.path.exists(compiler_rt_lit_cfg)):
29 lit.fatal("Can't find common compiler-rt lit config at: %r"
30 % compiler_rt_lit_cfg)
31lit.load_config(config, compiler_rt_lit_cfg)
32
Sergey Matveevebe3a362013-05-27 11:41:46 +000033clang_cxxflags = ("-ccc-cxx "
34 + "-g "
35 + "-O0 "
36 + "-m64 ")
37
38clang_lsan_cxxflags = clang_cxxflags + "-fsanitize=leak "
39
40config.substitutions.append( ("%clangxx ", (" " + config.clang + " " +
41 clang_cxxflags + " ")) )
Sergey Matveeve850b872013-05-23 12:58:56 +000042config.substitutions.append( ("%clangxx_lsan ", (" " + config.clang + " " +
43 clang_lsan_cxxflags + " ")) )
44
45# Default test suffixes.
46config.suffixes = ['.c', '.cc', '.cpp']
47
48# LeakSanitizer tests are currently supported on x86-64 Linux only.
49if config.host_os not in ['Linux'] or config.host_arch not in ['x86_64']:
50 config.unsupported = True