From d1a43883eba77c39ffeca6a4ee538c79c423b11a Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Thu, 24 Jul 2025 18:26:52 -0400 Subject: [PATCH] Remove `swt_copyABIEntryPoint_v0()`. `swt_copyABIEntryPoint_v0()` is an older alias of `swt_abiv0_getEntryPoint()` with a slightly different signature that was used by Xcode 16.0. Xcode 16.3 and later use the newer function, so we can remove the older one now. --- .../ABI/EntryPoints/ABIEntryPoint.swift | 42 ------------ Tests/TestingTests/ABIEntryPointTests.swift | 64 ------------------- 2 files changed, 106 deletions(-) diff --git a/Sources/Testing/ABI/EntryPoints/ABIEntryPoint.swift b/Sources/Testing/ABI/EntryPoints/ABIEntryPoint.swift index 89f4bca93..f12a8ecf5 100644 --- a/Sources/Testing/ABI/EntryPoints/ABIEntryPoint.swift +++ b/Sources/Testing/ABI/EntryPoints/ABIEntryPoint.swift @@ -75,46 +75,4 @@ extension ABI.v0 { @usableFromInline func abiv0_getEntryPoint() -> UnsafeRawPointer { unsafeBitCast(ABI.v0.entryPoint, to: UnsafeRawPointer.self) } - -#if !SWT_NO_SNAPSHOT_TYPES -// MARK: - Xcode 16 compatibility - -extension ABI.Xcode16 { - /// An older signature for ``ABI/v0/EntryPoint-swift.typealias`` used by - /// Xcode 16. - /// - /// - Warning: This type will be removed in a future update. - @available(*, deprecated, message: "Use ABI.v0.EntryPoint instead.") - typealias EntryPoint = @Sendable ( - _ argumentsJSON: UnsafeRawBufferPointer?, - _ recordHandler: @escaping @Sendable (_ recordJSON: UnsafeRawBufferPointer) -> Void - ) async throws -> CInt -} - -/// An older signature for ``ABI/v0/entryPoint-swift.type.property`` used by -/// Xcode 16. -/// -/// - Warning: This function will be removed in a future update. -@available(*, deprecated, message: "Use ABI.v0.entryPoint (swt_abiv0_getEntryPoint()) instead.") -@_cdecl("swt_copyABIEntryPoint_v0") -@usableFromInline func copyABIEntryPoint_v0() -> UnsafeMutableRawPointer { - let result = UnsafeMutablePointer.allocate(capacity: 1) - result.initialize { configurationJSON, recordHandler in - var args = try configurationJSON.map { configurationJSON in - try JSON.decode(__CommandLineArguments_v0.self, from: configurationJSON) - } - if args?.eventStreamVersion == nil { - args?.eventStreamVersion = ABI.Xcode16.versionNumber - } - let eventHandler = try eventHandlerForStreamingEvents(version: args?.eventStreamVersion, encodeAsJSONLines: false, forwardingTo: recordHandler) - - var exitCode = await Testing.entryPoint(passing: args, eventHandler: eventHandler) - if exitCode == EXIT_NO_TESTS_FOUND { - exitCode = EXIT_SUCCESS - } - return exitCode - } - return .init(result) -} -#endif #endif diff --git a/Tests/TestingTests/ABIEntryPointTests.swift b/Tests/TestingTests/ABIEntryPointTests.swift index 9fcda9223..690889451 100644 --- a/Tests/TestingTests/ABIEntryPointTests.swift +++ b/Tests/TestingTests/ABIEntryPointTests.swift @@ -18,70 +18,6 @@ private import _TestingInternals @Suite("ABI entry point tests") struct ABIEntryPointTests { -#if !SWT_NO_SNAPSHOT_TYPES - @available(*, deprecated) - @Test func v0_experimental() async throws { - var arguments = __CommandLineArguments_v0() - arguments.filter = ["NonExistentTestThatMatchesNothingHopefully"] - arguments.eventStreamVersion = 0 - arguments.verbosity = .min - - let result = try await _invokeEntryPointV0Experimental(passing: arguments) { recordJSON in - let record = try! JSON.decode(ABI.Record.self, from: recordJSON) - _ = record.kind - } - - #expect(result == EXIT_SUCCESS) - } - - @available(*, deprecated) - @Test("v0 experimental entry point with a large number of filter arguments") - func v0_experimental_manyFilters() async throws { - var arguments = __CommandLineArguments_v0() - arguments.filter = (1...100).map { "NonExistentTestThatMatchesNothingHopefully_\($0)" } - arguments.eventStreamVersion = 0 - arguments.verbosity = .min - - let result = try await _invokeEntryPointV0Experimental(passing: arguments) - - #expect(result == EXIT_SUCCESS) - } - - @available(*, deprecated) - private func _invokeEntryPointV0Experimental( - passing arguments: __CommandLineArguments_v0, - recordHandler: @escaping @Sendable (_ recordJSON: UnsafeRawBufferPointer) -> Void = { _ in } - ) async throws -> CInt { -#if !SWT_NO_DYNAMIC_LINKING - // Get the ABI entry point by dynamically looking it up at runtime. - let copyABIEntryPoint_v0 = try withTestingLibraryImageAddress { testingLibrary in - try #require( - symbol(in: testingLibrary, named: "swt_copyABIEntryPoint_v0").map { - castCFunction(at: $0, to: (@convention(c) () -> UnsafeMutableRawPointer).self) - } - ) - } -#endif - let abiEntryPoint = copyABIEntryPoint_v0().assumingMemoryBound(to: ABI.Xcode16.EntryPoint.self) - defer { - abiEntryPoint.deinitialize(count: 1) - abiEntryPoint.deallocate() - } - - let argumentsJSON = try JSON.withEncoding(of: arguments) { argumentsJSON in - let result = UnsafeMutableRawBufferPointer.allocate(byteCount: argumentsJSON.count, alignment: 1) - result.copyMemory(from: argumentsJSON) - return result - } - defer { - argumentsJSON.deallocate() - } - - // Call the entry point function. - return try await abiEntryPoint.pointee(.init(argumentsJSON), recordHandler) - } -#endif - @Test func v0() async throws { var arguments = __CommandLineArguments_v0() arguments.filter = ["NonExistentTestThatMatchesNothingHopefully"]