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 llvm_src_root = get_required_attr(config, 'llvm_src_root')
     15 compiler_rt_lit_unit_cfg = os.path.join(llvm_src_root, "projects",
     16                                         "compiler-rt", "lib",
     17                                         "lit.common.unit.cfg")
     18 lit.load_config(config, compiler_rt_lit_unit_cfg)
     19 
     20 # Setup config name.
     21 config.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.
     25 llvm_obj_root = get_required_attr(config, "llvm_obj_root")
     26 config.test_exec_root = os.path.join(llvm_obj_root, "projects",
     27                                      "compiler-rt", "lib",
     28                                      "sanitizer_common", "tests")
     29 config.test_source_root = config.test_exec_root
     30