mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
test: add handling for Wasm/WASI (#39519)
This change adds support for WASI in stdlib tests. Some tests that expect a crash to happen had to be disabled, since there's currently no way to observe such crash from a WASI host.
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
import Darwin
|
||||
#elseif canImport(Glibc)
|
||||
import Glibc
|
||||
#elseif os(WASI)
|
||||
import WASILibc
|
||||
#elseif os(Windows)
|
||||
import CRT
|
||||
import WinSDK
|
||||
@@ -98,6 +100,9 @@ public func _stdlib_thread_create_block<Argument, Result>(
|
||||
} else {
|
||||
return (0, ThreadHandle(bitPattern: threadID))
|
||||
}
|
||||
#elseif os(WASI)
|
||||
// WASI environment has a only single thread
|
||||
return (0, nil)
|
||||
#else
|
||||
var threadID = _make_pthread_t()
|
||||
let result = pthread_create(&threadID, nil,
|
||||
@@ -129,6 +134,9 @@ public func _stdlib_thread_join<Result>(
|
||||
}
|
||||
}
|
||||
return (CInt(result), value)
|
||||
#elseif os(WASI)
|
||||
// WASI environment has a only single thread
|
||||
return (0, nil)
|
||||
#else
|
||||
var threadResultRawPtr: UnsafeMutableRawPointer?
|
||||
let result = pthread_join(thread, &threadResultRawPtr)
|
||||
|
||||
Reference in New Issue
Block a user