summaryrefslogtreecommitdiff
path: root/lib/lsan/lit_tests/lit.common.cfg
blob: 96dc1b1f55fca36f4680535afdce1ebbf2208f72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# -*- Python -*-

# Common configuration for running leak detection tests under LSan/ASan.

import os

def get_required_attr(config, attr_name):
  attr_value = getattr(config, attr_name, None)
  if not attr_value:
    lit_config.fatal(
      "No attribute %r in test configuration! You may need to run "
      "tests from your build directory or add this attribute "
      "to lit.site.cfg " % attr_name)
  return attr_value

# Setup source root.
lsan_lit_src_root = get_required_attr(config, 'lsan_lit_src_root')
config.test_source_root = os.path.join(lsan_lit_src_root, 'TestCases')

clang_cxxflags = ("--driver-mode=g++ "
                      + "-g "
                      + "-O0 "
                      + "-m64 ")

clang_cflags = ("-g "
                      + "-O0 "
                      + "-m64 ")

config.clang_cxxflags = clang_cxxflags

config.substitutions.append( ("%clangxx ", (" " + config.clang + " " +
                                                clang_cxxflags + " ")) )

config.clang_cflags = clang_cflags

config.substitutions.append( ("%clang ", (" " + config.clang + " " +
                                                clang_cflags + " ")) )

# LeakSanitizer tests are currently supported on x86-64 Linux only.
if config.host_os not in ['Linux'] or config.host_arch not in ['x86_64']:
  config.unsupported = True

config.suffixes = ['.c', '.cc', '.cpp']