From 0c7f5531df6f2aedf5a938bf3178511deb766739 Mon Sep 17 00:00:00 2001 From: Paul LeMarquand Date: Thu, 24 Apr 2025 15:19:36 -0400 Subject: [PATCH 1/2] Update DYLD_LIBRARY_PATH to fix debugging tests in nightly toolchains A change in SwiftPM removed the rpath that pointed to `usr/lib/swift/macosx/testing` (https://github.com/swiftlang/swift-package-manager/pull/8295). Consequently when debugging tests in VS Code `libTesting.dylib` could not be found and the tests would not start. This is only happening in nightly toolchains that contain the SwiftPM change noted above. Fix this by adding the search path to the DYLD_LIBRARY_PATH. --- src/toolchain/toolchain.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/toolchain/toolchain.ts b/src/toolchain/toolchain.ts index f765f692c..edc17971b 100644 --- a/src/toolchain/toolchain.ts +++ b/src/toolchain/toolchain.ts @@ -492,7 +492,7 @@ export class SwiftToolchain { if (!base) { return undefined; } - return path.join(base, "usr/lib"); + return `${path.join(base, "usr/lib")}:${path.join(base, "usr/lib/swift/macosx/testing")}`; } /** From 5b5a00ca3ca1c0bf7e971067dd077deaab6de2a9 Mon Sep 17 00:00:00 2001 From: Paul LeMarquand Date: Thu, 24 Apr 2025 15:45:50 -0400 Subject: [PATCH 2/2] Use toolchain path as base path --- src/toolchain/toolchain.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/toolchain/toolchain.ts b/src/toolchain/toolchain.ts index edc17971b..7ffe168e3 100644 --- a/src/toolchain/toolchain.ts +++ b/src/toolchain/toolchain.ts @@ -488,11 +488,12 @@ export class SwiftToolchain { * Library path for swift-testing executables */ public swiftTestingLibraryPath(): string | undefined { + let result = ""; const base = this.basePlatformDeveloperPath(); - if (!base) { - return undefined; + if (base) { + result = `${path.join(base, "usr/lib")}:`; } - return `${path.join(base, "usr/lib")}:${path.join(base, "usr/lib/swift/macosx/testing")}`; + return `${result}${path.join(this.toolchainPath, "lib/swift/macosx/testing")}`; } /**