Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/118044/?format=api
http://patches.dpdk.org/api/patches/118044/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20221012104805.44185-3-fengchengwen@huawei.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20221012104805.44185-3-fengchengwen@huawei.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20221012104805.44185-3-fengchengwen@huawei.com", "date": "2022-10-12T10:48:00", "name": "[v9,2/7] test/memarea: support memarea test", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "709dc1fdae5310e39a3ef7faab9ce5430d226ef1", "submitter": { "id": 2146, "url": "http://patches.dpdk.org/api/people/2146/?format=api", "name": "fengchengwen", "email": "fengchengwen@huawei.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20221012104805.44185-3-fengchengwen@huawei.com/mbox/", "series": [ { "id": 25175, "url": "http://patches.dpdk.org/api/series/25175/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=25175", "date": "2022-10-12T10:47:58", "name": "introduce memarea library", "version": 9, "mbox": "http://patches.dpdk.org/series/25175/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/118044/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/118044/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id B8F7DA00C4;\n\tWed, 12 Oct 2022 12:54:02 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 6812743018;\n\tWed, 12 Oct 2022 12:53:54 +0200 (CEST)", "from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188])\n by mails.dpdk.org (Postfix) with ESMTP id 1009943008\n for <dev@dpdk.org>; Wed, 12 Oct 2022 12:53:51 +0200 (CEST)", "from dggpeml500024.china.huawei.com (unknown [172.30.72.53])\n by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MnTtB3bcRzVhtF;\n Wed, 12 Oct 2022 18:49:22 +0800 (CST)", "from localhost.localdomain (10.67.165.24) by\n dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2375.31; Wed, 12 Oct 2022 18:53:49 +0800" ], "From": "Chengwen Feng <fengchengwen@huawei.com>", "To": "<david.marchand@redhat.com>, <mb@smartsharesystems.com>,\n <anatoly.burakov@intel.com>, <dmitry.kozliuk@gmail.com>,\n <jerinjacobk@gmail.com>, <hofors@lysator.liu.se>", "CC": "<thomas@monjalon.net>, <dev@dpdk.org>", "Subject": "[PATCH v9 2/7] test/memarea: support memarea test", "Date": "Wed, 12 Oct 2022 10:48:00 +0000", "Message-ID": "<20221012104805.44185-3-fengchengwen@huawei.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20221012104805.44185-1-fengchengwen@huawei.com>", "References": "<20220721044648.6817-1-fengchengwen@huawei.com>\n <20221012104805.44185-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\n 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 <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "This patch supports memarea test of rte_memarea_create() and\nrte_memarea_destroy() API.\n\nSigned-off-by: Chengwen Feng <fengchengwen@huawei.com>\n---\n MAINTAINERS | 1 +\n app/test/meson.build | 2 +\n app/test/test_memarea.c | 142 ++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 145 insertions(+)\n create mode 100644 app/test/test_memarea.c", "diff": "diff --git a/MAINTAINERS b/MAINTAINERS\nindex 3d8d4c2dbe..38625ae1be 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -1555,6 +1555,7 @@ Memarea - EXPERIMENTAL\n M: Chengwen Feng <fengchengwen@huawei.com>\n F: lib/memarea\n F: doc/guides/prog_guide/memarea_lib.rst\n+F: app/test/test_memarea*\n \n Membership - EXPERIMENTAL\n M: Yipeng Wang <yipeng1.wang@intel.com>\ndiff --git a/app/test/meson.build b/app/test/meson.build\nindex 396b133959..8943f24668 100644\n--- a/app/test/meson.build\n+++ b/app/test/meson.build\n@@ -84,6 +84,7 @@ test_sources = files(\n 'test_malloc.c',\n 'test_malloc_perf.c',\n 'test_mbuf.c',\n+ 'test_memarea.c',\n 'test_member.c',\n 'test_member_perf.c',\n 'test_memcpy.c',\n@@ -200,6 +201,7 @@ fast_tests = [\n ['malloc_autotest', false, true],\n ['mbuf_autotest', false, true],\n ['mcslock_autotest', false, true],\n+ ['memarea_autotest', true, true],\n ['memcpy_autotest', true, true],\n ['memory_autotest', false, true],\n ['mempool_autotest', false, true],\ndiff --git a/app/test/test_memarea.c b/app/test/test_memarea.c\nnew file mode 100644\nindex 0000000000..b25af1880a\n--- /dev/null\n+++ b/app/test/test_memarea.c\n@@ -0,0 +1,142 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2022 HiSilicon Limited\n+ */\n+\n+#include <stdio.h>\n+#include <string.h>\n+\n+#include \"test.h\"\n+\n+#ifdef RTE_EXEC_ENV_WINDOWS\n+static int\n+test_memarea(void)\n+{\n+\tprintf(\"memarea not supported on Windows, skipping test\\n\");\n+\treturn TEST_SKIPPED;\n+}\n+\n+#else\n+\n+#include <rte_memory.h>\n+#include <rte_memarea.h>\n+\n+#define MEMAREA_TEST_DEFAULT_SIZE\t0x1000\n+\n+#define MEMAREA_TEST_API_RUN(test_func) \\\n+\tdo { \\\n+\t\tint ret = test_func(); \\\n+\t\tif (ret < 0) { \\\n+\t\t\tprintf(\"%s Failed\\n\", #test_func); \\\n+\t\t\tfails++; \\\n+\t\t} else { \\\n+\t\t\tprintf(\"%s Passed\\n\", #test_func); \\\n+\t\t} \\\n+\t} while (0)\n+\n+static int fails;\n+\n+static void\n+test_memarea_prepare(void)\n+{\n+\tfails = 0;\n+}\n+\n+static int\n+test_memarea_retcode(void)\n+{\n+\treturn fails > 0 ? -1 : 0;\n+}\n+\n+static void\n+test_memarea_init_param(struct rte_memarea_param *init)\n+{\n+\tmemset(init, 0, sizeof(struct rte_memarea_param));\n+\tsprintf(init->name, \"%s\", \"test-memarea\");\n+\tinit->source = RTE_MEMAREA_SOURCE_LIBC;\n+\tinit->total_sz = MEMAREA_TEST_DEFAULT_SIZE;\n+\tinit->mt_safe = 1;\n+}\n+\n+static int\n+test_memarea_create_bad_param(void)\n+{\n+\tstruct rte_memarea_param init;\n+\tstruct rte_memarea *ma;\n+\n+\t/* test for NULL */\n+\tma = rte_memarea_create(NULL);\n+\tRTE_TEST_ASSERT(ma == NULL, \"Expected NULL\");\n+\n+\t/* test for invalid name */\n+\tmemset(&init, 0, sizeof(init));\n+\tma = rte_memarea_create(&init);\n+\tRTE_TEST_ASSERT(ma == NULL, \"Expected NULL\");\n+\tmemset(&init.name, 1, sizeof(init.name));\n+\tma = rte_memarea_create(&init);\n+\tRTE_TEST_ASSERT(ma == NULL, \"Expected NULL\");\n+\n+\t/* test for invalid source */\n+\ttest_memarea_init_param(&init);\n+\tinit.source = RTE_MEMAREA_SOURCE_MEMAREA + 1;\n+\tma = rte_memarea_create(&init);\n+\tRTE_TEST_ASSERT(ma == NULL, \"Expected NULL\");\n+\n+\t/* test for total_sz */\n+\ttest_memarea_init_param(&init);\n+\tinit.total_sz = 0;\n+\tma = rte_memarea_create(&init);\n+\tRTE_TEST_ASSERT(ma == NULL, \"Expected NULL\");\n+\n+\t/* test for memarea NULL */\n+\ttest_memarea_init_param(&init);\n+\tinit.source = RTE_MEMAREA_SOURCE_MEMAREA;\n+\tma = rte_memarea_create(&init);\n+\tRTE_TEST_ASSERT(ma == NULL, \"Expected NULL\");\n+\n+\t/* test for alg invalid */\n+\ttest_memarea_init_param(&init);\n+\tinit.alg = RTE_MEMAREA_ALG_NEXTFIT + 1;\n+\tma = rte_memarea_create(&init);\n+\tRTE_TEST_ASSERT(ma == NULL, \"Expected NULL\");\n+\n+\treturn 0;\n+}\n+\n+static int\n+test_memarea_create_destroy(void)\n+{\n+\tstruct rte_memarea_param init;\n+\tstruct rte_memarea *ma;\n+\n+\t/* test for create with HEAP */\n+\ttest_memarea_init_param(&init);\n+\tinit.source = RTE_MEMAREA_SOURCE_HEAP;\n+\tinit.numa_socket = SOCKET_ID_ANY;\n+\tma = rte_memarea_create(&init);\n+\tRTE_TEST_ASSERT(ma != NULL, \"Expected Non-NULL\");\n+\trte_memarea_destroy(ma);\n+\n+\t/* test for create with LIBC */\n+\ttest_memarea_init_param(&init);\n+\tinit.source = RTE_MEMAREA_SOURCE_LIBC;\n+\tma = rte_memarea_create(&init);\n+\tRTE_TEST_ASSERT(ma != NULL, \"Expected Non-NULL\");\n+\trte_memarea_destroy(ma);\n+\n+\treturn 0;\n+}\n+\n+static int\n+test_memarea(void)\n+{\n+\ttest_memarea_prepare();\n+\n+\tMEMAREA_TEST_API_RUN(test_memarea_create_bad_param);\n+\tMEMAREA_TEST_API_RUN(test_memarea_create_destroy);\n+\n+\treturn test_memarea_retcode();\n+}\n+\n+#endif /* !RTE_EXEC_ENV_WINDOWS */\n+\n+REGISTER_TEST_COMMAND(memarea_autotest, test_memarea);\n", "prefixes": [ "v9", "2/7" ] }{ "id": 118044, "url": "