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 35344A0542; Wed, 5 Oct 2022 06:11:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7DBE142B8D; Wed, 5 Oct 2022 06:10:14 +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 C967242B84 for ; Wed, 5 Oct 2022 06:10:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1664943006; bh=1K/8Rt7vdqUS1PyVSUzU7CnydL6bqe3VgI77Oh1k5Ec=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=EqPeI8L8ndzdybXKjWPTAR7wIyWHGdJJnO8YUFCia9Y66AlKzejlwpay4/WGrXoTT MAY1etOX8TWk2oSkoNWcBGk/FFrlTa/4aj0Iw04seHmgq2gYJBbh4rcmhkx5GWJosj k4c1UpdcMfDl8N4gx34RdPxXa2TEjIX59C/2bbPs= 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: xmsmtpt1664943005tbj7dqm8i Message-ID: X-QQ-XMAILINFO: OKkKo7I1HxIeIqtRWF7IKBC1gGdJ+ZEwa66BK5XpSizFZgU4ogcmdJKzKs1B6j M3QFEtIOPqJQoEh15ce2KLz/7AdOvGIlmS1b9UWsA7RWlD0aJ+RE8STtlU/Y/hKUb7E2E3oIBcUW gqO/BYhZC65llkWDCaWhrRqOYJDktxMIxiogbArlQBuzzFQ9h5+Zg/jflS1pNL6g3aa75pgcfn4h Ay88GXBWG1z5O4+SyQvNhFiJw3+q9nHgdRyhdtydKgmikZ1RZpVvE7GJYJSClZaf26Hx1Og8lK6G aH1VgvmvVbRQQ3tsIXGvJRa5vLHGE5Dmly5L22dM2odALw/4S0JL+fpM4wWSdxlhXRdOMsDBECht OkkKgaot6WYk7pYE/8kIyhh9xBiTD7e5b8hxOJiJYQ9kOwMi5b/dDK0W7S1nicMMY53v0iM2tH/a VRErP5ElrOwFynJicoWPpqSkuIrL+2caCJ5zGK+gYMu7jzY0LNBNW2Ey+X1E4tVPxmIKdKmTQvdd hOJJCo20UihmToNhS0N4nl9DrMNSWNphaErJdzE8XRscUuspgmM+74Y8Q+r4KV+UjTuUBmjl0gGN sJmWEln926RjXEkM1SONUtSrMD1uRd307mgYfRfsdSOl4l3X2/s0SJqjD/BA7x0PD1bWZ9TuD073 uyfPWruTgzh8VXlTZyzisZ1u28vzI9oEyNzUzDLF6AkxK7ko8YBcO1Qu/vLwHRuTRYeM2p21NGBM hox+yMUMjNTPDZKBvQkgJe+bivdeyzf/piLc1qLEEgqV8u0A5I86DyVmH+4O8cHHIXvnnU0WPJaE MGeNxQcxBntmgopjayKpX5bYO/AQeGHCPA+g/Ef91N3vvPwjT+j/llppf7yjssm0bTAvP4jVvx/8 c4T9lmMbMlvFG/kivaiadZPA+eiaFybXxHXk9mtQk6Afgo/1Lq2BSXorOTQb8Kis5Offe4bCnDiM oJn97F2SX3wnEMwNUpovuHft4hg23wBXlv2dUwju0ncdgqezZ4qUDP3BctUCjZSEvclRZ0DDUcGq 0zMEPNvOhrf0g23K0RLtlgmNnqMyk= 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 08/10] test/memarea: support backup memory test Date: Wed, 5 Oct 2022 12:09:50 +0800 X-OQ-MSGID: <20221005040952.8166-9-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 backup memory mechanism test. Signed-off-by: Chengwen Feng --- app/test/test_memarea.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/app/test/test_memarea.c b/app/test/test_memarea.c index ab360f0265..ec3475c354 100644 --- a/app/test/test_memarea.c +++ b/app/test/test_memarea.c @@ -313,6 +313,46 @@ test_memarea_dump(void) return 0; } +static int +test_memarea_backup(void) +{ + struct rte_memarea *ma, *bak_ma; + struct rte_memarea_param init; + void *ptr; + + /* prepare env */ + test_memarea_init_def_param(&init); + strcat(init.name, "_backup"); + init.source = RTE_MEMAREA_SOURCE_SYSTEM_API; + init.total_sz = MEMAREA_TEST_DEFAULT_SIZE; + bak_ma = rte_memarea_create(&init); + RTE_TEST_ASSERT(bak_ma != NULL, "Expected Non-NULL"); + test_memarea_init_def_param(&init); + init.source = RTE_MEMAREA_SOURCE_SYSTEM_API; + init.total_sz = MEMAREA_TEST_DEFAULT_SIZE >> 2; + init.bak_memarea = bak_ma; + ma = rte_memarea_create(&init); + RTE_TEST_ASSERT(ma != NULL, "Expected Non-NULL"); + + /* test for backup */ + ptr = rte_memarea_alloc(ma, MEMAREA_TEST_DEFAULT_SIZE >> 3, 0); + RTE_TEST_ASSERT(ptr != NULL, "Expected Non-NULL"); + ptr = rte_memarea_alloc(ma, MEMAREA_TEST_DEFAULT_SIZE >> 1, 0); + RTE_TEST_ASSERT(ptr != NULL, "Expected Non-NULL"); + (void)rte_memarea_dump(ma, stderr, true); + (void)rte_memarea_dump(bak_ma, stderr, true); + rte_memarea_free(ma, ptr); + ptr = rte_memarea_alloc(ma, MEMAREA_TEST_DEFAULT_SIZE, 0); + RTE_TEST_ASSERT(ptr == NULL, "Expected NULL"); + (void)rte_memarea_dump(ma, stderr, true); + (void)rte_memarea_dump(bak_ma, stderr, true); + + rte_memarea_destroy(ma); + rte_memarea_destroy(bak_ma); + + return 0; +} + static int test_memarea(void) { @@ -322,6 +362,7 @@ test_memarea(void) MEMAREA_TEST_API_RUN(test_memarea_free_fail); MEMAREA_TEST_API_RUN(test_memarea_alloc_free); MEMAREA_TEST_API_RUN(test_memarea_dump); + MEMAREA_TEST_API_RUN(test_memarea_backup); return 0; } -- 2.34.1