Skip to content

Work around macOS build failures affecting test targets #1139

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
Jun 6, 2025
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
23 changes: 20 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ let package = Package(
"_Testing_Foundation",
"MemorySafeTestingTests",
],
swiftSettings: .packageSettings
swiftSettings: .packageSettings + .disableMandatoryOptimizationsSettings
),

// Use a plain `.target` instead of a `.testTarget` to avoid the unnecessary
Expand Down Expand Up @@ -234,7 +234,7 @@ package.targets.append(contentsOf: [
"Testing",
"TestingMacros",
],
swiftSettings: .packageSettings
swiftSettings: .packageSettings + .disableMandatoryOptimizationsSettings
)
])
#endif
Expand Down Expand Up @@ -290,7 +290,10 @@ extension Array where Element == PackageDescription.SwiftSetting {
// This setting is enabled in the package, but not in the toolchain build
// (via CMake). Enabling it is dependent on acceptance of the @section
// proposal via Swift Evolution.
.enableExperimentalFeature("SymbolLinkageMarkers"),
//
// FIXME: Re-enable this once a CI blocker is resolved:
// https://github.com/swiftlang/swift-testing/issues/1138.
// .enableExperimentalFeature("SymbolLinkageMarkers"),

// This setting is no longer needed when building with a 6.2 or later
// toolchain now that SE-0458 has been accepted and implemented, but it is
Expand Down Expand Up @@ -382,6 +385,20 @@ extension Array where Element == PackageDescription.SwiftSetting {
[]
#endif
}

/// Settings which disable Swift's mandatory optimizations pass.
///
/// This is intended only to work around a build failure caused by a Swift
/// compiler regression which is expected to be resolved in
/// [swiftlang/swift#82034](https://github.com/swiftlang/swift/pull/82034).
///
/// @Comment {
/// - Bug: This should be removed once the CI issue is resolved.
/// [swiftlang/swift-testin#1138](https://github.com/swiftlang/swift-testing/issues/1138).
/// }
static var disableMandatoryOptimizationsSettings: Self {
[.unsafeFlags(["-Xllvm", "-sil-disable-pass=mandatory-performance-optimizations"])]
}
}

extension Array where Element == PackageDescription.CXXSetting {
Expand Down