Skip to content

Commit 6cedf6e

Browse files
authored
[MLIR] Add missing handling for LLVM_LIT_TOOLS_DIR in mlir lit config (NFC) (#154542)
This is helping some windows users, here is the doc: **LLVM_LIT_TOOLS_DIR**:PATH The path to GnuWin32 tools for tests. Valid on Windows host. Defaults to the empty string, in which case lit will look for tools needed for tests (e.g. ``grep``, ``sort``, etc.) in your ``%PATH%``. If GnuWin32 is not in your ``%PATH%``, then you can set this variable to the GnuWin32 directory so that lit can find tools needed for tests in that directory.
1 parent e172110 commit 6cedf6e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

mlir/test/lit.cfg.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
if lit_shell_env:
3030
use_lit_shell = lit.util.pythonize_bool(lit_shell_env)
3131

32+
# Set the test format based on shell configuration
3233
config.test_format = lit.formats.ShTest(execute_external=not use_lit_shell)
3334

3435
# suffixes: A list of file extensions to treat as test files.
@@ -181,10 +182,10 @@ def find_real_python_interpreter():
181182
]
182183

183184
# Tweak the PATH to include the tools dir.
184-
llvm_config.with_environment("PATH", config.mlir_tools_dir, append_path=True)
185-
llvm_config.with_environment("PATH", config.llvm_tools_dir, append_path=True)
185+
tool_dirs = [config.mlir_tools_dir, config.llvm_tools_dir, config.lit_tools_dir]
186+
for dirs in tool_dirs:
187+
llvm_config.with_environment("PATH", dirs, append_path=True)
186188

187-
tool_dirs = [config.mlir_tools_dir, config.llvm_tools_dir]
188189
tools = [
189190
"mlir-tblgen",
190191
"mlir-translate",

mlir/test/lit.site.cfg.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import sys
55
config.target_triple = "@LLVM_TARGET_TRIPLE@"
66
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
77
config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@")
8+
config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
89
config.spirv_tools_tests = @LLVM_INCLUDE_SPIRV_TOOLS_TESTS@
910
config.llvm_shlib_ext = "@SHLIBEXT@"
1011
config.llvm_shlib_dir = lit_config.substitute(path(r"@SHLIBDIR@"))

0 commit comments

Comments
 (0)