summaryrefslogtreecommitdiff
path: root/test/lit.cfg
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit.cfg')
-rw-r--r--test/lit.cfg87
1 files changed, 80 insertions, 7 deletions
diff --git a/test/lit.cfg b/test/lit.cfg
index 5b49765f7894..54e8c7f546f8 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -14,16 +14,43 @@ import lit.util
# name: The name of this test suite.
config.name = 'lld'
+# Tweak PATH for Win32
+if sys.platform in ['win32']:
+ # Seek sane tools in directories and set to $PATH.
+ path = getattr(config, 'lit_tools_dir', None)
+ path = lit_config.getToolsPath(path,
+ config.environment['PATH'],
+ ['cmp.exe', 'grep.exe', 'sed.exe'])
+ if path is not None:
+ path = os.path.pathsep.join((path,
+ config.environment['PATH']))
+ config.environment['PATH'] = path
+
+# Choose between lit's internal shell pipeline runner and a real shell. If
+# LIT_USE_INTERNAL_SHELL is in the environment, we use that as an override.
+use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL")
+if use_lit_shell:
+ # 0 is external, "" is default, and everything else is internal.
+ execute_external = (use_lit_shell == "0")
+else:
+ # Otherwise we default to internal on Windows and external elsewhere, as
+ # bash on Windows is usually very slow.
+ execute_external = (not sys.platform in ['win32'])
+
+
# testFormat: The test format to use to interpret tests.
#
# For now we require '&&' between commands, until they get globally killed and
# the test runner updated.
-execute_external = (platform.system() != 'Windows'
- or lit_config.getBashPath() not in [None, ""])
config.test_format = lit.formats.ShTest(execute_external)
# suffixes: A list of file extensions to treat as test files.
-config.suffixes = ['.objtxt', '.test']
+config.suffixes = ['.ll', '.objtxt', '.test']
+
+# excludes: A list of directories to exclude from the testsuite. The 'Inputs'
+# subdirectories contain auxiliary inputs for various tests in their parent
+# directories.
+config.excludes = ['Inputs']
# test_source_root: The root path where tests are located.
config.test_source_root = os.path.dirname(__file__)
@@ -112,6 +139,46 @@ if config.test_exec_root is None:
lit_config.load_config(config, site_cfg)
raise SystemExit
+# For each occurrence of a lld tool name as its own word, replace it
+# with the full path to the build directory holding that tool. This
+# ensures that we are testing the tools just built and not some random
+# tools that might happen to be in the user's PATH.
+
+# Regex assertions to reject neighbor hyphens/dots (seen in some tests).
+# For example, we want to prefix 'lld' and 'ld.lld' but not the 'lld' inside
+# of 'ld.lld'.
+NoPreJunk = r"(?<!(-|\.|/))"
+NoPostJunk = r"(?!(-|\.))"
+
+tool_patterns = [r"\bFileCheck\b",
+ r"\bnot\b",
+ NoPreJunk + r"\blld\b" + NoPostJunk,
+ r"\bld.lld\b",
+ r"\blld-link\b",
+ r"\bllvm-mc\b",
+ r"\bllvm-nm\b",
+ r"\bllvm-objdump\b",
+ r"\bllvm-readobj\b",
+ r"\byaml2obj\b"]
+
+for pattern in tool_patterns:
+ # Extract the tool name from the pattern. This relies on the tool
+ # name being surrounded by \b word match operators. If the
+ # pattern starts with "| ", include it in the string to be
+ # substituted.
+ 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, llvm_tools_dir)
+ if not tool_path:
+ # Warn, but still provide a substitution.
+ lit_config.note('Did not find ' + tool_name + ' in ' + llvm_tools_dir)
+ tool_path = llvm_tools_dir + '/' + tool_name
+ config.substitutions.append((pattern, tool_pipe + tool_path))
+
+###
+
# When running under valgrind, we mangle '-vg' onto the end of the triple so we
# can check it with XFAIL and XTARGET.
if lit_config.useValgrind:
@@ -148,12 +215,18 @@ if re.search(r'DEBUG', llvm_config_output_list[0]):
config.available_features.add('debug')
if re.search(r'ON', llvm_config_output_list[1]):
config.available_features.add('asserts')
-if re.search(r'ARM', llvm_config_output_list[2]):
+
+archs = llvm_config_output_list[2]
+if re.search(r'AArch64', archs):
+ config.available_features.add('aarch64')
+if re.search(r'ARM', archs):
config.available_features.add('arm')
-if re.search(r'Mips', llvm_config_output_list[2]):
+if re.search(r'Mips', archs):
config.available_features.add('mips')
-if re.search(r'X86', llvm_config_output_list[2]):
+if re.search(r'X86', archs):
config.available_features.add('x86')
+if re.search(r'PowerPC', archs):
+ config.available_features.add('ppc')
llvm_config_cmd.wait()
# Check if Windows resource file compiler exists.
@@ -163,5 +236,5 @@ if cvtres and rc:
config.available_features.add('winres')
# Check if "lib.exe" command exists.
-if lit.util.which('lib.exe', config.environment['PATH']):
+if lit.util.which('lib', config.environment['PATH']):
config.available_features.add('winlib')