Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address more Wasm issues #77

Merged
merged 6 commits into from
Mar 4, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions Sources/XCTestDynamicOverlay/XCTFail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,20 @@ public struct XCTFailContext: Sendable {
}
}

#if os(Windows)
#if canImport(Glibc)
import Glibc

private func ResolveXCTFail() -> XCTFailType? {
var hXCTest = dlopen("libXCTest.so", RTLD_NOW)
if hXCTest == nil { hXCTest = dlopen(nil, RTLD_NOW) }

if let pXCTFail = dlsym(hXCTest, "$s6XCTest7XCTFail_4file4lineySS_s12StaticStringVSutF") {
return unsafeCastToXCTFailType(pXCTFail)
}

return nil
}
#elseif canImport(WinSDK)
import WinSDK

private func ResolveXCTFail() -> XCTFailType? {
Expand All @@ -180,22 +193,15 @@ public struct XCTFailContext: Sendable {

return nil
}
#else
#if os(WASI)
import WASI
#else
import Glibc
#endif
#elseif canImport(XCTest)
import XCTest

private func ResolveXCTFail() -> XCTFailType? {
var hXCTest = dlopen("libXCTest.so", RTLD_NOW)
if hXCTest == nil { hXCTest = dlopen(nil, RTLD_NOW) }

if let pXCTFail = dlsym(hXCTest, "$s6XCTest7XCTFail_4file4lineySS_s12StaticStringVSutF") {
return unsafeCastToXCTFailType(pXCTFail)
}

return nil
XCTFail
}
#else
private func ResolveXCTFail() -> XCTFailType? {
nil
}
#endif

Expand Down
Loading