From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3AFABA0542; Wed, 5 Oct 2022 05:39:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 121784280E; Wed, 5 Oct 2022 05:39:07 +0200 (CEST) Received: from out203-205-221-221.mail.qq.com (out203-205-221-221.mail.qq.com [203.205.221.221]) by mails.dpdk.org (Postfix) with ESMTP id E5BED40E5A for ; Wed, 5 Oct 2022 05:39:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1664941143; bh=fW26njVAFz0rUDdqhVnQ5hkZXX9syUTvUSrqKiLbUi0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=iOVFsFd7sGXGyPpvxEFPHsdqEFTfdygQp8OuojLudRdXuoZYGMEVacprh0H/ak8BK /uHMWBSibGmoN2+gLNhqxdVn2eKbBoP1mrJuUz6cFwsb3ITk3zNEPkgFUN36cHkOpm f70LfGFVQaH7paWS8BqOCBNfOGpEou1g/wIzTkUg= Received: from qq.com ([120.229.93.179]) by newxmesmtplogicsvrszc13.qq.com (NewEsmtp) with SMTP id 9B40FA58; Wed, 05 Oct 2022 11:38:52 +0800 X-QQ-mid: xmsmtpt1664941141tph3762s1 Message-ID: X-QQ-XMAILINFO: N7h1OCCDntujQdzF0ZavzbI19vLiseaeeDZVqHxhYIOJPE9gh/PwKjjgezsnfW ADkOdIFwAwKv1WPBu2D36PugfJcxzpLvl+ADt3CCib27SZ53NKSZYAnDURkslQmbTBrSmNkEe2Wx ibKR/udYFj2h9rPY961RiRJ3NAEDgVKCoyD2jzaTaFMmj51SCeDYDNPi90WvL3+jBlRAF8694MSz NNQ1n28jQNkWje/5FEDMyIe2RfYtKQkUeoRlTIaumC0hmRit7O6ppekoUH/i3pmGfKfIK1JAMfZ0 YNcwPu8aqE9C6+bklm8g9/+wNK2JEpXTylEuREovdPkILieOH9kRrbMZgsDAX/e0vH1bx5BbXJSi op89g0gXYolxXLSGnIveiAFQ+eaKLVB2ROLqEYUnnBUBxA96PpVr6iVe4Renz4rqnlpfwvNEzjdj ZfSgLSO7NJKWFSoJTue9/OuS+nSVKjbjwZpLwze11SzLs4lKQ0SnXS0NTYqhM00z6C2o+XRgXFag RrvY1fx1HN7W3J7BkYzUzN4sKMM25lnSZsT2BKVSXXomIP7Y/Dxqa+NOmZ8OvAMy8Stgy4dAKJfw EMxUuQ43SnqwRyXyBJQhfP7DDFjqvrAUDCx1i/Cct4WILd9TPTM06cxQvSkdmpjNuh6oz2jxN/+b yddapnWpbeD+E/9D8UkVZVvZmkMbpecBy21QcfaMyukXAOnegJewyXbECDoPw+Ze3UQHlM3XCZlA nmPV0TFZEcEq7QAFMwTYt749pmg3bvd0378hUOUosbm4Ln/6yEa/JQrjPafEFeQBhPvJBIOiWopA 0RNgs0eOh3zxlTB0nBEwWo9pJNV9r2Qb6AUyhe9G8Vuz8iprcZADW79/beDw8L5Aqs2uHc7W58at r+agWYmUVtylA0tzRyKOqxSrNm1naimf+TZdd1jH0TY3CMVt7uCYmNsG8e5enPEWQd+Rk9uyGKIG LQMCmODMW2E8nNdEdskw== From: datshan To: david.marchand@redhat.com, mb@smartsharesystems.com, anatoly.burakov@intel.com, dmitry.kozliuk@gmail.com, jerinjacobk@gmail.com Cc: thomas@monjalon.net, dev@dpdk.org, Chengwen Feng Subject: [PATCH v4 06/10] test/memarea: support dump test Date: Wed, 5 Oct 2022 11:38:44 +0800 X-OQ-MSGID: <20221005033848.2241-7-datshan@qq.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221005033848.2241-1-datshan@qq.com> References: <20220721044648.6817-1-fengchengwen@huawei.com> <20221005033848.2241-1-datshan@qq.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Chengwen Feng This patch supports rte_memarea_dump() test. Signed-off-by: Chengwen Feng --- app/test/test_memarea.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/app/test/test_memarea.c b/app/test/test_memarea.c index 0a54ede4c1..ab360f0265 100644 --- a/app/test/test_memarea.c +++ b/app/test/test_memarea.c @@ -274,7 +274,39 @@ test_memarea_alloc_free(void) rte_memarea_free(ma, ptr[5]); /* test free NULL */ - rte_memarea_free(ma, ptr[6]); + rte_memarea_free(ma, NULL); + + rte_memarea_destroy(ma); + + return 0; +} + +static int +test_memarea_dump(void) +{ + struct rte_memarea_param init; + struct rte_memarea *ma; + int ret; + + /* prepare env */ + test_memarea_init_def_param(&init); + init.source = RTE_MEMAREA_SOURCE_SYSTEM_API; + init.total_sz = MEMAREA_TEST_DEFAULT_SIZE; + ma = rte_memarea_create(&init); + RTE_TEST_ASSERT(ma != NULL, "Expected Non-NULL"); + + /* test for invalid parameters */ + ret = rte_memarea_dump(NULL, stderr, false); + RTE_TEST_ASSERT(ret == -EINVAL, "Expected EINVAL"); + ret = rte_memarea_dump(ma, NULL, false); + RTE_TEST_ASSERT(ret == -EINVAL, "Expected EINVAL"); + + /* test for dump */ + (void)rte_memarea_alloc(ma, 1, 0); + (void)rte_memarea_alloc(ma, 1, 0); + (void)rte_memarea_alloc(ma, 1, 0); + ret = rte_memarea_dump(ma, stderr, true); + RTE_TEST_ASSERT(ret == 0, "Expected ZERO"); rte_memarea_destroy(ma); @@ -289,6 +321,7 @@ test_memarea(void) MEMAREA_TEST_API_RUN(test_memarea_alloc_fail); MEMAREA_TEST_API_RUN(test_memarea_free_fail); MEMAREA_TEST_API_RUN(test_memarea_alloc_free); + MEMAREA_TEST_API_RUN(test_memarea_dump); return 0; } -- 2.34.1