From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 07A04A04B7; Sun, 20 Sep 2020 13:49:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 214061D9E6; Sun, 20 Sep 2020 13:49:22 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id B21E01D9FA for ; Sun, 20 Sep 2020 13:49:20 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 361C8D6E; Sun, 20 Sep 2020 04:49:20 -0700 (PDT) Received: from net-arm-n1sdp.shanghai.arm.com (net-arm-n1sdp.shanghai.arm.com [10.169.208.213]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5086D3F68F; Sun, 20 Sep 2020 04:49:18 -0700 (PDT) From: Feifei Wang To: Honnappa Nagarahalli , Konstantin Ananyev Cc: dev@dpdk.org, nd@arm.com, Feifei Wang Date: Sun, 20 Sep 2020 06:48:54 -0500 Message-Id: <20200920114856.20697-6-feifei.wang2@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200920114856.20697-1-feifei.wang2@arm.com> References: <20200729063105.11299-1-feifei.wang2@arm.com> <20200920114856.20697-1-feifei.wang2@arm.com> Subject: [dpdk-dev] [PATCH v6 5/7] test/ring: validate the return value of enq/deq elements X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Validate the return value of single element enqueue/dequeue operation in the test. Suggested-by: Honnappa Nagarahalli Signed-off-by: Feifei Wang Reviewed-by: Phil Yang Reviewed-by: Honnappa Nagarahalli --- app/test/test_ring.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/app/test/test_ring.c b/app/test/test_ring.c index c9017793a..da57032c7 100644 --- a/app/test/test_ring.c +++ b/app/test/test_ring.c @@ -834,8 +834,13 @@ test_ring_basic_ex(void) rte_ring_free_count(rp)); for (j = 0; j < RING_SIZE - 1; j++) { - test_ring_enqueue(rp, cur_src, esize[i], 1, + ret = test_ring_enqueue(rp, cur_src, esize[i], 1, TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE); + if (ret != 0) { + printf("%s: rte_ring_enqueue fails\n", + __func__); + goto fail_test; + } cur_src = test_ring_inc_ptr(cur_src, esize[i], 1); } @@ -846,8 +851,13 @@ test_ring_basic_ex(void) } for (j = 0; j < RING_SIZE - 1; j++) { - test_ring_dequeue(rp, cur_dst, esize[i], 1, + ret = test_ring_dequeue(rp, cur_dst, esize[i], 1, TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE); + if (ret != 0) { + printf("%s: rte_ring_dequeue fails\n", + __func__); + goto fail_test; + } cur_dst = test_ring_inc_ptr(cur_dst, esize[i], 1); } @@ -1001,10 +1011,18 @@ test_ring_with_exact_size(void) * than the standard ring. (16 vs 15 elements) */ for (j = 0; j < ring_sz - 1; j++) { - test_ring_enqueue(std_r, cur_src, esize[i], 1, + ret = test_ring_enqueue(std_r, cur_src, esize[i], 1, TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE); - test_ring_enqueue(exact_sz_r, cur_src, esize[i], 1, + if (ret != 0) { + printf("%s: error, enqueue failed\n", __func__); + goto test_fail; + } + ret = test_ring_enqueue(exact_sz_r, cur_src, esize[i], 1, TEST_RING_THREAD_DEF | TEST_RING_ELEM_SINGLE); + if (ret != 0) { + printf("%s: error, enqueue failed\n", __func__); + goto test_fail; + } cur_src = test_ring_inc_ptr(cur_src, esize[i], 1); } ret = test_ring_enqueue(std_r, cur_src, esize[i], 1, -- 2.17.1