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 4BBF2A034C; Wed, 21 Sep 2022 05:19:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 760BC42825; Wed, 21 Sep 2022 05:19:16 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id C2AB1410D0 for ; Wed, 21 Sep 2022 05:19:12 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MXNqx5kBQzHpfr; Wed, 21 Sep 2022 11:17:01 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 21 Sep 2022 11:19:10 +0800 From: Chengwen Feng To: CC: , , , Subject: [PATCH v2 9/9] test/memarea: support no MT-safe test Date: Wed, 21 Sep 2022 03:12:56 +0000 Message-ID: <20220921031256.4954-10-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220921031256.4954-1-fengchengwen@huawei.com> References: <20220721044648.6817-1-fengchengwen@huawei.com> <20220921031256.4954-1-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected 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 MT-safe is enabled by default in previous test, this patch adds no MT-safe test. Signed-off-by: Chengwen Feng --- app/test/test_memarea.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/app/test/test_memarea.c b/app/test/test_memarea.c index 9609909d7c..2ab90fb5b5 100644 --- a/app/test/test_memarea.c +++ b/app/test/test_memarea.c @@ -331,6 +331,35 @@ test_memarea_backup(void) return 0; } +static int +test_memarea_no_mt_safe(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; + init.mt_safe = false; + ma = rte_memarea_create(&init); + RTE_TEST_ASSERT(ma != NULL, "Expected Non-NULL"); + + /* test for all API */ + (void)rte_memarea_alloc(ma, 1, 0); + (void)rte_memarea_alloc(ma, 1, 0); + rte_memarea_free(ma, rte_memarea_alloc(ma, 1, 0)); + rte_memarea_update_refcnt(ma, rte_memarea_alloc(ma, 1, 0), 1); + rte_memarea_update_refcnt(ma, rte_memarea_alloc(ma, 1, 0), -1); + ret = rte_memarea_dump(ma, stderr, true); + RTE_TEST_ASSERT(ret == 0, "Expected ZERO"); + + rte_memarea_destroy(ma); + + return 0; +} + static int test_memarea(void) { @@ -341,6 +370,7 @@ test_memarea(void) MEMAREA_TEST_API_RUN(test_memarea_alloc_free); MEMAREA_TEST_API_RUN(test_memarea_dump); MEMAREA_TEST_API_RUN(test_memarea_backup); + MEMAREA_TEST_API_RUN(test_memarea_no_mt_safe); return 0; } -- 2.17.1