Skip to content

Commit bbcba93

Browse files
Merge pull request #10875 from charles-zablit/charles-zablit/lldb/use-common-python-to-6.2
🍒 [lldb] make lit use the same PYTHONHOME for building and testing
2 parents ce8b418 + 129ab4b commit bbcba93

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

lldb/cmake/modules/FindPythonAndSwig.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
macro(FindPython3)
88
# Use PYTHON_HOME as a hint to find Python 3.
9-
set(Python3_ROOT_DIR "${PYTHON_HOME}")
9+
if(NOT Python3_ROOT_DIR)
10+
set(Python3_ROOT_DIR "${PYTHON_HOME}")
11+
endif()
1012
find_package(Python3 COMPONENTS Interpreter Development)
1113
if(Python3_FOUND AND Python3_Interpreter_FOUND)
1214

lldb/test/API/lit.cfg.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,3 +367,10 @@ def delete_module_cache(path):
367367
# Propagate XDG_CACHE_HOME
368368
if "XDG_CACHE_HOME" in os.environ:
369369
config.environment["XDG_CACHE_HOME"] = os.environ["XDG_CACHE_HOME"]
370+
371+
# Some steps required to initialize the tests dynamically link with python.dll
372+
# and need to know the location of the Python libraries. This ensures that we
373+
# use the same version of Python that was used to build lldb to run our tests.
374+
config.environment["PATH"] = os.path.pathsep.join(
375+
(config.python_root_dir, config.environment.get("PATH", ""))
376+
)

lldb/test/API/lit.site.cfg.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
2020
config.target_triple = "@LLVM_TARGET_TRIPLE@"
2121
config.lldb_build_directory = "@LLDB_TEST_BUILD_DIRECTORY@"
2222
config.python_executable = "@Python3_EXECUTABLE@"
23+
config.python_root_dir = "@Python3_ROOT_DIR@"
2324
config.lua_executable = "@LUA_EXECUTABLE@"
2425
config.lldb_lua_cpath = "@LLDB_LUA_CPATH@"
2526
config.lua_test_entry = "TestLuaAPI.py"

lldb/test/Shell/lit.cfg.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,6 @@ def calculate_arch_features(arch_string):
224224
# location of the Python libraries. This ensures that we use the same
225225
# version of Python that was used to build lldb to run our tests.
226226
config.environment["PYTHONHOME"] = config.python_root_dir
227+
config.environment["PATH"] = os.path.pathsep.join(
228+
(config.python_root_dir, config.environment.get("PATH", ""))
229+
)

0 commit comments

Comments
 (0)