Skip to content

Commit 7302c51

Browse files
[lldb][test] 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)
1 parent 977780e commit 7302c51

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lldb/test/Shell/helper/toolchain.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,16 @@ def use_support_substitutions(config):
149149
sdk_path = lit.util.to_string(out)
150150
llvm_config.lit_config.note("using SDKROOT: %r" % sdk_path)
151151
host_flags += ["-isysroot", sdk_path]
152-
elif sys.platform != "win32":
152+
elif sys.platform == "win32":
153+
# Required in SwiftREPL tests
154+
sdk_path = os.environ.get("SDKROOT")
155+
if sdk_path:
156+
llvm_config.lit_config.note(f"using SDKROOT: {sdk_path}")
157+
llvm_config.with_environment("SDKROOT", sdk_path)
158+
else:
159+
llvm_config.lit_config.warning(
160+
"mandatory environment variable not found: SDKROOT")
161+
else:
153162
host_flags += ["-pthread"]
154163

155164
config.target_shared_library_suffix = (

0 commit comments

Comments
 (0)