Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/129613/?format=api
http://patches.dpdk.org/api/patches/129613/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230718024006.2154-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": "<20230718024006.2154-3-fengchengwen@huawei.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20230718024006.2154-3-fengchengwen@huawei.com", "date": "2023-07-18T02:40:02", "name": "[v17,2/6] test/memarea: support memarea test", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "f41d71829c52e97d57519b7b0e635682b62865cf", "submitter": { "id": 2146, "url": "http://patches.dpdk.org/api/people/2146/?format=api", "name": "fengchengwen", "email": "fengchengwen@huawei.com" }, "delegate": null, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20230718024006.2154-3-fengchengwen@huawei.com/mbox/", "series": [ { "id": 28961, "url": "http://patches.dpdk.org/api/series/28961/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=28961", "date": "2023-07-18T02:40:06", "name": "introduce memarea library", "version": 17, "mbox": "http://patches.dpdk.org/series/28961/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/129613/comments/", "check": "warning", "checks": "http://patches.dpdk.org/api/patches/129613/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 09F3B42EA1;\n\tTue, 18 Jul 2023 04:49:02 +0200 (CEST)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id DCB6A42D4E;\n\tTue, 18 Jul 2023 04:48:30 +0200 (CEST)", "from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188])\n by mails.dpdk.org (Postfix) with ESMTP id D8BCA406B3\n for <dev@dpdk.org>; Tue, 18 Jul 2023 04:48:21 +0200 (CEST)", "from dggpeml100024.china.huawei.com (unknown [172.30.72.55])\n by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R4jwV66KRzNmTF;\n Tue, 18 Jul 2023 10:44:58 +0800 (CST)", "from localhost.localdomain (10.50.163.32) by\n dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2507.27; Tue, 18 Jul 2023 10:48:18 +0800" ], "From": "Chengwen Feng <fengchengwen@huawei.com>", "To": "<thomas@monjalon.net>, <david.marchand@redhat.com>", "CC": "<dev@dpdk.org>, <mb@smartsharesystems.com>, <anatoly.burakov@intel.com>,\n <dmitry.kozliuk@gmail.com>, <jerinjacobk@gmail.com>, <hofors@lysator.liu.se>,\n <stephen@networkplumber.org>", "Subject": "[PATCH v17 2/6] test/memarea: support memarea test", "Date": "Tue, 18 Jul 2023 02:40:02 +0000", "Message-ID": "<20230718024006.2154-3-fengchengwen@huawei.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20230718024006.2154-1-fengchengwen@huawei.com>", "References": "<20220721044648.6817-1-fengchengwen@huawei.com>\n <20230718024006.2154-1-fengchengwen@huawei.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"UTF-8\"", "Content-Transfer-Encoding": "8bit", "X-Originating-IP": "[10.50.163.32]", "X-ClientProxiedBy": "dggems705-chm.china.huawei.com (10.3.19.182) To\n dggpeml100024.china.huawei.com (7.185.36.115)", "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>\nReviewed-by: Dongdong Liu <liudongdong3@huawei.com>\nAcked-by: Morten Brørup <mb@smartsharesystems.com>\nAcked-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n MAINTAINERS | 1 +\n app/test/meson.build | 2 +\n app/test/test_memarea.c | 139 ++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 142 insertions(+)\n create mode 100644 app/test/test_memarea.c", "diff": "diff --git a/MAINTAINERS b/MAINTAINERS\nindex 9ca665219b..b9b9ed2932 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -1617,6 +1617,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 b89cf0368f..0d9701d8c6 100644\n--- a/app/test/meson.build\n+++ b/app/test/meson.build\n@@ -83,6 +83,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@@ -201,6 +202,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..a2191eb0eb\n--- /dev/null\n+++ b/app/test/test_memarea.c\n@@ -0,0 +1,139 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2023 HiSilicon Limited\n+ */\n+\n+#include <stdio.h>\n+#include <string.h>\n+\n+#include <rte_errno.h>\n+#include <rte_memory.h>\n+#include <rte_memarea.h>\n+\n+#include \"test.h\"\n+\n+#define MEMAREA_TEST_DEFAULT_SIZE\t0x1000\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\", \"autotest\");\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+\tTEST_ASSERT(ma == NULL, \"Expected NULL\");\n+\tTEST_ASSERT(rte_errno == EINVAL, \"Expected EINVAL\");\n+\n+\t/* test for invalid name */\n+\tmemset(&init, 0, sizeof(init));\n+\tma = rte_memarea_create(&init);\n+\tTEST_ASSERT(ma == NULL, \"Expected NULL\");\n+\tTEST_ASSERT(rte_errno == EINVAL, \"Expected EINVAL\");\n+\tmemset(&init.name, 1, sizeof(init.name));\n+\tma = rte_memarea_create(&init);\n+\tTEST_ASSERT(ma == NULL, \"Expected NULL\");\n+\tTEST_ASSERT(rte_errno == EINVAL, \"Expected EINVAL\");\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+\tTEST_ASSERT(ma == NULL, \"Expected NULL\");\n+\tTEST_ASSERT(rte_errno == EINVAL, \"Expected EINVAL\");\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+\tTEST_ASSERT(ma == NULL, \"Expected NULL\");\n+\tTEST_ASSERT(rte_errno == EINVAL, \"Expected EINVAL\");\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+\tTEST_ASSERT(ma == NULL, \"Expected NULL\");\n+\tTEST_ASSERT(rte_errno == EINVAL, \"Expected EINVAL\");\n+\n+\t/* test for algorithm invalid */\n+\ttest_memarea_init_param(&init);\n+\tinit.alg = RTE_MEMAREA_ALGORITHM_NEXTFIT + 1;\n+\tma = rte_memarea_create(&init);\n+\tTEST_ASSERT(ma == NULL, \"Expected NULL\");\n+\tTEST_ASSERT(rte_errno == EINVAL, \"Expected EINVAL\");\n+\n+\t/* test for reserved field */\n+\ttest_memarea_init_param(&init);\n+\tinit.reserved_bits = 1;\n+\tma = rte_memarea_create(&init);\n+\tTEST_ASSERT(ma == NULL, \"Expected NULL\");\n+\tTEST_ASSERT(rte_errno == EINVAL, \"Expected EINVAL\");\n+\ttest_memarea_init_param(&init);\n+\tinit.reserved_64s[0] = 1;\n+\tma = rte_memarea_create(&init);\n+\tTEST_ASSERT(ma == NULL, \"Expected NULL\");\n+\tTEST_ASSERT(rte_errno == EINVAL, \"Expected EINVAL\");\n+\ttest_memarea_init_param(&init);\n+\tinit.reserved_64s[1] = 1;\n+\tma = rte_memarea_create(&init);\n+\tTEST_ASSERT(ma == NULL, \"Expected NULL\");\n+\tTEST_ASSERT(rte_errno == EINVAL, \"Expected EINVAL\");\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+static int\n+test_memarea_create_destroy(void)\n+{\n+\tstruct rte_memarea *ma;\n+\tstruct rte_memarea_param init;\n+\n+\trte_errno = 0;\n+\n+\t/* test for create with HEAP */\n+\ttest_memarea_init_param(&init);\n+\tinit.source = RTE_MEMAREA_SOURCE_HEAP;\n+\tinit.heap.socket_id = SOCKET_ID_ANY;\n+\tma = rte_memarea_create(&init);\n+\tTEST_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+\tTEST_ASSERT(ma != NULL, \"Expected Non-NULL\");\n+\trte_memarea_destroy(ma);\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+static struct unit_test_suite memarea_test_suite = {\n+\t.suite_name = \"Memarea Unit Test Suite\",\n+\t.setup = NULL,\n+\t.teardown = NULL,\n+\t.unit_test_cases = {\n+\t\tTEST_CASE(test_memarea_create_bad_param),\n+\t\tTEST_CASE(test_memarea_create_destroy),\n+\n+\t\tTEST_CASES_END() /**< NULL terminate unit test array */\n+\t}\n+};\n+\n+static int\n+test_memarea(void)\n+{\n+\treturn unit_test_suite_runner(&memarea_test_suite);\n+}\n+\n+REGISTER_TEST_COMMAND(memarea_autotest, test_memarea);\n", "prefixes": [ "v17", "2/6" ] }{ "id": 129613, "url": "