• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# -*- 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 = 'SanitizerCommon-Unit'
22
23# Setup test source and exec root. For unit tests, we define
24# it as build directory with sanitizer_common unit tests.
25llvm_obj_root = get_required_attr(config, "llvm_obj_root")
26config.test_exec_root = os.path.join(llvm_obj_root, "projects",
27                                     "compiler-rt", "lib",
28                                     "sanitizer_common", "tests")
29config.test_source_root = config.test_exec_root
30