[Lldb-commits] [lldb] [lldb][test] skip Lua tests when the Lua interpreter is not found (PR #164793)

Vincent Palatin via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 24 01:01:03 PDT 2025


https://github.com/vpalatin updated https://github.com/llvm/llvm-project/pull/164793

>From 4e9d7a60d213e49370707708bfa9e9fb4e51537d Mon Sep 17 00:00:00 2001
From: Vincent Palatin <vpalatin at rivosinc.com>
Date: Thu, 23 Oct 2025 12:02:19 +0200
Subject: [PATCH] [lldb][test] skip Lua tests when the Lua interpreter is not
 found

When Swig is installed but not any Lua interpreter, the cmake script in
`lldb/cmake/modules/FindLuaAndSwig.cmake` will execute
`find_program(LUA_EXECUTABLE, ...)` and this will set the `LUA_EXECUTABLE`
variable to `LUA_EXECUTABLE-NOTFOUND`.

Ensure that in this case we are skipping the Lua tests requiring the
interpreter and the `LUAANDSWIG_FOUND` is not set.
---
 lldb/cmake/modules/FindLuaAndSwig.cmake | 1 +
 lldb/test/API/lua_api/TestLuaAPI.py     | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/lldb/cmake/modules/FindLuaAndSwig.cmake b/lldb/cmake/modules/FindLuaAndSwig.cmake
index 33fadb2a09740..c5df29e8d0a92 100644
--- a/lldb/cmake/modules/FindLuaAndSwig.cmake
+++ b/lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -34,6 +34,7 @@ else()
                                     FOUND_VAR
                                       LUAANDSWIG_FOUND
                                     REQUIRED_VARS
+                                      LUA_EXECUTABLE
                                       LUA_LIBRARIES
                                       LUA_INCLUDE_DIR
                                       LUA_VERSION_MINOR
diff --git a/lldb/test/API/lua_api/TestLuaAPI.py b/lldb/test/API/lua_api/TestLuaAPI.py
index 4ac795d696425..e78ed9de72375 100644
--- a/lldb/test/API/lua_api/TestLuaAPI.py
+++ b/lldb/test/API/lua_api/TestLuaAPI.py
@@ -158,7 +158,9 @@ def get_tests(self):
         return tests
 
     def test_lua_api(self):
-        if "LUA_EXECUTABLE" not in os.environ or len(os.environ["LUA_EXECUTABLE"]) == 0:
+        if "LUA_EXECUTABLE" not in os.environ or not os.path.exists(
+            os.environ["LUA_EXECUTABLE"]
+        ):
             self.skipTest("Lua API tests could not find Lua executable.")
             return
         lua_executable = os.environ["LUA_EXECUTABLE"]



More information about the lldb-commits mailing list