[Offload][Test] Add llvm bin in the PATH for offload-unit suite (#213149)

This PR makes the offload-unit suite put llvm bin directory on PATH so
that tests need lld can find. It fixes the issue exposed in:
https://github.com/llvm/llvm-project/pull/212860
This commit is contained in:
Kewen Meng 2026-07-30 14:24:25 -07:00 committed by GitHub
parent 256a6d2807
commit f279abcc81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View file

@ -13,6 +13,17 @@ config.name = "Offload-Unit"
# suffixes: A list of file extensions to treat as test files.
config.suffixes = []
# Add the tools bin dir to the search path so the JIT tests can
# find it. Prefer the tools from the configured LLVM install or
# bootstrapping build.
if config.bin_llvm_tools_dir:
old_path = config.environment.get("PATH")
config.environment["PATH"] = (
f"{config.bin_llvm_tools_dir}{os.path.pathsep}{old_path}"
if old_path
else config.bin_llvm_tools_dir
)
# test_source_root: The root path where tests are located.
# test_exec_root: The root path where tests should be run.
config.test_exec_root = config.unittest_dir

View file

@ -3,6 +3,7 @@
config.library_dir = "@LIBOMPTARGET_LIBRARY_DIR@"
config.unittest_dir = "@OFFLOAD_UNITTEST_DIR@"
config.llvm_build_mode = lit_config.substitute("@LLVM_BUILD_MODE@")
config.bin_llvm_tools_dir = "@LLVM_TOOLS_BINARY_DIR@"
# Let the main config do the real work.
lit_config.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/unit/lit.cfg.py")