From 54c7f58fc1e39ef63478398add4dd579e4c81005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= Date: Tue, 15 Oct 2024 13:15:19 +0200 Subject: [PATCH] [lldb][swift] Check runtime dependencies of SwiftREPL tests in local lit config These binaries only exists if the Swift runtime was built correctly. We cannot check them at configuration time, because they might not exist yet. --- lldb/test/Shell/SwiftREPL/lit.local.cfg | 11 +++++++++++ lldb/test/Shell/lit.site.cfg.py.in | 1 + 2 files changed, 12 insertions(+) diff --git a/lldb/test/Shell/SwiftREPL/lit.local.cfg b/lldb/test/Shell/SwiftREPL/lit.local.cfg index 29d485ea63774..539418112b925 100644 --- a/lldb/test/Shell/SwiftREPL/lit.local.cfg +++ b/lldb/test/Shell/SwiftREPL/lit.local.cfg @@ -2,3 +2,14 @@ config.suffixes = ['.test'] if 'lldb-repro' in config.available_features: config.unsupported = True + +def check_exists(path): + import os + if not os.path.isfile(path): + lit_config.warning(f"Runtime dependency not found: {path}") + +# Check runtime dependencies for SwiftREPL tests on Windows +if sys.platform == "win32": + host_arch = config.host_triple.split("-")[0] + check_exists(f"{config.swift_libs_dir}/windows/{host_arch}/swiftrt.obj") + check_exists(f"{config.llvm_shlib_dir}/swiftCore.dll") diff --git a/lldb/test/Shell/lit.site.cfg.py.in b/lldb/test/Shell/lit.site.cfg.py.in index 5e4e2676219f3..d0b8a6be6f9cd 100644 --- a/lldb/test/Shell/lit.site.cfg.py.in +++ b/lldb/test/Shell/lit.site.cfg.py.in @@ -17,6 +17,7 @@ config.cmake_sysroot = lit_config.substitute("@CMAKE_SYSROOT@") config.target_triple = "@LLVM_TARGET_TRIPLE@" config.python_executable = "@Python3_EXECUTABLE@" config.swiftc = "@LLDB_SWIFTC@" +config.swift_libs_dir = '@LLDB_SWIFT_LIBS@' config.lldb_enable_swift = @LLDB_ENABLE_SWIFT_SUPPORT@ config.have_zlib = @LLVM_ENABLE_ZLIB@ config.objc_gnustep_dir = "@LLDB_TEST_OBJC_GNUSTEP_DIR@"