Skip to content

Build failure when tests are executed with coverage (Swift Build) #9077

@bkhouri

Description

@bkhouri

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.

Description

A build failure occurs when executing tests with coverage enabled using Swift Build

Expected behavior

The build is successful and tests are executed with coverage, with coverage data available.

Actual behavior

The full output is here: outupt.txt

warning: Could not parse or use implicit file '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.0.sdk/System/Library/Frameworks/SwiftUICore.framework/Versions/A/SwiftUICore.tbd': cannot link directly with 'SwiftUICore' because product being bui
91% [=====================================================================================================================------------]
error: Undefined symbol: static Testing.__Expression.__fromNegation(Testing.__Expression, Swift.Bool) -> Testing.__Expression
error: Undefined symbol: static Testing.__Expression.__fromSyntaxNode(Swift.String) -> Testing.__Expression
error: Undefined symbol: static Testing.__Expression.__fromFunctionCall(Testing.__Expression?, Swift.String, (label: Swift.String?, value: Testing.__Expression)...) -> Testing.__Expression
error: Undefined symbol: static Testing.__Expression.__fromBinaryOperation(Testing.__Expression, Swift.String, Testing.__Expression) -> Testing.__Expression
error: Undefined symbol: type metadata accessor for Testing.__Expression
error: Undefined symbol: nominal type descriptor for Testing.__Expression
error: Undefined symbol: Testing.__checkValue(_: Swift.Bool, expression: Testing.__Expression, expressionWithCapturedRuntimeValues: @autoclosure () -> Testing.__Expression?, mismatchedErrorDescription: @autoclosure () -> Swift.String?, difference: @autoclosure () -> Swift.String?, mismatchedExitConditionDescription: @autoclosure () -> Swift.String?, comments: @autoclosure () -> [Testing.Comment], isRequired: Swift.Bool, sourceLocation: Testing.SourceLocation) -> Swift.Result<(), Swift.Error>
error: Undefined symbol: static Testing.SourceLocation.__here(fileID: Swift.String, filePath: Swift.String, line: Swift.Int, column: Swift.Int) -> Testing.SourceLocation
error: Undefined symbol: Testing.SourceLocation.init(fileID: Swift.String, filePath: Swift.String, line: Swift.Int, column: Swift.Int) -> Testing.SourceLocation
error: Undefined symbol: type metadata accessor for Testing.SourceLocation
error: Undefined symbol: Testing.__requiringTry<A where A: ~Swift.Copyable>(__owned A) throws -> A
error: Undefined symbol: Testing.__requiringAwait<A where A: ~Swift.Copyable>(_: __owned A, isolation: isolated Swift.Actor?) async -> A
error: Undefined symbol: async function pointer to Testing.__requiringAwait<A where A: ~Swift.Copyable>(_: __owned A, isolation: isolated Swift.Actor?) async -> A
error: Undefined symbol: Testing.__requiringUnsafe<A where A: ~Swift.Copyable>(__owned A) throws -> A
error: Undefined symbol: Testing.__checkFunctionCall<A, B, C>(_: A, calling: (A, B) throws -> C?, _: B, expression: Testing.__Expression, comments: @autoclosure () -> [Testing.Comment], isRequired: Swift.Bool, sourceLocation: Testing.SourceLocation) throws -> Swift.Result<C, Swift.Error>
error: Undefined symbol: Testing.__checkFunctionCall<A, B>(_: A, calling: (A, B) throws -> Swift.Bool, _: B, expression: Testing.__Expression, comments: @autoclosure () -> [Testing.Comment], isRequired: Swift.Bool, sourceLocation: Testing.SourceLocation) throws -> Swift.Result<(), Swift.Error>
error: Undefined symbol: Testing.__checkBinaryOperation<A, B>(_: A, _: (A, () -> B) -> Swift.Bool, _: @autoclosure () -> B, expression: Testing.__Expression, comments: @autoclosure () -> [Testing.Comment], isRequired: Swift.Bool, sourceLocation: Testing.SourceLocation) -> Swift.Result<(), Swift.Error>
error: Undefined symbol: Testing.__checkBinaryOperation<A where A: Swift.BidirectionalCollection, A.Element: Swift.Equatable>(_: A, _: (A, () -> A) -> Swift.Bool, _: @autoclosure () -> A, expression: Testing.__Expression, comments: @autoclosure () -> [Testing.Comment], isRequired: Swift.Bool, sourceLocation: Testing.SourceLocation) -> Swift.Result<(), Swift.Error>
error: Undefined symbol: protocol descriptor for Testing.__TestContentRecordContainer
error: Undefined symbol: method descriptor for static Testing.__TestContentRecordContainer.__testContentRecord.getter : (kind: Swift.UInt32, reserved1: Swift.UInt32, accessor: (@convention(c) (Swift.UnsafeMutableRawPointer, Swift.UnsafeRawPointer, Swift.UnsafeRawPointer?, Swift.UInt) -> Swift.Bool)?, context: Swift.UInt, reserved2: Swift.UInt)
error: Undefined symbol: static Testing.Tag.__fromStaticMember(of: Any.Type, _: _const Swift.String) -> Testing.Tag
error: Undefined symbol: type metadata accessor for Testing.Tag
error: Undefined symbol: nominal type descriptor for Testing.Tag
error: Undefined symbol: static Testing.Test.__function(named: Swift.String, in: any Any<Self: ~Swift.Copyable>.Type?, xcTestCompatibleSelector: ObjectiveC.Selector?, displayName: Swift.String?, traits: [Testing.TestTrait], sourceLocation: Testing.SourceLocation, parameters: [(firstName: Swift.String, secondName: Swift.String?, type: Any.Type)], testFunction: @Sendable () async throws -> ()) -> Testing.Test
error: Undefined symbol: static Testing.Test.__store(_: @Sendable () async -> Testing.Test, into: Swift.UnsafeMutableRawPointer, asTypeAt: Swift.UnsafeRawPointer) -> Swift.Bool
error: Undefined symbol: static Testing.Issue.record(_: Testing.Comment?, severity: Testing.Issue.Severity, sourceLocation: Testing.SourceLocation) -> Testing.Issue
error: Undefined symbol: enum case for Testing.Issue.Severity.error(Testing.Issue.Severity.Type) -> Testing.Issue.Severity
error: Undefined symbol: type metadata accessor for Testing.Issue.Severity
error: Undefined symbol: type metadata accessor for Testing.Issue
error: Undefined symbol: static (extension in Testing):Testing.Trait< where A == Testing.ConditionTrait>.enabled(if: @autoclosure @Sendable () throws -> Swift.Bool, _: Testing.Comment?, sourceLocation: Testing.SourceLocation) -> Testing.ConditionTrait
error: Undefined symbol: static (extension in Testing):Testing.Trait< where A == Testing.ConditionTrait>.enabled(_: Testing.Comment?, sourceLocation: Testing.SourceLocation, _: @Sendable () async throws -> Swift.Bool) -> Testing.ConditionTrait
error: Undefined symbol: static (extension in Testing):Testing.Trait< where A == Testing.ConditionTrait>.disabled(_: Testing.Comment?, sourceLocation: Testing.SourceLocation, _: @Sendable () async throws -> Swift.Bool) -> Testing.ConditionTrait
error: Undefined symbol: static (extension in Testing):Testing.Trait< where A == Testing.Bug>.bug<A where A1: Swift.Numeric>(_: _const Swift.String?, id: A1, _: Testing.Comment?) -> Testing.Bug
error: Undefined symbol: Testing.Comment.init(stringLiteral: Swift.String) -> Testing.Comment
error: Undefined symbol: Testing.Comment.StringInterpolation.appendInterpolation<A where A: Swift.StringProtocol>(A?) -> ()
error: Undefined symbol: Testing.Comment.StringInterpolation.appendInterpolation<A>(A?) -> ()
error: Undefined symbol: Testing.Comment.StringInterpolation.appendLiteral(Swift.String) -> ()
error: Undefined symbol: Testing.Comment.StringInterpolation.init(literalCapacity: Swift.Int, interpolationCount: Swift.Int) -> Testing.Comment.StringInterpolation
error: Undefined symbol: type metadata accessor for Testing.Comment.StringInterpolation
error: Undefined symbol: Testing.Comment.init(stringInterpolation: Testing.Comment.StringInterpolation) -> Testing.Comment
error: Undefined symbol: type metadata accessor for Testing.Comment
error: Undefined symbol: nominal type descriptor for Testing.Comment
error: Undefined symbol: protocol conformance descriptor for Testing.Comment : Swift.CustomStringConvertible in Testing
error: Undefined symbol: protocol descriptor for Testing.TestTrait
error: Undefined symbol: (extension in Testing):Swift.Result.__expected< where A == ()>() -> ()
error: Undefined symbol: (extension in Testing):Swift.Result.__required() throws -> A
error: Linker command failed with exit code 1 (use -v to see invocation)
error: Ld /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/.build/arm64-apple-macosx/Products/Debug/_AsyncFileSystemTests.xctest/Contents/MacOS/_AsyncFileSystemTests normal failed with a nonzero exit code
error: EmitSwiftModule normal arm64 failed with a nonzero exit code
error: SwiftEmitModule normal arm64 Emitting\ module\ for\ SwiftSDKCommand failed with a nonzero exit code
error: SwiftCompile normal arm64 /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/Sources/CoreCommands/SwiftCommandState.swift failed with a nonzero exit code
error: SwiftCompile normal arm64 Compiling\ SwiftCommandState.swift /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/Sources/CoreCommands/SwiftCommandState.swift failed with a nonzero exit code
error: Ld /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/.build/arm64-apple-macosx/Products/Debug/SourceControlTests.xctest/Contents/MacOS/SourceControlTests normal failed with a nonzero exit code
error: Ld /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/.build/arm64-apple-macosx/Products/Debug/_InternalTestSupportTests.xctest/Contents/MacOS/_InternalTestSupportTests normal failed with a nonzero exit code
error: SwiftCompile normal arm64 /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/Sources/CoreCommands/Options.swift failed with a nonzero exit code
error: SwiftCompile normal arm64 Compiling\ Options.swift /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/Sources/CoreCommands/Options.swift failed with a nonzero exit code
error: SwiftCompile normal arm64 /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/Tests/BasicsTests/NetrcTests.swift failed with a nonzero exit code
error: SwiftCompile normal arm64 /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/Tests/BasicsTests/HTTPClientTests.swift failed with a nonzero exit code
error: SwiftCompile normal arm64 /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/Tests/BasicsTests/LegacyHTTPClientTests.swift failed with a nonzero exit code
error: SwiftCompile normal arm64 Compiling\ HTTPClientTests.swift,\ LegacyHTTPClientTests.swift,\ NetrcTests.swift /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/Tests/BasicsTests/HTTPClientTests.swift /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/Tests/BasicsTests/LegacyHTTPClientTests.swift /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/Tests/BasicsTests/NetrcTests.swift failed with a nonzero exit code
error: Ld /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/.build/arm64-apple-macosx/Products/Debug/WorkspaceTests.xctest/Contents/MacOS/WorkspaceTests normal failed with a nonzero exit code
error: Ld /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/.build/arm64-apple-macosx/Products/Debug/SwiftFixItTests.xctest/Contents/MacOS/SwiftFixItTests normal failed with a nonzero exit code


error: Build failed

Steps to reproduce

  1. Clone the Swift PM repository. (I was on branch main at commit ID 06fcc03f3b93325431d00e952e65b8ff4b4b30aa)
  2. Run the following commands
    cd <swiftpm>
    swift test --filter PluginsBuildPlanTests --enable-code-coverage --build-system swiftbuild
    

See the attached for the full output:
outupt.txt

Swift Package Manager version/commit hash

06fcc03

Swift & OS version (output of swift --version ; uname -a)

❯ swiftly use                                                                               
main-snapshot-2025-08-27 (default)

❯ swift --version                                                                           
Apple Swift version 6.2-dev (LLVM fa1f889407fc8ca, Swift 687e09da65c8813)
Target: arm64-apple-macosx26.0
Build config: +assertions

❯ uname -a
Darwin BKs-Work-M1Pro-MacBook-Pro-9.local 25.0.0 Darwin Kernel Version 25.0.0: Mon Aug 25 22:40:51 PDT 2025; root:xnu_development-12377.1.9~4/DEVELOPMENT_ARM64_T6000 arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugswift buildChanges impacting `swift build`swift testChanges impacting `swift test` tool

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions