Home | History | Annotate | Download | only in llvm-lit
      1 #!/usr/bin/env python
      2 
      3 import os
      4 import sys
      5 
      6 # Variables configured at build time.
      7 llvm_source_root = "@LLVM_SOURCE_DIR@"
      8 llvm_obj_root = "@LLVM_BINARY_DIR@"
      9 
     10 # Make sure we can find the lit package.
     11 sys.path.insert(0, os.path.join(llvm_source_root, 'utils', 'lit'))
     12 
     13 # Set up some builtin parameters, so that by default the LLVM test suite
     14 # configuration file knows how to find the object tree.
     15 builtin_parameters = {
     16     'build_mode' : "@BUILD_MODE@",
     17     'llvm_site_config' : os.path.join(llvm_obj_root, 'test', 'lit.site.cfg'),
     18     'llvm_unit_site_config' : os.path.join(llvm_obj_root, 'test', 'Unit',
     19                                            'lit.site.cfg')
     20     }
     21 
     22 clang_obj_root = os.path.join(llvm_obj_root, 'tools', 'clang')
     23 
     24 if os.path.exists(clang_obj_root):
     25     builtin_parameters['clang_site_config'] = \
     26         os.path.join(clang_obj_root, 'test', 'lit.site.cfg')
     27     clang_tools_extra_obj_root = os.path.join(clang_obj_root, 'tools', 'extra')
     28     if os.path.exists(clang_tools_extra_obj_root):
     29         builtin_parameters['clang_tools_extra_site_config'] = \
     30             os.path.join(clang_tools_extra_obj_root, 'test', 'lit.site.cfg')
     31 
     32 lld_obj_root = os.path.join(llvm_obj_root, 'tools', 'lld')
     33 if os.path.exists(lld_obj_root):
     34     builtin_parameters['lld_site_config'] = \
     35         os.path.join(lld_obj_root, 'test', 'lit.site.cfg')
     36 
     37 compilerrt_obj_root = os.path.join(llvm_obj_root, 'projects', 'compiler-rt')
     38 if os.path.exists(compilerrt_obj_root):
     39     builtin_parameters['compilerrt_site_basedir'] = \
     40             os.path.join(compilerrt_obj_root, 'test')
     41 
     42 if __name__=='__main__':
     43     import lit
     44     lit.main(builtin_parameters)
     45