about summary refs log tree commit diff
path: root/library/std/tests/sync
AgeCommit message (Collapse)AuthorLines
2025-09-11update doc commentConnor Tsui-1/+1
Co-authored-by: Ralf Jung <post@ralfj.de>
2025-09-11fix config for poison macro testConnor Tsui-15/+18
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
2025-09-09Make the compile test use a const insteadGeorg Semmler-8/+7
2025-09-09Make Barrier RefUnwindSafe againGeorg Semmler-0/+10
This commit manually implements `RefUnwindSafe` for `std::sync::Barrier` to fix 146087. This is a fix for a regression indroduced by https://github.com/rust-lang/rust/commit/e95db591a4550e28ad92660b753ad85b89271882
2025-08-30Rollup merge of #144651 - connortsui20:nonpoison_condvar, r=joboetStuart Cook-195/+241
Implementation: `#[feature(nonpoison_condvar)]` Tracking Issue: https://github.com/rust-lang/rust/issues/134645 This PR continues the effort made in https://github.com/rust-lang/rust/pull/144022 by adding the implementation of `nonpoison::condvar`. Many of the changes here are similar to the changes made to implement `nonpoison::mutex`. There are two other changes here. The first is that the `Barrier` implementation is migrated to use the `nonpoison::Condvar` instead of the `poison` variant. The second (which might be subject to some discussion) is that `WaitTimeoutResult` is moved up to `mod.rs`, as both `condvar` variants need that type (and I do not know if there is a better place to put it now). ### Related PRs - `nonpoison_rwlock` implementation: https://github.com/rust-lang/rust/pull/144648 - `nonpoison_once` implementation: https://github.com/rust-lang/rust/pull/144653
2025-08-23Rollup merge of #145307 - connortsui20:lazylock-poison-msg, r=AmanieuJacob Pratt-31/+53
Fix `LazyLock` poison panic message Fixes the issue raised in https://github.com/rust-lang/rust/pull/144872#issuecomment-3151100248 r? ```@Amanieu```
2025-08-23add nonpoison and poison condvar testsConnor Tsui-195/+241
Adds tests for the `nonpoison::Mutex` variant by using a macro to duplicate the existing `poison` tests. Note that all of the tests here are adapted from the existing `poison` tests. Also steals the `test_mutex_arc_condvar` test from `mutex.rs`. Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
2025-08-22modify `LazyLock` poison panic messageConnor Tsui-31/+53
Fixes an issue where if the underlying `Once` panics because it is poisoned, the panic displays the wrong message. Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
2025-08-09add nonpoison and poison rwlock testsConnor Tsui-280/+381
Adds tests for the `nonpoison::RwLock` variant by using a macro to duplicate the existing `poison` tests. Note that all of the tests here are adapted from the existing `poison` tests.
2025-08-09reorganize rwlock testsConnor Tsui-336/+348
This commit simply helps discern the actual changes needed to test both poison and nonpoison `rwlock`s.
2025-07-29add extra drop, panic, and unwind testsConnor Tsui-22/+80
2025-07-29add nonpoison and poison mutex testsConnor Tsui-146/+260
Adds tests for the `nonpoison::Mutex` variant by using a macro to duplicate the existing `poison` tests. Note that all of the tests here are adapted from the existing `poison` tests.
2025-07-29reorder mutex testsConnor Tsui-144/+158
This commit simply helps discern the actual changes needed to test both poison and nonpoison locks.
2025-06-17library: Increase timeout on mpmc test to reduce flakesJubilee Young-2/+2
This recently spuriously failed in a rollup, so I think we can afford to increase the base timeout and the amount of time slept for to provide a much wider margin for the timeout to be reached.
2025-06-08Avoid a gratuitous 10s wait in a stress testJosh Triplett-6/+16
`stress_recv_timeout_two_threads`, in the mpmc and mpsc testsuites, is a stress test of the `recv_timeout` function. This test processes and ignores timeouts, and just ensures that every sent value gets received. As such, the exact length of the timeouts is not critical, only that the timeout and sleep durations ensure that at least one timeout occurred. The current tests have 100 iterations, half of which sleep for 200ms, causing the test to take 10s. This represents around 2/3rds of the *total* runtime of the `library/std` testsuite. Reduce this to 50 iterations where half of them sleep for 10ms, causing the test to take 0.25s. Add a check that at least one timeout occurred.
2025-04-30Rename `(Mapped)(RwLock|Mutex)Guard::try_map` to `filter_map`.Zachary S-18/+26
1. analogous to std::cell::Ref(Mut)::filter_map. 2. doesn't imply `Try` genericizability.
2025-04-15Basic tests of MPMC receiver cloningGlyn Normington-0/+30
Ref: https://github.com/rust-lang/rust/issues/126840#issuecomment-2802321146
2025-03-10Mark some std tests as requiring `panic = "unwind"`Paul Menage-2/+34
This allows these test modules to pass on builds/targets without unwinding support, where `panic = "abort"` - the ignored tests are for functionality that's not supported on those targets.
2025-02-13library: Update rand to 0.9.0Eric Huss-1/+1
2025-02-02Remove stabilized feature gatebjorn3-1/+0
2025-01-26Fix for SGXbjorn3-1/+1
2025-01-26Move std::sync unit tests to integration testsbjorn3-0/+4120
This removes two minor OnceLock tests which test private methods. The rest of the tests should be more than enough to catch mistakes in those private methods. Also makes ReentrantLock::try_lock public. And finally it makes the mpmc tests actually run.