Home | History | Annotate | Download | only in perf-training
      1 # -*- Python -*-
      2 
      3 from lit import Test
      4 import lit.formats
      5 import lit.util
      6 
      7 def getSysrootFlagsOnDarwin(config, lit_config):
      8     # On Darwin, support relocatable SDKs by providing Clang with a
      9     # default system root path.
     10     if 'darwin' in config.target_triple:
     11         try:
     12             out = lit.util.capture(['xcrun', '--show-sdk-path']).strip()
     13             res = 0
     14         except OSError:
     15             res = -1
     16         if res == 0 and out:
     17             sdk_path = out
     18             lit_config.note('using SDKROOT: %r' % sdk_path)
     19             return '-isysroot %s' % sdk_path
     20     return ''
     21 
     22 sysroot_flags = getSysrootFlagsOnDarwin(config, lit_config)
     23 
     24 config.clang = lit.util.which('clang', config.clang_tools_dir).replace('\\', '/')
     25 
     26 config.name = 'Clang Perf Training'
     27 config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl', '.s', '.S', '.modulemap']
     28 
     29 use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL")
     30 config.test_format = lit.formats.ShTest(use_lit_shell == "0")
     31 config.substitutions.append( ('%clang_cpp', ' %s --driver-mode=cpp %s ' % (config.clang, sysroot_flags)))
     32 config.substitutions.append( ('%clang_cc1', ' %s -cc1 %s ' % (config.clang, sysroot_flags)))
     33 config.substitutions.append( ('%clang', ' %s %s ' % (config.clang, sysroot_flags) ) )
     34 config.substitutions.append( ('%test_root', config.test_exec_root ) )
     35 
     36 config.environment['LLVM_PROFILE_FILE'] = 'perf-training-%p.profraw'
     37 
     38