• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# -*- Python -*-
2
3from lit import Test
4import lit.formats
5import lit.util
6
7def 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
22sysroot_flags = getSysrootFlagsOnDarwin(config, lit_config)
23
24config.clang = lit.util.which('clang', config.clang_tools_dir).replace('\\', '/')
25
26config.name = 'Clang Perf Training'
27config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl', '.s', '.S', '.modulemap']
28
29cc1_wrapper = '%s %s/perf-helper.py cc1' % (config.python_exe, config.test_source_root)
30
31use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL")
32config.test_format = lit.formats.ShTest(use_lit_shell == "0")
33config.substitutions.append( ('%clang_cpp_skip_driver', ' %s %s %s ' % (cc1_wrapper, config.clang, sysroot_flags)))
34config.substitutions.append( ('%clang_cpp', ' %s --driver-mode=cpp %s ' % (config.clang, sysroot_flags)))
35config.substitutions.append( ('%clang_skip_driver', ' %s %s %s ' % (cc1_wrapper, config.clang, sysroot_flags)))
36config.substitutions.append( ('%clang', ' %s %s ' % (config.clang, sysroot_flags) ) )
37config.substitutions.append( ('%test_root', config.test_exec_root ) )
38
39config.environment['LLVM_PROFILE_FILE'] = 'perf-training-%p.profraw'
40
41