-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add additional tests for DispatchAsync #2
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
base: feat/swift-wasm-support
Are you sure you want to change the base?
Conversation
} | ||
} | ||
|
||
func wait() async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to hide whitespace changes before reviewing this. It will be a lot easier.
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// TODO: SM: Rename this file to AsyncSemaphoreTests (coming in next PR that adds tests) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, this file was renamed to AsyncSemaphoreTests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! More tests! 🎉
ae42424
to
a872ad4
Compare
|
||
@testable import DispatchAsync | ||
|
||
nonisolated(unsafe) private var sharedPoolCompletionCount = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this nonisolated(unsafe)
bit actually required here? I thought that was only necessary when opting out of actor-isolation. I don't quite know how to reason about it when it's on a file level variable.
|
||
nonisolated(unsafe) private var sharedPoolCompletionCount = 0 | ||
|
||
@Suite("DispatchGroup Tests") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Suite("DispatchGroup Tests") | |
@Suite("AsyncSemaphore Tests") |
|
||
private typealias DispatchQueue = DispatchAsync.DispatchQueue | ||
|
||
/// Ping-Pong queue test is adapted from the test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: fix extra space
/// Ping-Pong queue test is adapted from the test | |
/// Ping-Pong queue test is adapted from the test |
[Human-Directed AI Assistance]
…/tests/dispatch_pingpong.c. [Human-Directed AI Assistance]
# Conflicts: # Tests/DispatchAsyncTests/DispatchGroupTests.swift # Conflicts: # Tests/DispatchAsyncTests/DispatchGroupTests.swift
…And other minor improvements to tests.
a872ad4
to
ee96d84
Compare
Quick summary
This PR adds a focused round of new and ported tests to harden the experimental
DispatchAsync
package:AsyncSemaphore
andDispatchTimeInterval
cover edge-cases that weren’t exercised before.dispatch_pingpong
anddispatch_group
) rewritten in Swift to stress-test queue/group behaviour under concurrency.DispatchGroup.wait
publicly visible so the new tests compile.PR Dependencies
This branch is stacked on PR #1 – “Initial implementation of many GCD API’s using Swift Concurrency.”
PR #1 will need merged before this PR.