mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 15:10:19 +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:
parent
fca6fd0b85
commit
4b4a6991e3
Notes:
github-actions[bot]
2024-11-19 21:54:02 +00:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/4b4a6991e38 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2386 Reviewed-by: https://github.com/alimpfard
2 changed files with 18 additions and 5 deletions
|
@ -21,6 +21,8 @@ if (APPLE)
|
|||
set(CMAKE_Swift_COMPILER_TARGET "${SWIFT_TARGET_TRIPLE}")
|
||||
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")
|
||||
|
||||
# FIXME: https://gitlab.kitware.com/cmake/cmake/-/issues/26195
|
||||
|
|
|
@ -4,13 +4,24 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
// FIXME: This file is intended to become redundant as swift-testing stabilizes
|
||||
// See https://github.com/swiftlang/swift-testing/blob/133e30231c4583b02ab3ea2a7f678f3d7f4f8a3d/Documentation/CMake.md#add-an-entry-point
|
||||
import Foundation
|
||||
|
||||
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 {
|
||||
static func main() async {
|
||||
await Testing.__swiftPMEntryPoint() as Never
|
||||
static func main() async throws {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue