You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WASI does not have thread spawning method yet, but the existing
implementation blocks threads to wait async test cases synchronously.
This commit introduced a new waiter method for running async test cases in
single-threaded WASI environments, enabled by USE_SWIFT_CONCURRENCY_WAITER
flag.
With the new waiter, `XCTMain` is async runs the given test suites
without blocking the thread by bypassing some synchronous public APIs
like `XCTest.perform` and `XCTest.run`. This ignores those APIs even if
they are overridden by user-defined subclasses, so it's not 100%
compatible with the existing XCTest APIs. This is a trade-off to
support async test execution in single-threaded environments, but it
should be fine because the APIs are seldom overridden by user code.
fatalError("This method is not available when using the Swift concurrency waiter.")
298
+
#else
282
299
returnawaitwithCheckedContinuation{ continuation in
283
300
// This function operates by blocking a background thread instead of one owned by libdispatch or by the
284
301
// Swift runtime (as used by Swift concurrency.) To ensure we use a thread owned by neither subsystem, use
@@ -288,6 +305,7 @@ open class XCTWaiter {
288
305
continuation.resume(returning: result)
289
306
}
290
307
}
308
+
#endif
291
309
}
292
310
293
311
/// Convenience API to create an XCTWaiter which then waits on an array of expectations for up to the specified timeout, and optionally specify whether they
@@ -306,9 +324,17 @@ open class XCTWaiter {
306
324
/// expectations are not fulfilled before the given timeout. Default is the line
307
325
/// number of the call to this method in the calling file. It is rare to
308
326
/// provide this parameter when calling this method.
327
+
#if USE_SWIFT_CONCURRENCY_WAITER
328
+
@available(*, unavailable, message:"Expectation-based waiting is not available when using the Swift concurrency waiter.")
/// Convenience API to create an XCTWaiter which then waits on an array of expectations for up to the specified timeout, and optionally specify whether they
@@ -327,9 +353,17 @@ open class XCTWaiter {
327
353
/// expectations are not fulfilled before the given timeout. Default is the line
328
354
/// number of the call to this method in the calling file. It is rare to
329
355
/// provide this parameter when calling this method.
356
+
#if USE_SWIFT_CONCURRENCY_WAITER
357
+
@available(*, unavailable, message:"Expectation-based waiting is not available when using the Swift concurrency waiter.")
0 commit comments