Skip to content

Commit 6d50e07

Browse files
committed
Improve Destination.sdkPlatformFrameworkPaths()
We should not ignore errors or an empty SDK platform path since that means XCTest imports and test execution might silently fail on macOS with no indication to what the problem is. I am speculating that this may be contributing to the recent surge of tests failing by not seeing the XCTest Swift library. I am also re-enabling the disabled tests here to see if this has any practical effect, but regardless it doesn't seem reasonable to silently ignore some failure states here. rdar://101868275
1 parent 3c692dc commit 6d50e07

File tree

5 files changed

+12
-28
lines changed

5 files changed

+12
-28
lines changed

Sources/PackageModel/Destination.swift

+12-10
Original file line numberDiff line numberDiff line change
@@ -194,21 +194,23 @@ public struct Destination: Encodable, Equatable {
194194
if let path = _sdkPlatformFrameworkPath {
195195
return path
196196
}
197-
let platformPath = try? TSCBasic.Process.checkNonZeroExit(
197+
let platformPath = try TSCBasic.Process.checkNonZeroExit(
198198
arguments: ["/usr/bin/xcrun", "--sdk", "macosx", "--show-sdk-platform-path"],
199199
environment: environment).spm_chomp()
200200

201-
if let platformPath = platformPath, !platformPath.isEmpty {
202-
// For XCTest framework.
203-
let fwk = try AbsolutePath(validating: platformPath).appending(
204-
components: "Developer", "Library", "Frameworks")
201+
guard !platformPath.isEmpty else {
202+
throw StringError("could not determine SDK platform path")
203+
}
205204

206-
// For XCTest Swift library.
207-
let lib = try AbsolutePath(validating: platformPath).appending(
208-
components: "Developer", "usr", "lib")
205+
// For XCTest framework.
206+
let fwk = try AbsolutePath(validating: platformPath).appending(
207+
components: "Developer", "Library", "Frameworks")
209208

210-
_sdkPlatformFrameworkPath = (fwk, lib)
211-
}
209+
// For XCTest Swift library.
210+
let lib = try AbsolutePath(validating: platformPath).appending(
211+
components: "Developer", "usr", "lib")
212+
213+
_sdkPlatformFrameworkPath = (fwk, lib)
212214
return _sdkPlatformFrameworkPath
213215
}
214216
/// Cache storage for sdk platform path.

Sources/SPMTestSupport/Toolchain.swift

-12
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,6 @@ private func resolveBinDir() throws -> AbsolutePath {
3333
#endif
3434
}
3535

36-
extension UserToolchain {
37-
38-
#if os(macOS)
39-
public var sdkPlatformFrameworksPath: AbsolutePath {
40-
get throws {
41-
return try Destination.sdkPlatformFrameworkPaths()!.fwk
42-
}
43-
}
44-
#endif
45-
46-
}
47-
4836
extension Destination {
4937
public static var `default`: Self {
5038
get throws {

Tests/CommandsTests/BuildToolTests.swift

-2
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,6 @@ final class BuildToolTests: CommandsTestCase {
280280
}
281281

282282
func testBuildCompleteMessage() throws {
283-
throw XCTSkip("This test fails to match the 'Compiling' regex; rdar://101815761")
284-
285283
try fixture(name: "DependencyResolution/Internal/Simple") { fixturePath in
286284
do {
287285
let result = try execute([], packagePath: fixturePath)

Tests/WorkspaceTests/InitTests.swift

-2
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,6 @@ class InitTests: XCTestCase {
266266
}
267267

268268
func testNonC99NameExecutablePackage() throws {
269-
throw XCTSkip("This test fails to find XCTAssertEqual; rdar://101868275")
270-
271269
try withTemporaryDirectory(removeTreeOnDeinit: true) { tempDirPath in
272270
XCTAssertDirectoryExists(tempDirPath)
273271

Tests/WorkspaceTests/WorkspaceTests.swift

-2
Original file line numberDiff line numberDiff line change
@@ -4291,8 +4291,6 @@ final class WorkspaceTests: XCTestCase {
42914291

42924292
// This verifies that the simplest possible loading APIs are available for package clients.
42934293
func testSimpleAPI() throws {
4294-
throw XCTSkip("This test fails to find XCTAssertEqual; rdar://101868275")
4295-
42964294
try testWithTemporaryDirectory { path in
42974295
// Create a temporary package as a test case.
42984296
let packagePath = path.appending(component: "MyPkg")

0 commit comments

Comments
 (0)