tests: regression coverage for priority queue and ringbuf fixes - #97
Merged
Merged
Conversation
- test_sharded_sched: test_pool_priority_zero_no_starvation submits 64 tasks all at priority 0 through the thread pool and asserts every one completes via futures, covering the slot-0 NULL-element drop fixed in 95854ca that deadlocked submitters in ttak_future_get. - test_ringbuf: test_ringbuf_concurrent_query_race hammers push/pop from producer/consumer threads while two querier threads call ttak_ringbuf_count/is_empty/is_full, covering the data race fixed in 439a7ff. Asserts the capacity bound and pushed-minus-popped sum sanity. - test_priority: test_priority_queue_zero_priority_slot0 reproduces the heap slot-0 NULL encoding directly at queue level, and test_priority_queue_heap_stress pushes 5000 items with mixed priorities (half of them 0, many duplicates) and verifies pop order is monotonically non-increasing against a max-extraction model, covering the heap restructure in cb804a9/95854ca8.
gg582
force-pushed
the
test/regression-coverage
branch
from
October 4, 2026 12:33
a3494f0 to
d6cf42a
Compare
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
Adds regression tests for three recently fixed bugs. No library code changes.
1. Priority-0 task starvation/deadlock (fixed in 95854ca)
tests/test_sharded_sched.c— newtest_pool_priority_zero_no_starvation:submits 64 tasks all at priority 0 through the thread pool and asserts every
one completes via futures. The fixed bug encoded (priority 0, slot 0) to NULL,
silently dropping the task and deadlocking the submitter in
ttak_future_get.Also asserts the burst completes in under 10 seconds.
2. Ring buffer concurrent query data race (fixed in 439a7ff)
tests/test_ringbuf.c— newtest_ringbuf_concurrent_query_race:a producer and a consumer hammer push/pop while two querier threads
continuously call
ttak_ringbuf_count/is_empty/is_full. Asserts theper-snapshot capacity bound (
count <= capacity) and sum sanity(
count == pushed - popped) after join, plus no crash. (Cross-functionagreements like
count==0 == is_emptyare intentionally not asserted: eachquery takes its own lock, so they are separate snapshots of a concurrently
mutating buffer.)
3. Heap-backed priority queue restructure (cb804a9 / 95854ca)
tests/test_priority.c:test_priority_queue_zero_priority_slot0— reproduces the slot-0 NULLencoding directly at queue level: a lone priority-0 task, and a priority-0
task buried under 32 higher-priority pushes, must both survive push/pop.
test_priority_queue_heap_stress— pushes 5000 items with a deterministicLCG (half priority 0, heavy duplication, occasional 42), pops all, and
verifies pop order is monotonically non-increasing against a
max-extraction model, with pop count exactly matching push count.
Test plan
make test— full suite passes