Repository navigation
feat: Strengthen rt-ring testing with overwrite, concurrency, and loom checks - #2
Merged
Merged
Conversation
hasanzakeri
added a commit
that referenced
this pull request
Oct 8, 2026
…m checks (#2) ## Summary - **Add stronger cross-thread tests** in tests/concurrent.rs: - `steady_state_no_overwrite_when_consumer_keeps_up` proves no drops and zero overwrites when producer/consumer are in lockstep. - `available_never_exceeds_capacity_under_pressure` stress-tests a fast producer/slow consumer and asserts monotonic pops, `available() <= capacity`, and `overwrites + popped == pushed`. - **Tighten overwrite semantics and accounting** in `tests/overwrite.rs`: - `long_run_overwrite_accounting_and_tail_integrity` pushes far beyond capacity and checks that only the last capacity items remain and `overwrite_count` is exact. - `mixed_push_slice_pop_slice_matches_reference_and_overwrite_count` interleaves `push_slice/pop_slice` with a `VecDeque` reference model and validates both ordering and overwrite counts. - **Extend property testing** in tests/proptest.rs: tracks_available_and_overwrites_correctly keeps a reference queue in sync and asserts after every operation that available() and overwrite_count() match the model. - Introduce optional loom model checks in `tests/loom_spsc.rs`: - Gated behind the `loom-tests` feature. - `loom_small_interleavings_accounting_and_order` and `loom_capacity_one_keeps_latest_value` explore small-state interleavings and assert monotonic order plus `popped + overwrites == pushed`. - Wire loom into the build tooling: - Add a `loom-tests` feature in `Cargo.toml`. Add a `test-loom` target to `Makefile` that runs `cargo test --features loom-tests --test loom_spsc` via Docker. ## Test plan - make test - make test-loom - (CI) `cargo miri test` still exercises the existing tests, including the new property and concurrency cases.
hasanzakeri
added a commit
that referenced
this pull request
Oct 8, 2026
…m checks (#2) ## Summary - **Add stronger cross-thread tests** in tests/concurrent.rs: - `steady_state_no_overwrite_when_consumer_keeps_up` proves no drops and zero overwrites when producer/consumer are in lockstep. - `available_never_exceeds_capacity_under_pressure` stress-tests a fast producer/slow consumer and asserts monotonic pops, `available() <= capacity`, and `overwrites + popped == pushed`. - **Tighten overwrite semantics and accounting** in `tests/overwrite.rs`: - `long_run_overwrite_accounting_and_tail_integrity` pushes far beyond capacity and checks that only the last capacity items remain and `overwrite_count` is exact. - `mixed_push_slice_pop_slice_matches_reference_and_overwrite_count` interleaves `push_slice/pop_slice` with a `VecDeque` reference model and validates both ordering and overwrite counts. - **Extend property testing** in tests/proptest.rs: tracks_available_and_overwrites_correctly keeps a reference queue in sync and asserts after every operation that available() and overwrite_count() match the model. - Introduce optional loom model checks in `tests/loom_spsc.rs`: - Gated behind the `loom-tests` feature. - `loom_small_interleavings_accounting_and_order` and `loom_capacity_one_keeps_latest_value` explore small-state interleavings and assert monotonic order plus `popped + overwrites == pushed`. - Wire loom into the build tooling: - Add a `loom-tests` feature in `Cargo.toml`. Add a `test-loom` target to `Makefile` that runs `cargo test --features loom-tests --test loom_spsc` via Docker. ## Test plan - make test - make test-loom - (CI) `cargo miri test` still exercises the existing tests, including the new property and concurrency cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
steady_state_no_overwrite_when_consumer_keeps_upproves no drops and zero overwrites when producer/consumer are in lockstep.available_never_exceeds_capacity_under_pressurestress-tests a fast producer/slow consumer and asserts monotonic pops,available() <= capacity, andoverwrites + popped == pushed.tests/overwrite.rs:long_run_overwrite_accounting_and_tail_integritypushes far beyond capacity and checks that only the last capacity items remain andoverwrite_countis exact.mixed_push_slice_pop_slice_matches_reference_and_overwrite_countinterleavespush_slice/pop_slicewith aVecDequereference model and validates both ordering and overwrite counts.tracks_available_and_overwrites_correctly keeps a reference queue in sync and asserts after every operation that available() and overwrite_count() match the model.
tests/loom_spsc.rs:loom-testsfeature.loom_small_interleavings_accounting_and_orderandloom_capacity_one_keeps_latest_valueexplore small-state interleavings and assert monotonic order pluspopped + overwrites == pushed.loom-testsfeature inCargo.toml.Add a
test-loomtarget toMakefilethat runscargo test --features loom-tests --test loom_spscvia Docker.Test plan
cargo miri teststill exercises the existing tests, including the new property and concurrency cases.