Skip to content

🍒 [lldb] make lit use the same PYTHONHOME for building and testing #10875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lldb/cmake/modules/FindPythonAndSwig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

macro(FindPython3)
# Use PYTHON_HOME as a hint to find Python 3.
set(Python3_ROOT_DIR "${PYTHON_HOME}")
if(NOT Python3_ROOT_DIR)
set(Python3_ROOT_DIR "${PYTHON_HOME}")
endif()
find_package(Python3 COMPONENTS Interpreter Development)
if(Python3_FOUND AND Python3_Interpreter_FOUND)

Expand Down
7 changes: 7 additions & 0 deletions lldb/test/API/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,3 +367,10 @@ def delete_module_cache(path):
# Propagate XDG_CACHE_HOME
if "XDG_CACHE_HOME" in os.environ:
config.environment["XDG_CACHE_HOME"] = os.environ["XDG_CACHE_HOME"]

# Some steps required to initialize the tests dynamically link with python.dll
# and need to know the location of the Python libraries. This ensures that we
# use the same version of Python that was used to build lldb to run our tests.
config.environment["PATH"] = os.path.pathsep.join(
(config.python_root_dir, config.environment.get("PATH", ""))
)
1 change: 1 addition & 0 deletions lldb/test/API/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
config.target_triple = "@LLVM_TARGET_TRIPLE@"
config.lldb_build_directory = "@LLDB_TEST_BUILD_DIRECTORY@"
config.python_executable = "@Python3_EXECUTABLE@"
config.python_root_dir = "@Python3_ROOT_DIR@"
config.lua_executable = "@LUA_EXECUTABLE@"
config.lldb_lua_cpath = "@LLDB_LUA_CPATH@"
config.lua_test_entry = "TestLuaAPI.py"
Expand Down
3 changes: 3 additions & 0 deletions lldb/test/Shell/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,6 @@ def calculate_arch_features(arch_string):
# location of the Python libraries. This ensures that we use the same
# version of Python that was used to build lldb to run our tests.
config.environment["PYTHONHOME"] = config.python_root_dir
config.environment["PATH"] = os.path.pathsep.join(
(config.python_root_dir, config.environment.get("PATH", ""))
)