blob: dfae8db4c890f34117f8403197bf3e56ba048d70 [file] [log] [blame]
Sergey Matveeve850b872013-05-23 12:58:56 +00001# -*- Python -*-
2
Sergey Matveev895659d2013-05-31 13:13:55 +00003# Common configuration for running leak detection tests under LSan/ASan.
4
Sergey Matveeve850b872013-05-23 12:58:56 +00005import os
6
7def get_required_attr(config, attr_name):
8 attr_value = getattr(config, attr_name, None)
9 if not attr_value:
10 lit.fatal("No attribute %r in test configuration! You may need to run "
11 "tests from your build directory or add this attribute "
12 "to lit.site.cfg " % attr_name)
13 return attr_value
14
Sergey Matveev895659d2013-05-31 13:13:55 +000015# Setup source root.
16lsan_lit_src_root = get_required_attr(config, 'lsan_lit_src_root')
17config.test_source_root = os.path.join(lsan_lit_src_root, 'TestCases')
18
Sergey Matveevebe3a362013-05-27 11:41:46 +000019clang_cxxflags = ("-ccc-cxx "
20 + "-g "
21 + "-O0 "
22 + "-m64 ")
23
Sergey Matveev895659d2013-05-31 13:13:55 +000024config.clang_cxxflags = clang_cxxflags
Sergey Matveevebe3a362013-05-27 11:41:46 +000025
26config.substitutions.append( ("%clangxx ", (" " + config.clang + " " +
27 clang_cxxflags + " ")) )
Sergey Matveeve850b872013-05-23 12:58:56 +000028
29# LeakSanitizer tests are currently supported on x86-64 Linux only.
30if config.host_os not in ['Linux'] or config.host_arch not in ['x86_64']:
31 config.unsupported = True
Sergey Matveev895659d2013-05-31 13:13:55 +000032
33config.suffixes = ['.c', '.cc', '.cpp']