mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
Tests: Use ABI entry point for swift-testing tests
Avoid the unstable SwiftPM entry point in favor of the stable ABI entry point.
This commit is contained in:
committed by
Andrew Kaster
parent
fca6fd0b85
commit
4b4a6991e3
@@ -21,6 +21,8 @@ if (APPLE)
|
|||||||
set(CMAKE_Swift_COMPILER_TARGET "${SWIFT_TARGET_TRIPLE}")
|
set(CMAKE_Swift_COMPILER_TARGET "${SWIFT_TARGET_TRIPLE}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_compile_options("SHELL:$<$<COMPILE_LANGUAGE:Swift>:-enable-experimental-feature Extern>")
|
||||||
|
|
||||||
set(VFS_OVERLAY_DIRECTORY "${CMAKE_BINARY_DIR}/vfs_overlays" CACHE PATH "Directory to put VFS overlays in")
|
set(VFS_OVERLAY_DIRECTORY "${CMAKE_BINARY_DIR}/vfs_overlays" CACHE PATH "Directory to put VFS overlays in")
|
||||||
|
|
||||||
# FIXME: https://gitlab.kitware.com/cmake/cmake/-/issues/26195
|
# FIXME: https://gitlab.kitware.com/cmake/cmake/-/issues/26195
|
||||||
|
|||||||
@@ -4,13 +4,24 @@
|
|||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// FIXME: This file is intended to become redundant as swift-testing stabilizes
|
import Foundation
|
||||||
// See https://github.com/swiftlang/swift-testing/blob/133e30231c4583b02ab3ea2a7f678f3d7f4f8a3d/Documentation/CMake.md#add-an-entry-point
|
|
||||||
|
|
||||||
import Testing
|
typealias EntryPoint = @convention(thin) @Sendable (_ configurationJSON: UnsafeRawBufferPointer?, _ recordHandler: @escaping @Sendable (_ recordJSON: UnsafeRawBufferPointer) -> Void) async throws -> Bool
|
||||||
|
|
||||||
|
@_extern(c, "swt_abiv0_getEntryPoint")
|
||||||
|
func swt_abiv0_getEntryPoint() -> UnsafeRawPointer
|
||||||
|
|
||||||
@main struct Runner {
|
@main struct Runner {
|
||||||
static func main() async {
|
static func main() async throws {
|
||||||
await Testing.__swiftPMEntryPoint() as Never
|
let configurationJSON: UnsafeRawBufferPointer? = nil
|
||||||
|
let recordHandler: @Sendable (UnsafeRawBufferPointer) -> Void = { _ in }
|
||||||
|
|
||||||
|
let entryPoint = unsafeBitCast(swt_abiv0_getEntryPoint(), to: EntryPoint.self)
|
||||||
|
|
||||||
|
if try await entryPoint(configurationJSON, recordHandler) {
|
||||||
|
exit(EXIT_SUCCESS)
|
||||||
|
} else {
|
||||||
|
exit(EXIT_FAILURE)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user