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 1DEA7A0542; Wed, 5 Oct 2022 06:10:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C465D42B7C; Wed, 5 Oct 2022 06:10:12 +0200 (CEST) Received: from out162-62-58-211.mail.qq.com (out162-62-58-211.mail.qq.com [162.62.58.211]) by mails.dpdk.org (Postfix) with ESMTP id 469A542B82 for ; Wed, 5 Oct 2022 06:10:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1664943004; bh=fW26njVAFz0rUDdqhVnQ5hkZXX9syUTvUSrqKiLbUi0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=qmpb4IeALCOtYCUlClhvwAgTIkFKoIg5d3+zJ6JiS2jasRyHS+4zdThhkwSa91/k9 WB0mld79YZ9o4s2PoDaklQbyw4+4+xWv6RrODx5h2cWQq4QWlSMsPywo+OsVCDgLuV V9hIxf6qvJgsXnPr4DWKqfFw3Hpiu1woq4E1T9Ng= Received: from qq.com ([120.229.93.179]) by newxmesmtplogicsvrsza31.qq.com (NewEsmtp) with SMTP id 27598E97; Wed, 05 Oct 2022 12:09:53 +0800 X-QQ-mid: xmsmtpt1664943002tf3y39zrj Message-ID: X-QQ-XMAILINFO: N7h1OCCDntujQdzF0ZavzbLseEL/P4vDFSTbxVLt83vqRrxu/oZbWTn3dR0WPt aEO+hITXjRVcQLenFQNbmkgEi7WTd/IxBmcSgOGIdsbK1MWWcnkMvOdzOdUTCs6Zm155I/OjgUrb 3WNXoMS162+NZuhUBOOK+F7ubhkBq4IbXf5DvoPYulWmSx5FN1kzTJttUEgZ7cGUPro9P1h9tRNP TiBoziWJnpxVtXoiFNTWmOvnvsjjzxDzxgfH5OVUUp+R81KHV9kM0pHwQoGL+pBa3o41PnytlAta XLAMVmurUwGOazzxlogEgssrdqWHypxS16nfKXHaAILey7WcdJYGPxfqiERXnm+GeyFVKeUhlHr4 3GgtXArxK9KZInBDhKnlb/SJ3xmRV3SedC9CwMfs6MxA4QJBV8S4z3QY4uNAP12q3ITYIzRpClYj 7bZsQsZSHV/HdbJtlBYxiDc3rL9AucpT+/o7Fif4RcOzPjTUzZghblZVp/YC20+RerXHA5Q7LE12 OQyrz826K0rm3gHM8HarqSH0wnHAKPtpllEVd6yjLFdpWnM/k5ig8d3ypn9JWGS/oKOTwJfwPdZo FBKcgeFgwIhY4xqYLAJxzmwtYA1aQoltpmhdpCLVKejUIkU9UCdW5fRv7PwkIi9JHK0nxGof/i9F sOgDRHKA8ekUrCQtuCto8WBYeunVdYe1ioMABDAZCnqRxfY7ZEVYKygJ+mBlQGnqzV8jHIvO0Hhe IIJBq97Iolt6corCO2qWQ/xuaNKmPcNhV0sZpz6Uf9D8TdW2SxXEj3h+JE4j/EDRO68ZaLOxdmWu Sz40g6Vb4/FbRb2xgnLmdjg+RDnUO0QBYA3BPo05z3neraZRRdSFixkUKES0TrDEXum5b4g7nDRl bHBSspsYpZ1gMlNIIQHY0rOoz0Z0yoe4TaCzbGWXSKyrIWiCb8DlrpRICBnDVygOsPlP+4QDrtF3 s/bJJSotePqHrV2eLOvh+Pzhqam14JM8Epl8uxYXC7ZeMdsgMUPZrX4K3HkrO2F1yGNXKZRfJ480 PCuaFvnA== 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 v5 06/10] test/memarea: support dump test Date: Wed, 5 Oct 2022 12:09:48 +0800 X-OQ-MSGID: <20221005040952.8166-7-datshan@qq.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221005040952.8166-1-datshan@qq.com> References: <20220721044648.6817-1-fengchengwen@huawei.com> <20221005040952.8166-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