diff mbox series

[v4,10/10] test/memarea: support no MT-safe test

Message ID tencent_ACE6F97FB9DF6B0310473F81ECF76DC7A606@qq.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series [v4,01/10] memarea: introduce memarea library | expand

Checks

Context Check Description
ci/iol-x86_64-unit-testing fail Testing issues
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

datshan Oct. 5, 2022, 3:38 a.m. UTC
From: Chengwen Feng <fengchengwen@huawei.com>

MT-safe is enabled by default in previous test, this patch adds no
MT-safe test.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
 app/test/test_memarea.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
diff mbox series

Patch

diff --git a/app/test/test_memarea.c b/app/test/test_memarea.c
index ec3475c354..b4012086fc 100644
--- a/app/test/test_memarea.c
+++ b/app/test/test_memarea.c
@@ -353,6 +353,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)
 {
@@ -363,6 +392,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;
 }