Skip to content

Commit 1de30cc

Browse files
authored
Revert "Ensure Xcode SDK paths are set when running test targets." (#7054)
1 parent 1d6565c commit 1de30cc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Sources/Commands/Utilities/TestingSupport.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ enum TestingSupport {
108108
#if os(macOS)
109109
let data: String = try withTemporaryFile { tempFile in
110110
args = [try Self.xctestHelperPath(swiftTool: swiftTool).pathString, path.pathString, tempFile.path.pathString]
111-
let env = try Self.constructTestEnvironment(
111+
var env = try Self.constructTestEnvironment(
112112
toolchain: try swiftTool.getTargetToolchain(),
113113
buildParameters: swiftTool.buildParametersForTest(
114114
enableCodeCoverage: enableCodeCoverage,
@@ -118,6 +118,12 @@ enum TestingSupport {
118118
sanitizers: sanitizers
119119
)
120120

121+
// Add the sdk platform path if we have it. If this is not present, we might always end up failing.
122+
let sdkPlatformFrameworksPath = try SwiftSDK.sdkPlatformFrameworkPaths()
123+
// appending since we prefer the user setting (if set) to the one we inject
124+
env.appendPath("DYLD_FRAMEWORK_PATH", value: sdkPlatformFrameworksPath.fwk.pathString)
125+
env.appendPath("DYLD_LIBRARY_PATH", value: sdkPlatformFrameworksPath.lib.pathString)
126+
121127
try TSCBasic.Process.checkNonZeroExit(arguments: args, environment: env)
122128
// Read the temporary file's content.
123129
return try swiftTool.fileSystem.readFileContents(AbsolutePath(tempFile.path))
@@ -174,12 +180,6 @@ enum TestingSupport {
174180
#endif
175181
return env
176182
#else
177-
// Add the sdk platform path if we have it. If this is not present, we might always end up failing.
178-
let sdkPlatformFrameworksPath = try SwiftSDK.sdkPlatformFrameworkPaths()
179-
// appending since we prefer the user setting (if set) to the one we inject
180-
env.appendPath("DYLD_FRAMEWORK_PATH", value: sdkPlatformFrameworksPath.fwk.pathString)
181-
env.appendPath("DYLD_LIBRARY_PATH", value: sdkPlatformFrameworksPath.lib.pathString)
182-
183183
// Fast path when no sanitizers are enabled.
184184
if sanitizers.isEmpty {
185185
return env

0 commit comments

Comments
 (0)