xref: /netbsd-src/external/apache2/llvm/dist/clang/utils/perf-training/lit.cfg (revision e038c9c4676b0f19b1b7dd08a940c6ed64a6d5ae)
17330f729Sjoerg# -*- Python -*-
27330f729Sjoerg
37330f729Sjoergfrom lit import Test
47330f729Sjoergimport lit.formats
57330f729Sjoergimport lit.util
67330f729Sjoergimport subprocess
77330f729Sjoerg
87330f729Sjoergdef getSysrootFlagsOnDarwin(config, lit_config):
97330f729Sjoerg    # On Darwin, support relocatable SDKs by providing Clang with a
107330f729Sjoerg    # default system root path.
117330f729Sjoerg    if 'darwin' in config.target_triple:
127330f729Sjoerg        try:
13*e038c9c4Sjoerg            out = subprocess.check_output(['xcrun', '--show-sdk-path']).strip().decode()
147330f729Sjoerg            res = 0
157330f729Sjoerg        except OSError:
167330f729Sjoerg            res = -1
177330f729Sjoerg        if res == 0 and out:
187330f729Sjoerg            sdk_path = out
197330f729Sjoerg            lit_config.note('using SDKROOT: %r' % sdk_path)
207330f729Sjoerg            return '-isysroot %s' % sdk_path
217330f729Sjoerg    return ''
227330f729Sjoerg
237330f729Sjoergsysroot_flags = getSysrootFlagsOnDarwin(config, lit_config)
247330f729Sjoerg
257330f729Sjoergconfig.clang = lit.util.which('clang', config.clang_tools_dir).replace('\\', '/')
267330f729Sjoerg
277330f729Sjoergconfig.name = 'Clang Perf Training'
287330f729Sjoergconfig.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl', '.s', '.S', '.modulemap']
297330f729Sjoerg
30*e038c9c4Sjoergcc1_wrapper = '%s %s/perf-helper.py cc1' % (config.python_exe, config.perf_helper_dir)
317330f729Sjoerg
327330f729Sjoerguse_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL")
337330f729Sjoergconfig.test_format = lit.formats.ShTest(use_lit_shell == "0")
347330f729Sjoergconfig.substitutions.append( ('%clang_cpp_skip_driver', ' %s %s %s ' % (cc1_wrapper, config.clang, sysroot_flags)))
357330f729Sjoergconfig.substitutions.append( ('%clang_cpp', ' %s --driver-mode=g++ %s ' % (config.clang, sysroot_flags)))
367330f729Sjoergconfig.substitutions.append( ('%clang_skip_driver', ' %s %s %s ' % (cc1_wrapper, config.clang, sysroot_flags)))
377330f729Sjoergconfig.substitutions.append( ('%clang', ' %s %s ' % (config.clang, sysroot_flags) ) )
387330f729Sjoergconfig.substitutions.append( ('%test_root', config.test_exec_root ) )
397330f729Sjoerg
40*e038c9c4Sjoergconfig.environment['LLVM_PROFILE_FILE'] = 'perf-training-%4m.profraw'
417330f729Sjoerg
42