Repository navigation
Conversation
Add a cmocka suite for include/nuttx/ring.h covering all four modes (SPSC/MPSC/SPMC/MPMC): basic and batch enqueue/dequeue, full and empty boundaries, partial batches, index wraparound, non-power-of-two capacities, ring_alloc(), overwrite, skip, init and warm-restart recovery (rewind, corrupted or resized blob, interrupted MP commit, SPSC slave, concurrent init), and pthread producer/consumer stress. Enable CONFIG_TESTING_RING and run "ring_test" from nsh. Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com> Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
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
Add a cmocka test suite for the lock-free ring queue in
include/nuttx/ring.h(apache/nuttx#21945), covering all four modes(SPSC/MPSC/SPMC/MPMC):
batches, index wrap-around, non-power-of-two capacities
ring_alloc(), overwrite (discard count), skipinterrupted multi-producer commit, SPSC slave init (
-EAGAIN/-EINVAL),concurrent init where exactly one caller runs the init body
Enable
CONFIG_TESTING_RING(needsCONFIG_TESTING_CMOCKA) and runring_testfrom nsh.Depends on apache/nuttx#21945.
Impact
New test application only, off by default.
Testing
Host: Ubuntu 22.04.5 LTS x86_64; sim: gcc 13.1.0; qemu-armv8a: aarch64-none-elf-gcc 12.2.1, QEMU 10.2.1
Same runs as apache/nuttx#21945, with the nuttx PR applied:
sim:nshqemu-armv8a:nsh_smp(CONFIG_SMP_NCPUS=2)sim:nsh