aboutsummaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/tests/lit.cfg
blob: d774753985ac905ff7cd49e02df6c0bb68f17f5a (plain) (blame)
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
# -*- Python -*-

import os

def get_required_attr(config, attr_name):
  attr_value = getattr(config, attr_name, None)
  if not attr_value:
    lit.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 attributes common for all compiler-rt projects.
llvm_src_root = get_required_attr(config, 'llvm_src_root')
compiler_rt_lit_unit_cfg = os.path.join(llvm_src_root, "projects",
                                        "compiler-rt", "lib",
                                        "lit.common.unit.cfg")
lit.load_config(config, compiler_rt_lit_unit_cfg)

# Setup config name.
config.name = 'SanitizerCommon-Unit'

# Setup test source and exec root. For unit tests, we define
# it as build directory with sanitizer_common unit tests.
llvm_obj_root = get_required_attr(config, "llvm_obj_root")
config.test_exec_root = os.path.join(llvm_obj_root, "projects",
                                     "compiler-rt", "lib",
                                     "sanitizer_common", "tests")
config.test_source_root = config.test_exec_root