Home | History | Annotate | Download | only in tests
      1 # -*- Python -*-
      2 
      3 import os
      4 
      5 def 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.
     14 compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')
     15 compiler_rt_lit_unit_cfg = os.path.join(compiler_rt_src_root, "lib",
     16                                         "lit.common.unit.cfg")
     17 lit.load_config(config, compiler_rt_lit_unit_cfg)
     18 
     19 # Setup config name.
     20 config.name = 'SanitizerCommon-Unit'
     21 
     22 # Setup test source and exec root. For unit tests, we define
     23 # it as build directory with sanitizer_common unit tests.
     24 llvm_obj_root = get_required_attr(config, "llvm_obj_root")
     25 config.test_exec_root = os.path.join(llvm_obj_root, "projects",
     26                                      "compiler-rt", "lib",
     27                                      "sanitizer_common", "tests")
     28 config.test_source_root = config.test_exec_root
     29