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
Show file tree
Hide file tree
Changes from all 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
10 changes: 2 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,11 @@ jobs:
wasm:
name: Wasm
runs-on: ubuntu-latest
strategy:
matrix:
include:
- { toolchain: wasm-5.7.1-RELEASE }

steps:
- uses: actions/checkout@v4
- run: echo "${{ matrix.toolchain }}" > .swift-version
- uses: swiftwasm/[email protected]
- uses: swiftwasm/[email protected]
with:
shell-action: swift build
shell-action: carton test

windows:
name: Windows
Expand Down
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !os(Linux) && !os(Windows)
#if !os(Linux) && !os(WASI) && !os(Windows)
import Foundation
import XCTest
import XCTestDynamicOverlay
Expand Down
2 changes: 1 addition & 1 deletion Tests/XCTestDynamicOverlayTests/UnimplementedTests.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !os(Linux) && !os(Windows)
#if !os(Linux) && !os(WASI) && !os(Windows)
import XCTest

final class UnimplementedTests: XCTestCase {
Expand Down
2 changes: 1 addition & 1 deletion Tests/XCTestDynamicOverlayTests/XCTContextTests.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !os(Linux) && !os(Windows)
#if !os(Linux) && !os(WASI) && !os(Windows)
import XCTest
import XCTestDynamicOverlay

Expand Down
Loading