Skip to content

Commit a79ee2b

Browse files
test_utils: new module cancel_safe (#936)
Summary: Pull Request resolved: #936 introduce `test_utils::cancel_safe` module with helpers for verifying future cancellation safety. provides sync (`assert_cancel_safe`) and async (`assert_cancel_safe_async`) variants that systematically test cancellation at every `Poll::Pending` boundary by driving a future to completion once to establish ground truth, then for each possible cancellation point `k` polling a fresh future `k` times, dropping it to simulate cancellation, and verifying a subsequent clean run still produces expected results. the async variant supports external progress drivers via `on_pending callbacks` for advancing mocked time or other runtime state. includes comprehensive documentation on cancel-safety semantics and examples covering pure state machines and timer-based futures. the intent is to provide a foundation for systematically validating that hyperactor's async primitives maintain their cancellation safety guarantees under arbitrary executor drop behavior. co-authored with mariusae Reviewed By: mariusae Differential Revision: D80626978 fbshipit-source-id: fb7405fcc55f018b0e6df89bec98d332ae083e0f
1 parent 2320f51 commit a79ee2b

File tree

4 files changed

+795
-63
lines changed

4 files changed

+795
-63
lines changed

hyperactor/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ unicode-ident = "1.0.12"
7272

7373
[dev-dependencies]
7474
maplit = "1.0"
75+
proptest = "1.5"
7576
timed_test = { version = "0.0.0", path = "../timed_test" }
7677
tracing-subscriber = { version = "0.3.19", features = ["chrono", "env-filter", "json", "local-time", "parking_lot", "registry"] }
7778
tracing-test = { version = "0.2.3", features = ["no-env-filter"] }

0 commit comments

Comments
 (0)