From: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
To: dev@dpdk.org, konstantin.ananyev@intel.com, thomas@monjalon.net,
aconole@redhat.com, honnappa.nagarahalli@arm.com
Cc: ruifeng.wang@arm.com, nd@arm.com
Subject: [dpdk-dev] [PATCH] test/ring: fix long compilation time
Date: Wed, 29 Apr 2020 20:56:50 -0500 [thread overview]
Message-ID: <20200430015650.18243-1-honnappa.nagarahalli@arm.com> (raw)
test_ring.c takes lot of time to compile with clang. It is
reproducable with compiler version 8.0 on Ubuntu 18.04.
Amount of testing is reduced, but attempt is made to keep
the same coverage.
Reported-by: Aaron Conole <aconole@redhat.com>
Reported-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
app/test/test_ring.c | 588 +++++++++++++++++++++----------------------
1 file changed, 283 insertions(+), 305 deletions(-)
diff --git a/app/test/test_ring.c b/app/test/test_ring.c
index e21557cd9..82148566a 100644
--- a/app/test/test_ring.c
+++ b/app/test/test_ring.c
@@ -203,83 +203,77 @@ test_ring_negative_tests(void)
* Random number of elements are enqueued and dequeued.
*/
static int
-test_ring_burst_bulk_tests1(unsigned int api_type, unsigned int create_flags,
- const char *tname)
+test_ring_burst_bulk_tests1(unsigned int api_type, const unsigned int esize,
+ unsigned int create_flags, const char *tname)
{
struct rte_ring *r;
void **src = NULL, **cur_src = NULL, **dst = NULL, **cur_dst = NULL;
int ret;
- unsigned int i, j;
+ unsigned int j;
int rand;
const unsigned int rsz = RING_SIZE - 1;
- for (i = 0; i < RTE_DIM(esize); i++) {
- test_ring_print_test_string(tname, api_type, esize[i]);
-
- /* Create the ring */
- r = test_ring_create("test_ring_burst_bulk_tests", esize[i],
- RING_SIZE, SOCKET_ID_ANY, create_flags);
-
- /* alloc dummy object pointers */
- src = test_ring_calloc(RING_SIZE * 2, esize[i]);
- if (src == NULL)
- goto fail;
- test_ring_mem_init(src, RING_SIZE * 2, esize[i]);
- cur_src = src;
-
- /* alloc some room for copied objects */
- dst = test_ring_calloc(RING_SIZE * 2, esize[i]);
- if (dst == NULL)
- goto fail;
- cur_dst = dst;
-
- printf("Random full/empty test\n");
-
- for (j = 0; j != TEST_RING_FULL_EMTPY_ITER; j++) {
- /* random shift in the ring */
- rand = RTE_MAX(rte_rand() % RING_SIZE, 1UL);
- printf("%s: iteration %u, random shift: %u;\n",
- __func__, i, rand);
- ret = test_ring_enqueue(r, cur_src, esize[i], rand,
- api_type);
- TEST_RING_VERIFY(ret != 0);
-
- ret = test_ring_dequeue(r, cur_dst, esize[i], rand,
- api_type);
- TEST_RING_VERIFY(ret == rand);
-
- /* fill the ring */
- ret = test_ring_enqueue(r, cur_src, esize[i], rsz,
- api_type);
- TEST_RING_VERIFY(ret != 0);
-
- TEST_RING_VERIFY(rte_ring_free_count(r) == 0);
- TEST_RING_VERIFY(rsz == rte_ring_count(r));
- TEST_RING_VERIFY(rte_ring_full(r));
- TEST_RING_VERIFY(rte_ring_empty(r) == 0);
-
- /* empty the ring */
- ret = test_ring_dequeue(r, cur_dst, esize[i], rsz,
- api_type);
- TEST_RING_VERIFY(ret == (int)rsz);
- TEST_RING_VERIFY(rsz == rte_ring_free_count(r));
- TEST_RING_VERIFY(rte_ring_count(r) == 0);
- TEST_RING_VERIFY(rte_ring_full(r) == 0);
- TEST_RING_VERIFY(rte_ring_empty(r));
-
- /* check data */
- TEST_RING_VERIFY(memcmp(src, dst, rsz) == 0);
- }
+ test_ring_print_test_string(tname, api_type, esize);
+
+ /* Create the ring */
+ r = test_ring_create("test_ring_burst_bulk_tests", esize,
+ RING_SIZE, SOCKET_ID_ANY, create_flags);
+
+ /* alloc dummy object pointers */
+ src = test_ring_calloc(RING_SIZE * 2, esize);
+ if (src == NULL)
+ goto fail;
+ test_ring_mem_init(src, RING_SIZE * 2, esize);
+ cur_src = src;
+
+ /* alloc some room for copied objects */
+ dst = test_ring_calloc(RING_SIZE * 2, esize);
+ if (dst == NULL)
+ goto fail;
+ cur_dst = dst;
+
+ printf("Random full/empty test\n");
+
+ for (j = 0; j != TEST_RING_FULL_EMTPY_ITER; j++) {
+ /* random shift in the ring */
+ rand = RTE_MAX(rte_rand() % RING_SIZE, 1UL);
+ printf("%s: iteration %u, random shift: %u;\n",
+ __func__, j, rand);
+ ret = test_ring_enqueue(r, cur_src, esize, rand, api_type);
+ TEST_RING_VERIFY(ret != 0);
+
+ ret = test_ring_dequeue(r, cur_dst, esize, rand, api_type);
+ TEST_RING_VERIFY(ret == rand);
+
+ /* fill the ring */
+ ret = test_ring_enqueue(r, cur_src, esize, rsz, api_type);
+ TEST_RING_VERIFY(ret != 0);
+
+ TEST_RING_VERIFY(rte_ring_free_count(r) == 0);
+ TEST_RING_VERIFY(rsz == rte_ring_count(r));
+ TEST_RING_VERIFY(rte_ring_full(r));
+ TEST_RING_VERIFY(rte_ring_empty(r) == 0);
+
+ /* empty the ring */
+ ret = test_ring_dequeue(r, cur_dst, esize, rsz, api_type);
+ TEST_RING_VERIFY(ret == (int)rsz);
+ TEST_RING_VERIFY(rsz == rte_ring_free_count(r));
+ TEST_RING_VERIFY(rte_ring_count(r) == 0);
+ TEST_RING_VERIFY(rte_ring_full(r) == 0);
+ TEST_RING_VERIFY(rte_ring_empty(r));
- /* Free memory before test completed */
- rte_ring_free(r);
- rte_free(src);
- rte_free(dst);
- r = NULL;
- src = NULL;
- dst = NULL;
+ /* check data */
+ TEST_RING_VERIFY(memcmp(src, dst, rsz) == 0);
}
+ /* Free memory before test completed */
+ rte_ring_free(r);
+ rte_free(src);
+ rte_free(dst);
+ r = NULL;
+ src = NULL;
+ dst = NULL;
+
return 0;
fail:
rte_ring_free(r);
@@ -294,89 +288,84 @@ test_ring_burst_bulk_tests1(unsigned int api_type, unsigned int create_flags,
* dequeued data.
*/
static int
-test_ring_burst_bulk_tests2(unsigned int api_type, unsigned int create_flags,
- const char *tname)
+test_ring_burst_bulk_tests2(unsigned int api_type, const unsigned int esize,
+ unsigned int create_flags, const char *tname)
{
struct rte_ring *r;
void **src = NULL, **cur_src = NULL, **dst = NULL, **cur_dst = NULL;
int ret;
- unsigned int i;
-
- for (i = 0; i < RTE_DIM(esize); i++) {
- test_ring_print_test_string(tname, api_type, esize[i]);
-
- /* Create the ring */
- r = test_ring_create("test_ring_burst_bulk_tests", esize[i],
- RING_SIZE, SOCKET_ID_ANY, create_flags);
-
- /* alloc dummy object pointers */
- src = test_ring_calloc(RING_SIZE * 2, esize[i]);
- if (src == NULL)
- goto fail;
- test_ring_mem_init(src, RING_SIZE * 2, esize[i]);
- cur_src = src;
-
- /* alloc some room for copied objects */
- dst = test_ring_calloc(RING_SIZE * 2, esize[i]);
- if (dst == NULL)
- goto fail;
- cur_dst = dst;
-
- printf("enqueue 1 obj\n");
- ret = test_ring_enqueue(r, cur_src, esize[i], 1, api_type);
- if (ret != 1)
- goto fail;
- cur_src = test_ring_inc_ptr(cur_src, esize[i], 1);
- printf("enqueue 2 objs\n");
- ret = test_ring_enqueue(r, cur_src, esize[i], 2, api_type);
- if (ret != 2)
- goto fail;
- cur_src = test_ring_inc_ptr(cur_src, esize[i], 2);
-
- printf("enqueue MAX_BULK objs\n");
- ret = test_ring_enqueue(r, cur_src, esize[i], MAX_BULK,
- api_type);
- if (ret != MAX_BULK)
- goto fail;
- cur_src = test_ring_inc_ptr(cur_src, esize[i], MAX_BULK);
-
- printf("dequeue 1 obj\n");
- ret = test_ring_dequeue(r, cur_dst, esize[i], 1, api_type);
- if (ret != 1)
- goto fail;
- cur_dst = test_ring_inc_ptr(cur_dst, esize[i], 1);
-
- printf("dequeue 2 objs\n");
- ret = test_ring_dequeue(r, cur_dst, esize[i], 2, api_type);
- if (ret != 2)
- goto fail;
- cur_dst = test_ring_inc_ptr(cur_dst, esize[i], 2);
-
- printf("dequeue MAX_BULK objs\n");
- ret = test_ring_dequeue(r, cur_dst, esize[i], MAX_BULK,
- api_type);
- if (ret != MAX_BULK)
- goto fail;
- cur_dst = test_ring_inc_ptr(cur_dst, esize[i], MAX_BULK);
-
- /* check data */
- if (memcmp(src, dst, cur_dst - dst)) {
- rte_hexdump(stdout, "src", src, cur_src - src);
- rte_hexdump(stdout, "dst", dst, cur_dst - dst);
- printf("data after dequeue is not the same\n");
- goto fail;
- }
-
- /* Free memory before test completed */
- rte_ring_free(r);
- rte_free(src);
- rte_free(dst);
- r = NULL;
- src = NULL;
- dst = NULL;
+ test_ring_print_test_string(tname, api_type, esize);
+
+ /* Create the ring */
+ r = test_ring_create("test_ring_burst_bulk_tests", esize,
+ RING_SIZE, SOCKET_ID_ANY, create_flags);
+
+ /* alloc dummy object pointers */
+ src = test_ring_calloc(RING_SIZE * 2, esize);
+ if (src == NULL)
+ goto fail;
+ test_ring_mem_init(src, RING_SIZE * 2, esize);
+ cur_src = src;
+
+ /* alloc some room for copied objects */
+ dst = test_ring_calloc(RING_SIZE * 2, esize);
+ if (dst == NULL)
+ goto fail;
+ cur_dst = dst;
+
+ printf("enqueue 1 obj\n");
+ ret = test_ring_enqueue(r, cur_src, esize, 1, api_type);
+ if (ret != 1)
+ goto fail;
+ cur_src = test_ring_inc_ptr(cur_src, esize, 1);
+
+ printf("enqueue 2 objs\n");
+ ret = test_ring_enqueue(r, cur_src, esize, 2, api_type);
+ if (ret != 2)
+ goto fail;
+ cur_src = test_ring_inc_ptr(cur_src, esize, 2);
+
+ printf("enqueue MAX_BULK objs\n");
+ ret = test_ring_enqueue(r, cur_src, esize, MAX_BULK, api_type);
+ if (ret != MAX_BULK)
+ goto fail;
+ cur_src = test_ring_inc_ptr(cur_src, esize, MAX_BULK);
+
+ printf("dequeue 1 obj\n");
+ ret = test_ring_dequeue(r, cur_dst, esize, 1, api_type);
+ if (ret != 1)
+ goto fail;
+ cur_dst = test_ring_inc_ptr(cur_dst, esize, 1);
+
+ printf("dequeue 2 objs\n");
+ ret = test_ring_dequeue(r, cur_dst, esize, 2, api_type);
+ if (ret != 2)
+ goto fail;
+ cur_dst = test_ring_inc_ptr(cur_dst, esize, 2);
+
+ printf("dequeue MAX_BULK objs\n");
+ ret = test_ring_dequeue(r, cur_dst, esize, MAX_BULK, api_type);
+ if (ret != MAX_BULK)
+ goto fail;
+ cur_dst = test_ring_inc_ptr(cur_dst, esize, MAX_BULK);
+
+ /* check data */
+ if (memcmp(src, dst, cur_dst - dst)) {
+ rte_hexdump(stdout, "src", src, cur_src - src);
+ rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+ printf("data after dequeue is not the same\n");
+ goto fail;
}
+ /* Free memory before test completed */
+ rte_ring_free(r);
+ rte_free(src);
+ rte_free(dst);
+ r = NULL;
+ src = NULL;
+ dst = NULL;
+
return 0;
fail:
rte_ring_free(r);
@@ -390,68 +379,62 @@ test_ring_burst_bulk_tests2(unsigned int api_type, unsigned int create_flags,
* Enqueue and dequeue to cover the entire ring length.
*/
static int
-test_ring_burst_bulk_tests3(unsigned int api_type, unsigned int create_flags,
- const char *tname)
+test_ring_burst_bulk_tests3(unsigned int api_type, const unsigned int esize,
+ unsigned int create_flags, const char *tname)
{
struct rte_ring *r;
void **src = NULL, **cur_src = NULL, **dst = NULL, **cur_dst = NULL;
int ret;
- unsigned int i, j;
-
- for (i = 0; i < RTE_DIM(esize); i++) {
- test_ring_print_test_string(tname, api_type, esize[i]);
-
- /* Create the ring */
- r = test_ring_create("test_ring_burst_bulk_tests", esize[i],
- RING_SIZE, SOCKET_ID_ANY, create_flags);
-
- /* alloc dummy object pointers */
- src = test_ring_calloc(RING_SIZE * 2, esize[i]);
- if (src == NULL)
+ unsigned int j;
+
+ test_ring_print_test_string(tname, api_type, esize);
+
+ /* Create the ring */
+ r = test_ring_create("test_ring_burst_bulk_tests", esize,
+ RING_SIZE, SOCKET_ID_ANY, create_flags);
+
+ /* alloc dummy object pointers */
+ src = test_ring_calloc(RING_SIZE * 2, esize);
+ if (src == NULL)
+ goto fail;
+ test_ring_mem_init(src, RING_SIZE * 2, esize);
+ cur_src = src;
+
+ /* alloc some room for copied objects */
+ dst = test_ring_calloc(RING_SIZE * 2, esize);
+ if (dst == NULL)
+ goto fail;
+ cur_dst = dst;
+
+ printf("fill and empty the ring\n");
+ for (j = 0; j < RING_SIZE / MAX_BULK; j++) {
+ ret = test_ring_enqueue(r, cur_src, esize, MAX_BULK, api_type);
+ if (ret != MAX_BULK)
goto fail;
- test_ring_mem_init(src, RING_SIZE * 2, esize[i]);
- cur_src = src;
+ cur_src = test_ring_inc_ptr(cur_src, esize, MAX_BULK);
- /* alloc some room for copied objects */
- dst = test_ring_calloc(RING_SIZE * 2, esize[i]);
- if (dst == NULL)
- goto fail;
- cur_dst = dst;
-
- printf("fill and empty the ring\n");
- for (j = 0; j < RING_SIZE / MAX_BULK; j++) {
- ret = test_ring_enqueue(r, cur_src, esize[i], MAX_BULK,
- api_type);
- if (ret != MAX_BULK)
- goto fail;
- cur_src = test_ring_inc_ptr(cur_src, esize[i],
- MAX_BULK);
-
- ret = test_ring_dequeue(r, cur_dst, esize[i], MAX_BULK,
- api_type);
- if (ret != MAX_BULK)
- goto fail;
- cur_dst = test_ring_inc_ptr(cur_dst, esize[i],
- MAX_BULK);
- }
-
- /* check data */
- if (memcmp(src, dst, cur_dst - dst)) {
- rte_hexdump(stdout, "src", src, cur_src - src);
- rte_hexdump(stdout, "dst", dst, cur_dst - dst);
- printf("data after dequeue is not the same\n");
+ ret = test_ring_dequeue(r, cur_dst, esize, MAX_BULK, api_type);
+ if (ret != MAX_BULK)
goto fail;
- }
+ cur_dst = test_ring_inc_ptr(cur_dst, esize, MAX_BULK);
+ }
- /* Free memory before test completed */
- rte_ring_free(r);
- rte_free(src);
- rte_free(dst);
- r = NULL;
- src = NULL;
- dst = NULL;
+ /* check data */
+ if (memcmp(src, dst, cur_dst - dst)) {
+ rte_hexdump(stdout, "src", src, cur_src - src);
+ rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+ printf("data after dequeue is not the same\n");
+ goto fail;
}
+ /* Free memory before test completed */
+ rte_ring_free(r);
+ rte_free(src);
+ rte_free(dst);
+ r = NULL;
+ src = NULL;
+ dst = NULL;
+
return 0;
fail:
rte_ring_free(r);
@@ -465,123 +448,116 @@ test_ring_burst_bulk_tests3(unsigned int api_type, unsigned int create_flags,
* Enqueue till the ring is full and dequeue till the ring becomes empty.
*/
static int
-test_ring_burst_bulk_tests4(unsigned int api_type, unsigned int create_flags,
- const char *tname)
+test_ring_burst_bulk_tests4(unsigned int api_type, const unsigned int esize,
+ unsigned int create_flags, const char *tname)
{
struct rte_ring *r;
void **src = NULL, **cur_src = NULL, **dst = NULL, **cur_dst = NULL;
int ret;
- unsigned int i, j;
+ unsigned int j;
unsigned int num_elems;
- for (i = 0; i < RTE_DIM(esize); i++) {
- test_ring_print_test_string(tname, api_type, esize[i]);
+ test_ring_print_test_string(tname, api_type, esize);
- /* Create the ring */
- r = test_ring_create("test_ring_burst_bulk_tests", esize[i],
- RING_SIZE, SOCKET_ID_ANY, create_flags);
-
- /* alloc dummy object pointers */
- src = test_ring_calloc(RING_SIZE * 2, esize[i]);
- if (src == NULL)
- goto fail;
- test_ring_mem_init(src, RING_SIZE * 2, esize[i]);
- cur_src = src;
-
- /* alloc some room for copied objects */
- dst = test_ring_calloc(RING_SIZE * 2, esize[i]);
- if (dst == NULL)
- goto fail;
- cur_dst = dst;
-
- printf("Test enqueue without enough memory space\n");
- for (j = 0; j < (RING_SIZE/MAX_BULK - 1); j++) {
- ret = test_ring_enqueue(r, cur_src, esize[i], MAX_BULK,
- api_type);
- if (ret != MAX_BULK)
- goto fail;
- cur_src = test_ring_inc_ptr(cur_src, esize[i],
- MAX_BULK);
- }
+ /* Create the ring */
+ r = test_ring_create("test_ring_burst_bulk_tests", esize,
+ RING_SIZE, SOCKET_ID_ANY, create_flags);
- printf("Enqueue 2 objects, free entries = MAX_BULK - 2\n");
- ret = test_ring_enqueue(r, cur_src, esize[i], 2, api_type);
- if (ret != 2)
- goto fail;
- cur_src = test_ring_inc_ptr(cur_src, esize[i], 2);
-
- printf("Enqueue the remaining entries = MAX_BULK - 3\n");
- /* Bulk APIs enqueue exact number of elements */
- if ((api_type & TEST_RING_ELEM_BULK) == TEST_RING_ELEM_BULK)
- num_elems = MAX_BULK - 3;
- else
- num_elems = MAX_BULK;
- /* Always one free entry left */
- ret = test_ring_enqueue(r, cur_src, esize[i], num_elems,
- api_type);
- if (ret != MAX_BULK - 3)
- goto fail;
- cur_src = test_ring_inc_ptr(cur_src, esize[i], MAX_BULK - 3);
+ /* alloc dummy object pointers */
+ src = test_ring_calloc(RING_SIZE * 2, esize);
+ if (src == NULL)
+ goto fail;
+ test_ring_mem_init(src, RING_SIZE * 2, esize);
+ cur_src = src;
- printf("Test if ring is full\n");
- if (rte_ring_full(r) != 1)
- goto fail;
+ /* alloc some room for copied objects */
+ dst = test_ring_calloc(RING_SIZE * 2, esize);
+ if (dst == NULL)
+ goto fail;
+ cur_dst = dst;
- printf("Test enqueue for a full entry\n");
- ret = test_ring_enqueue(r, cur_src, esize[i], MAX_BULK,
- api_type);
- if (ret != 0)
+ printf("Test enqueue without enough memory space\n");
+ for (j = 0; j < (RING_SIZE/MAX_BULK - 1); j++) {
+ ret = test_ring_enqueue(r, cur_src, esize, MAX_BULK, api_type);
+ if (ret != MAX_BULK)
goto fail;
+ cur_src = test_ring_inc_ptr(cur_src, esize, MAX_BULK);
+ }
- printf("Test dequeue without enough objects\n");
- for (j = 0; j < RING_SIZE / MAX_BULK - 1; j++) {
- ret = test_ring_dequeue(r, cur_dst, esize[i], MAX_BULK,
- api_type);
- if (ret != MAX_BULK)
- goto fail;
- cur_dst = test_ring_inc_ptr(cur_dst, esize[i],
- MAX_BULK);
- }
-
- /* Available memory space for the exact MAX_BULK entries */
- ret = test_ring_dequeue(r, cur_dst, esize[i], 2, api_type);
- if (ret != 2)
- goto fail;
- cur_dst = test_ring_inc_ptr(cur_dst, esize[i], 2);
-
- /* Bulk APIs enqueue exact number of elements */
- if ((api_type & TEST_RING_ELEM_BULK) == TEST_RING_ELEM_BULK)
- num_elems = MAX_BULK - 3;
- else
- num_elems = MAX_BULK;
- ret = test_ring_dequeue(r, cur_dst, esize[i], num_elems,
- api_type);
- if (ret != MAX_BULK - 3)
- goto fail;
- cur_dst = test_ring_inc_ptr(cur_dst, esize[i], MAX_BULK - 3);
+ printf("Enqueue 2 objects, free entries = MAX_BULK - 2\n");
+ ret = test_ring_enqueue(r, cur_src, esize, 2, api_type);
+ if (ret != 2)
+ goto fail;
+ cur_src = test_ring_inc_ptr(cur_src, esize, 2);
- printf("Test if ring is empty\n");
- /* Check if ring is empty */
- if (rte_ring_empty(r) != 1)
+ printf("Enqueue the remaining entries = MAX_BULK - 3\n");
+ /* Bulk APIs enqueue exact number of elements */
+ if ((api_type & TEST_RING_ELEM_BULK) == TEST_RING_ELEM_BULK)
+ num_elems = MAX_BULK - 3;
+ else
+ num_elems = MAX_BULK;
+ /* Always one free entry left */
+ ret = test_ring_enqueue(r, cur_src, esize, num_elems, api_type);
+ if (ret != MAX_BULK - 3)
+ goto fail;
+ cur_src = test_ring_inc_ptr(cur_src, esize, MAX_BULK - 3);
+
+ printf("Test if ring is full\n");
+ if (rte_ring_full(r) != 1)
+ goto fail;
+
+ printf("Test enqueue for a full entry\n");
+ ret = test_ring_enqueue(r, cur_src, esize, MAX_BULK,
+ api_type);
+ if (ret != 0)
+ goto fail;
+
+ printf("Test dequeue without enough objects\n");
+ for (j = 0; j < RING_SIZE / MAX_BULK - 1; j++) {
+ ret = test_ring_dequeue(r, cur_dst, esize, MAX_BULK, api_type);
+ if (ret != MAX_BULK)
goto fail;
+ cur_dst = test_ring_inc_ptr(cur_dst, esize, MAX_BULK);
+ }
- /* check data */
- if (memcmp(src, dst, cur_dst - dst)) {
- rte_hexdump(stdout, "src", src, cur_src - src);
- rte_hexdump(stdout, "dst", dst, cur_dst - dst);
- printf("data after dequeue is not the same\n");
- goto fail;
- }
+ /* Available memory space for the exact MAX_BULK entries */
+ ret = test_ring_dequeue(r, cur_dst, esize, 2, api_type);
+ if (ret != 2)
+ goto fail;
+ cur_dst = test_ring_inc_ptr(cur_dst, esize, 2);
- /* Free memory before test completed */
- rte_ring_free(r);
- rte_free(src);
- rte_free(dst);
- r = NULL;
- src = NULL;
- dst = NULL;
+ /* Bulk APIs enqueue exact number of elements */
+ if ((api_type & TEST_RING_ELEM_BULK) == TEST_RING_ELEM_BULK)
+ num_elems = MAX_BULK - 3;
+ else
+ num_elems = MAX_BULK;
+ ret = test_ring_dequeue(r, cur_dst, esize, num_elems,
+ api_type);
+ if (ret != MAX_BULK - 3)
+ goto fail;
+ cur_dst = test_ring_inc_ptr(cur_dst, esize, MAX_BULK - 3);
+
+ printf("Test if ring is empty\n");
+ /* Check if ring is empty */
+ if (rte_ring_empty(r) != 1)
+ goto fail;
+
+ /* check data */
+ if (memcmp(src, dst, cur_dst - dst)) {
+ rte_hexdump(stdout, "src", src, cur_src - src);
+ rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+ printf("data after dequeue is not the same\n");
+ goto fail;
}
+ /* Free memory before test completed */
+ rte_ring_free(r);
+ rte_free(src);
+ rte_free(dst);
+ r = NULL;
+ src = NULL;
+ dst = NULL;
+
return 0;
fail:
rte_ring_free(r);
@@ -853,55 +829,57 @@ test_ring(void)
for (j = TEST_RING_ELEM_BULK; j <= TEST_RING_ELEM_BURST; j <<= 1)
for (i = TEST_RING_THREAD_DEF;
i <= TEST_RING_THREAD_MPMC; i <<= 1)
- if (test_ring_burst_bulk_tests1(i | j, 0, tname) < 0)
+ if (test_ring_burst_bulk_tests1(i | j,
+ -1, 0, tname) < 0)
goto test_fail;
for (j = TEST_RING_ELEM_BULK; j <= TEST_RING_ELEM_BURST; j <<= 1)
for (i = TEST_RING_THREAD_DEF;
i <= TEST_RING_THREAD_MPMC; i <<= 1)
- if (test_ring_burst_bulk_tests2(i | j, 0, tname) < 0)
+ if (test_ring_burst_bulk_tests2(i | j, 4, 0, tname) < 0)
goto test_fail;
for (j = TEST_RING_ELEM_BULK; j <= TEST_RING_ELEM_BURST; j <<= 1)
for (i = TEST_RING_THREAD_DEF;
i <= TEST_RING_THREAD_MPMC; i <<= 1)
- if (test_ring_burst_bulk_tests3(i | j, 0, tname) < 0)
+ if (test_ring_burst_bulk_tests3(i | j, 8, 0, tname) < 0)
goto test_fail;
- for (j = TEST_RING_ELEM_BULK; j <= TEST_RING_ELEM_BURST; j <<= 1)
+ for (j = TEST_RING_ELEM_BULK; j < TEST_RING_ELEM_BURST; j <<= 1)
for (i = TEST_RING_THREAD_DEF;
i <= TEST_RING_THREAD_MPMC; i <<= 1)
- if (test_ring_burst_bulk_tests4(i | j, 0, tname) < 0)
+ if (test_ring_burst_bulk_tests4(i | j,
+ 16, 0, tname) < 0)
goto test_fail;
/* Burst and bulk operations with MT_RTS and MT_HTS sync modes */
for (i = 0; i != RTE_DIM(test_sync_modes); i++) {
- for (j = TEST_RING_ELEM_BULK; j <= TEST_RING_ELEM_BURST;
+ for (j = TEST_RING_ELEM_BULK; j < TEST_RING_ELEM_BURST;
j <<= 1) {
rc = test_ring_burst_bulk_tests1(
- TEST_RING_THREAD_DEF | j,
+ TEST_RING_THREAD_DEF | j, -1,
test_sync_modes[i].create_flags,
test_sync_modes[i].name);
if (rc < 0)
goto test_fail;
rc = test_ring_burst_bulk_tests2(
- TEST_RING_THREAD_DEF | j,
+ TEST_RING_THREAD_DEF | j, 4,
test_sync_modes[i].create_flags,
test_sync_modes[i].name);
if (rc < 0)
goto test_fail;
rc = test_ring_burst_bulk_tests3(
- TEST_RING_THREAD_DEF | j,
+ TEST_RING_THREAD_DEF | j, 8,
test_sync_modes[i].create_flags,
test_sync_modes[i].name);
if (rc < 0)
goto test_fail;
- rc = test_ring_burst_bulk_tests3(
- TEST_RING_THREAD_DEF | j,
+ rc = test_ring_burst_bulk_tests4(
+ TEST_RING_THREAD_DEF | j, 16,
test_sync_modes[i].create_flags,
test_sync_modes[i].name);
if (rc < 0)
--
2.17.1
next reply other threads:[~2020-04-30 1:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-30 1:56 Honnappa Nagarahalli [this message]
2020-04-30 10:23 ` Thomas Monjalon
2020-06-16 12:47 ` Thomas Monjalon
2020-06-25 8:19 ` David Marchand
2020-06-25 11:05 ` Ananyev, Konstantin
2020-07-02 20:42 ` Honnappa Nagarahalli
2020-04-30 12:55 ` Aaron Conole
2020-04-30 16:03 ` Honnappa Nagarahalli
2020-04-30 17:01 ` Aaron Conole
2020-04-30 19:51 ` Honnappa Nagarahalli
2020-05-01 12:56 ` Aaron Conole
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200430015650.18243-1-honnappa.nagarahalli@arm.com \
--to=honnappa.nagarahalli@arm.com \
--cc=aconole@redhat.com \
--cc=dev@dpdk.org \
--cc=konstantin.ananyev@intel.com \
--cc=nd@arm.com \
--cc=ruifeng.wang@arm.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).