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

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.
This commit is contained in:
Vincent Palatin 2025-10-26 02:27:30 +01:00 committed by GitHub
parent 3526bb099e
commit bba6bc671b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -34,6 +34,7 @@ else()
FOUND_VAR
LUAANDSWIG_FOUND
REQUIRED_VARS
LUA_EXECUTABLE
LUA_LIBRARIES
LUA_INCLUDE_DIR
LUA_VERSION_MINOR

View File

@ -158,7 +158,9 @@ class TestLuaAPI(TestBase):
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"]