From 1dcabd217ce596742be9cfd0fbba5263f5b4c549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= Date: Mon, 14 Oct 2024 15:33:49 +0200 Subject: [PATCH] Propagate SDKROOT env var in Shell tests on Windows We need the manual lookup in lldb/source/Host/windows/HostInfoWindowsSwift.cpp to succeed. Otherwise SwiftASTContext::CreateInstance() fails with: Cannot create Swift scratch context (couldn't load the Swift stdlib) --- lldb/test/Shell/helper/toolchain.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lldb/test/Shell/helper/toolchain.py b/lldb/test/Shell/helper/toolchain.py index d9702f21641b6..66f7d33e7de9e 100644 --- a/lldb/test/Shell/helper/toolchain.py +++ b/lldb/test/Shell/helper/toolchain.py @@ -149,7 +149,16 @@ def use_support_substitutions(config): sdk_path = lit.util.to_string(out) llvm_config.lit_config.note("using SDKROOT: %r" % sdk_path) host_flags += ["-isysroot", sdk_path] - elif sys.platform != "win32": + elif sys.platform == "win32": + # Required in SwiftREPL tests + sdk_path = os.environ.get("SDKROOT") + if sdk_path: + llvm_config.lit_config.note(f"using SDKROOT: {sdk_path}") + llvm_config.with_environment("SDKROOT", sdk_path) + else: + llvm_config.lit_config.warning( + "mandatory environment variable not found: SDKROOT") + else: host_flags += ["-pthread"] config.target_shared_library_suffix = (