Skip to content

Commit 3bae8e2

Browse files
authored
[lldb] Suppport testing with debug-python on Windows (#140443)
When trying to run the LLDB API tests on Windows with a debug configuration, they fail, because the `_lldb` module won't be found. As explained in #51272, this is because lit will run the test with `python.exe` but the module is built for the debug version of python, `python_d.exe`. CMake already resolved the debug executable in `Python3_EXECUTABLE_DEBUG`, so this PR changes the `config.python_executable` to point to `python_d.exe` on Windows in debug mode. The check is equivalent to the one done in the top-level LLDB CMakeLists [when setting the python suffix](https://github.com/llvm/llvm-project/blob/3ccb15d6caf57f2a866d496ada2fb52d14b179d2/lldb/CMakeLists.txt#L79-L86).
1 parent 77de8a0 commit 3bae8e2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lldb/test/API/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ if(CMAKE_HOST_APPLE)
139139
endif()
140140
endif()
141141

142+
if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL Debug)
143+
set(LLDB_PYTHON_API_TEST_EXECUTABLE "${Python3_EXECUTABLE_DEBUG}")
144+
else()
145+
set(LLDB_PYTHON_API_TEST_EXECUTABLE "${Python3_EXECUTABLE}")
146+
endif()
147+
142148
set(dotest_args_replacement ${LLVM_BUILD_MODE})
143149

144150
if(LLDB_BUILT_STANDALONE)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ config.shared_libs = @LLVM_ENABLE_SHARED_LIBS@
1919
config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
2020
config.target_triple = "@LLVM_TARGET_TRIPLE@"
2121
config.lldb_build_directory = "@LLDB_TEST_BUILD_DIRECTORY@"
22-
config.python_executable = "@Python3_EXECUTABLE@"
22+
config.python_executable = "@LLDB_PYTHON_API_TEST_EXECUTABLE@"
2323
config.lua_executable = "@LUA_EXECUTABLE@"
2424
config.lldb_lua_cpath = "@LLDB_LUA_CPATH@"
2525
config.lua_test_entry = "TestLuaAPI.py"

0 commit comments

Comments
 (0)