[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / debuginfo-tests / lit.cfg.py
blob837c930ac7fd9feb1e6aa2d04871c5f967d1d31a
1 # -*- Python -*-
3 import os
4 import platform
5 import re
6 import subprocess
7 import sys
8 import tempfile
10 import lit.formats
11 import lit.util
13 from lit.llvm import llvm_config
14 from lit.llvm.subst import ToolSubst
15 from lit.llvm.subst import FindTool
17 # Configuration file for the 'lit' test runner.
19 # name: The name of this test suite.
20 config.name = 'debuginfo-tests'
22 # testFormat: The test format to use to interpret tests.
24 # For now we require '&&' between commands, until they get globally killed and
25 # the test runner updated.
26 config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
28 # suffixes: A list of file extensions to treat as test files.
29 config.suffixes = ['.c', '.cpp', '.m']
31 # excludes: A list of directories to exclude from the testsuite. The 'Inputs'
32 # subdirectories contain auxiliary inputs for various tests in their parent
33 # directories.
34 config.excludes = ['Inputs']
36 # test_source_root: The root path where tests are located.
37 config.test_source_root = os.path.join(config.debuginfo_tests_src_root)
39 # test_exec_root: The root path where tests should be run.
40 config.test_exec_root = config.debuginfo_tests_obj_root
42 llvm_config.use_default_substitutions()
44 tools = [
45 ToolSubst('%test_debuginfo', command=os.path.join(
46 config.debuginfo_tests_src_root, 'llgdb-tests', 'test_debuginfo.pl')),
47 ToolSubst("%llvm_src_root", config.llvm_src_root),
48 ToolSubst("%llvm_tools_dir", config.llvm_tools_dir),
51 def get_required_attr(config, attr_name):
52 attr_value = getattr(config, attr_name, None)
53 if attr_value == None:
54 lit_config.fatal(
55 "No attribute %r in test configuration! You may need to run "
56 "tests from your build directory or add this attribute "
57 "to lit.site.cfg " % attr_name)
58 return attr_value
60 # If this is an MSVC environment, the tests at the root of the tree are
61 # unsupported. The local win_cdb test suite, however, is supported.
62 is_msvc = get_required_attr(config, "is_msvc")
63 if is_msvc:
64 config.available_features.add('msvc')
65 # FIXME: We should add some llvm lit utility code to find the Windows SDK
66 # and set up the environment appopriately.
67 win_sdk = 'C:/Program Files (x86)/Windows Kits/10/'
68 arch = 'x64'
69 llvm_config.with_system_environment(['LIB', 'LIBPATH', 'INCLUDE'])
70 # Clear _NT_SYMBOL_PATH to prevent cdb from attempting to load symbols from
71 # the network.
72 llvm_config.with_environment('_NT_SYMBOL_PATH', '')
73 tools.append(ToolSubst('%cdb', '"%s"' % os.path.join(win_sdk, 'Debuggers',
74 arch, 'cdb.exe')))
76 # clang_src_dir is not used by these tests, but is required by
77 # use_clang(), so set it to "".
78 if not hasattr(config, 'clang_src_dir'):
79 config.clang_src_dir = ""
80 llvm_config.use_clang()
82 if config.llvm_use_sanitizer:
83 # Propagate path to symbolizer for ASan/MSan.
84 llvm_config.with_system_environment(
85 ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH'])
86 llvm_config.with_environment('PATHTOCLANG', llvm_config.config.clang)
87 llvm_config.with_environment('PATHTOCLANGPP', llvm_config.use_llvm_tool('clang++'))
88 llvm_config.with_environment('PATHTOCLANGCL', llvm_config.use_llvm_tool('clang-cl'))
90 # Check which debuggers are available:
91 built_lldb = llvm_config.use_llvm_tool('lldb', search_env='CLANG')
92 lldb_path = None
93 if built_lldb is not None:
94 lldb_path = built_lldb
95 elif lit.util.which('lldb') is not None:
96 lldb_path = lit.util.which('lldb')
98 if lldb_path is not None:
99 config.available_features.add('lldb')
101 # Produce dexter path, lldb path, and combine into the %dexter substitution
102 # for running a test.
103 dexter_path = os.path.join(config.debuginfo_tests_src_root,
104 'dexter', 'dexter.py')
105 dexter_test_cmd = '"{}" "{}" test'.format(config.python3_executable, dexter_path)
106 if lldb_path is not None:
107 dexter_test_cmd += ' --lldb-executable {}'.format(lldb_path)
108 tools.append(ToolSubst('%dexter', dexter_test_cmd))
110 # For testing other bits of dexter that aren't under the "test" subcommand,
111 # have a %dexter_base substitution.
112 dexter_base_cmd = '"{}" "{}"'.format(config.python3_executable, dexter_path)
113 tools.append(ToolSubst('%dexter_base', dexter_base_cmd))
115 tool_dirs = [config.llvm_tools_dir]
117 llvm_config.add_tool_substitutions(tools, tool_dirs)
119 lit.util.usePlatformSdkOnDarwin(config, lit_config)
121 # available_features: REQUIRES/UNSUPPORTED lit commands look at this list.
122 if platform.system() == 'Darwin':
123 import subprocess
124 xcode_lldb_vers = subprocess.check_output(['xcrun', 'lldb', '--version']).decode("utf-8")
125 match = re.search('lldb-(\d+)', xcode_lldb_vers)
126 if match:
127 apple_lldb_vers = int(match.group(1))
128 if apple_lldb_vers < 1000:
129 config.available_features.add('apple-lldb-pre-1000')