aboutsummaryrefslogtreecommitdiff
path: root/lit/lit.cfg
diff options
context:
space:
mode:
Diffstat (limited to 'lit/lit.cfg')
-rw-r--r--lit/lit.cfg65
1 files changed, 65 insertions, 0 deletions
diff --git a/lit/lit.cfg b/lit/lit.cfg
index 3f1a90c7f4fa..dd89b45fadec 100644
--- a/lit/lit.cfg
+++ b/lit/lit.cfg
@@ -112,17 +112,82 @@ if config.test_exec_root is None:
lit_config.load_config(config, site_cfg)
raise SystemExit
+# Register substitutions
+config.substitutions.append(('%python', config.python_executable))
+
+debugserver = lit.util.which('debugserver', llvm_tools_dir)
+lldb = lit.util.which('lldb', llvm_tools_dir)
+
+if not os.path.exists(config.cc):
+ config.cc = lit.util.which(config.cc, llvm_tools_dir)
+
+if not os.path.exists(config.cxx):
+ config.cxx = lit.util.which(config.cxx, llvm_tools_dir)
+
+if platform.system() in ['Darwin']:
+ try:
+ out = lit.util.capture(['xcrun', '--show-sdk-path']).strip()
+ res = 0
+ except OSError:
+ res = -1
+ if res == 0 and out:
+ sdk_path = out
+ lit_config.note('using SDKROOT: %r' % sdk_path)
+ config.cc += " -isysroot %s" % sdk_path
+ config.cxx += " -isysroot %s" % sdk_path
+
+config.substitutions.append(('%cc', config.cc))
+config.substitutions.append(('%cxx', config.cxx))
+
+config.substitutions.append(('%lldb', lldb))
+
+if debugserver is not None:
+ config.substitutions.append(('%debugserver', debugserver))
+
+for pattern in [r"\bFileCheck\b",
+ r"\| \bnot\b"]:
+ tool_match = re.match(r"^(\\)?((\| )?)\W+b([0-9A-Za-z-_]+)\\b\W*$",
+ pattern)
+ tool_pipe = tool_match.group(2)
+ tool_name = tool_match.group(4)
+ tool_path = lit.util.which(tool_name, config.llvm_tools_dir)
+ if not tool_path:
+ # Warn, but still provide a substitution.
+ lit_config.note(
+ 'Did not find ' + tool_name + ' in ' + config.llvm_tools_dir)
+ config.substitutions.append((pattern, tool_pipe + tool_path))
+
# Shell execution
if platform.system() not in ['Windows'] or lit_config.getBashPath() != '':
config.available_features.add('shell')
# Running on Darwin OS
if platform.system() in ['Darwin']:
+ config.available_features.add('darwin')
config.available_features.add('system-linker-mach-o')
# Running on ELF based *nix
if platform.system() in ['FreeBSD', 'Linux']:
config.available_features.add('system-linker-elf')
+ if platform.system() in ['FreeBSD']:
+ config.available_features.add('freebsd')
+ else:
+ config.available_features.add('linux')
+
+if platform.system() in ['Windows']:
+ config.available_features.add('windows')
+
+if re.match(r'^arm(hf.*-linux)|(.*-linux-gnuabihf)', config.target_triple):
+ config.available_features.add("armhf-linux")
+
+if re.match(r'icc', config.cc):
+ config.available_features.add("compiler-icc")
+elif re.match(r'clang', config.cc):
+ config.available_features.add("compiler-clang")
+elif re.match(r'gcc', config.cc):
+ config.available_features.add("compiler-gcc")
+elif re.match(r'cl', config.cc):
+ config.available_features.add("compiler-msvc")
# llvm-config knows whether it is compiled with asserts (and)
# whether we are operating in release/debug mode.