The actual capacity of ring should be the (RING_SIZE - 1), thus only
(RING_SIZE - 1) elements can be enqueued into the ring.

Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
Cc: honnappa.nagaraha...@arm.com
Cc: sta...@dpdk.org

Signed-off-by: Feifei Wang <feifei.wa...@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.w...@arm.com>
---
 app/test/test_ring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/test/test_ring.c b/app/test/test_ring.c
index c508a13a9..51bae0d48 100644
--- a/app/test/test_ring.c
+++ b/app/test/test_ring.c
@@ -822,7 +822,7 @@ test_ring_basic_ex(void)
                printf("%u ring entries are now free\n",
                        rte_ring_free_count(rp));
 
-               for (j = 0; j < RING_SIZE; j++) {
+               for (j = 0; j < RING_SIZE - 1; j++) {
                        test_ring_enqueue(rp, obj, esize[i], 1,
                                TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE);
                }
@@ -833,7 +833,7 @@ test_ring_basic_ex(void)
                        goto fail_test;
                }
 
-               for (j = 0; j < RING_SIZE; j++) {
+               for (j = 0; j < RING_SIZE - 1; j++) {
                        test_ring_dequeue(rp, obj, esize[i], 1,
                                TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE);
                }
-- 
2.17.1

Reply via email to