Skip to content

Commit 7b1fd7e

Browse files
authored
Remove the legacy Xcode 16 entry point function on non-Darwin platforms. (#545)
This PR removes `swt_copyABIEntryPoint_v0()`, which is an older version of the approved `swt_abiv0_getEntryPoint()` entry point function used by Xcode 16 Beta 1 but not used on non-Darwin platforms. The symbol remains available on Darwin for the benefit of Xcode 16 beta users. It will be removed from the Darwin builds in a future update. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent db6e08e commit 7b1fd7e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Sources/Testing/ABI/EntryPoints/ABIEntryPoint.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ extension ABIv0 {
6565
unsafeBitCast(ABIv0.entryPoint, to: UnsafeRawPointer.self)
6666
}
6767

68+
#if !SWT_NO_SNAPSHOT_TYPES
6869
// MARK: - Xcode 16 Beta 1 compatibility
6970

7071
/// An older signature for ``ABIv0/EntryPoint-swift.typealias`` used by Xcode 16
@@ -94,6 +95,9 @@ typealias ABIEntryPoint_v0 = @Sendable (
9495
}
9596
return .init(result)
9697
}
98+
#endif
99+
100+
// MARK: -
97101

98102
/// A common implementation for ``ABIv0/entryPoint-swift.type.property`` and
99103
/// ``copyABIEntryPoint_v0()`` that provides Xcode 16 Beta 1 compatibility.
@@ -120,6 +124,8 @@ private func entryPoint(
120124
let exitCode = await entryPoint(passing: args, eventHandler: eventHandler)
121125

122126
// To maintain compatibility with Xcode 16 Beta 1, suppress custom exit codes.
127+
// (This is also needed by ABIv0.entryPoint to correctly treat the no-tests as
128+
// a successful run.)
123129
if exitCode == EXIT_NO_TESTS_FOUND {
124130
return EXIT_SUCCESS
125131
}

Tests/TestingTests/ABIEntryPointTests.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ private import _TestingInternals
1919

2020
@Suite("ABI entry point tests")
2121
struct ABIEntryPointTests {
22+
#if !SWT_NO_SNAPSHOT_TYPES
2223
@available(*, deprecated)
2324
@Test func v0_experimental() async throws {
2425
var arguments = __CommandLineArguments_v0()
@@ -52,18 +53,12 @@ struct ABIEntryPointTests {
5253
passing arguments: __CommandLineArguments_v0,
5354
recordHandler: @escaping @Sendable (_ recordJSON: UnsafeRawBufferPointer) -> Void = { _ in }
5455
) async throws -> CInt {
55-
#if !os(Linux) && !SWT_NO_DYNAMIC_LINKING
5656
// Get the ABI entry point by dynamically looking it up at runtime.
57-
//
58-
// NOTE: The standard Linux linker does not allow exporting symbols from
59-
// executables, so dlsym() does not let us find this function on that
60-
// platform when built as an executable rather than a dynamic library.
6157
let copyABIEntryPoint_v0 = try #require(
6258
symbol(named: "swt_copyABIEntryPoint_v0").map {
6359
unsafeBitCast($0, to: (@convention(c) () -> UnsafeMutableRawPointer).self)
6460
}
6561
)
66-
#endif
6762
let abiEntryPoint = copyABIEntryPoint_v0().assumingMemoryBound(to: ABIEntryPoint_v0.self)
6863
defer {
6964
abiEntryPoint.deinitialize(count: 1)
@@ -82,6 +77,7 @@ struct ABIEntryPointTests {
8277
// Call the entry point function.
8378
return try await abiEntryPoint.pointee(.init(argumentsJSON), recordHandler)
8479
}
80+
#endif
8581

8682
@Test func v0() async throws {
8783
var arguments = __CommandLineArguments_v0()

0 commit comments

Comments
 (0)