Author: nerix
Date: 2025-05-19T11:13:49-07:00
New Revision: 3bae8e2ef2ff02dcba745cb47ea1264fd08885cc

URL: 
https://github.com/llvm/llvm-project/commit/3bae8e2ef2ff02dcba745cb47ea1264fd08885cc
DIFF: 
https://github.com/llvm/llvm-project/commit/3bae8e2ef2ff02dcba745cb47ea1264fd08885cc.diff

LOG: [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 https://github.com/llvm/llvm-project/issues/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).

Added: 
    

Modified: 
    lldb/test/API/CMakeLists.txt
    lldb/test/API/lit.site.cfg.py.in

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/CMakeLists.txt b/lldb/test/API/CMakeLists.txt
index da51f2252d023..b1ace6296f46a 100644
--- a/lldb/test/API/CMakeLists.txt
+++ b/lldb/test/API/CMakeLists.txt
@@ -139,6 +139,12 @@ if(CMAKE_HOST_APPLE)
   endif()
 endif()
 
+if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL Debug)
+  set(LLDB_PYTHON_API_TEST_EXECUTABLE "${Python3_EXECUTABLE_DEBUG}")
+else()
+  set(LLDB_PYTHON_API_TEST_EXECUTABLE "${Python3_EXECUTABLE}")
+endif()
+
 set(dotest_args_replacement ${LLVM_BUILD_MODE})
 
 if(LLDB_BUILT_STANDALONE)

diff  --git a/lldb/test/API/lit.site.cfg.py.in 
b/lldb/test/API/lit.site.cfg.py.in
index ecebc44774859..54807de8819d2 100644
--- a/lldb/test/API/lit.site.cfg.py.in
+++ b/lldb/test/API/lit.site.cfg.py.in
@@ -19,7 +19,7 @@ config.shared_libs = @LLVM_ENABLE_SHARED_LIBS@
 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_executable = "@LLDB_PYTHON_API_TEST_EXECUTABLE@"
 config.lua_executable = "@LUA_EXECUTABLE@"
 config.lldb_lua_cpath = "@LLDB_LUA_CPATH@"
 config.lua_test_entry = "TestLuaAPI.py"


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to