Skip to content

Revert "Ensure Xcode SDK paths are set when running test targets." #7054

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Sources/Commands/Utilities/TestingSupport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ enum TestingSupport {
#if os(macOS)
let data: String = try withTemporaryFile { tempFile in
args = [try Self.xctestHelperPath(swiftTool: swiftTool).pathString, path.pathString, tempFile.path.pathString]
let env = try Self.constructTestEnvironment(
var env = try Self.constructTestEnvironment(
toolchain: try swiftTool.getTargetToolchain(),
buildParameters: swiftTool.buildParametersForTest(
enableCodeCoverage: enableCodeCoverage,
Expand All @@ -118,6 +118,12 @@ enum TestingSupport {
sanitizers: sanitizers
)

// Add the sdk platform path if we have it. If this is not present, we might always end up failing.
let sdkPlatformFrameworksPath = try SwiftSDK.sdkPlatformFrameworkPaths()
// appending since we prefer the user setting (if set) to the one we inject
env.appendPath("DYLD_FRAMEWORK_PATH", value: sdkPlatformFrameworksPath.fwk.pathString)
env.appendPath("DYLD_LIBRARY_PATH", value: sdkPlatformFrameworksPath.lib.pathString)

try TSCBasic.Process.checkNonZeroExit(arguments: args, environment: env)
// Read the temporary file's content.
return try swiftTool.fileSystem.readFileContents(AbsolutePath(tempFile.path))
Expand Down Expand Up @@ -174,12 +180,6 @@ enum TestingSupport {
#endif
return env
#else
// Add the sdk platform path if we have it. If this is not present, we might always end up failing.
let sdkPlatformFrameworksPath = try SwiftSDK.sdkPlatformFrameworkPaths()
// appending since we prefer the user setting (if set) to the one we inject
env.appendPath("DYLD_FRAMEWORK_PATH", value: sdkPlatformFrameworksPath.fwk.pathString)
env.appendPath("DYLD_LIBRARY_PATH", value: sdkPlatformFrameworksPath.lib.pathString)

// Fast path when no sanitizers are enabled.
if sanitizers.isEmpty {
return env
Expand Down