Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/96576/?format=api
http://patchwork.dpdk.org/api/patches/96576/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/6fc65455ac6cdbc1bdb4691a2c743d2889efde89.1627967359.git.gmuthukrishn@marvell.com/", "project": { "id": 1, "url": "http://patchwork.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": "<6fc65455ac6cdbc1bdb4691a2c743d2889efde89.1627967359.git.gmuthukrishn@marvell.com>", "list_archive_url": "https://inbox.dpdk.org/dev/6fc65455ac6cdbc1bdb4691a2c743d2889efde89.1627967359.git.gmuthukrishn@marvell.com", "date": "2021-08-03T08:05:45", "name": "[v3,2/3] test/telemetry: add unit tests for pointer value", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "e24ced0b6c1f2387abe832b64f21c3a6733c54c5", "submitter": { "id": 2301, "url": "http://patchwork.dpdk.org/api/people/2301/?format=api", "name": "Gowrishankar Muthukrishnan", "email": "gmuthukrishn@marvell.com" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/6fc65455ac6cdbc1bdb4691a2c743d2889efde89.1627967359.git.gmuthukrishn@marvell.com/mbox/", "series": [ { "id": 18157, "url": "http://patchwork.dpdk.org/api/series/18157/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=18157", "date": "2021-08-03T08:05:43", "name": "common/cnxk: enable npa telemetry", "version": 3, "mbox": "http://patchwork.dpdk.org/series/18157/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/96576/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/96576/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 AC404A0C41;\n\tTue, 3 Aug 2021 10:06:08 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id D896C411AD;\n\tTue, 3 Aug 2021 10:06:01 +0200 (CEST)", "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174])\n by mails.dpdk.org (Postfix) with ESMTP id 0D829411BE\n for <dev@dpdk.org>; Tue, 3 Aug 2021 10:05:59 +0200 (CEST)", "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id\n 173818EG013720; Tue, 3 Aug 2021 01:05:59 -0700", "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0a-0016f401.pphosted.com with ESMTP id 3a6sfu9eb5-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Tue, 03 Aug 2021 01:05:59 -0700", "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18;\n Tue, 3 Aug 2021 01:05:57 -0700", "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend\n Transport; Tue, 3 Aug 2021 01:05:57 -0700", "from localhost.localdomain (unknown [10.28.34.38])\n by maili.marvell.com (Postfix) with ESMTP id 01BD95B6944;\n Tue, 3 Aug 2021 01:05:54 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-transfer-encoding : content-type; s=pfpt0220;\n bh=kMWbBNxH5HnOTeWycfDu8I2QFch0wA/xanrsUbMdyzc=;\n b=hAUP+Ew26GGO0ZGyyEtn9xZh4trzmNB7b1AGt7jR+mc10Nwg8SeCvTXw2+sOKILDgV4r\n 1VDreSEu8UkFIsktezeRXkYvDOsxh5Mw1Wtg5LVYG8L+Lat71mENSL4kQxU5bpm85sEb\n iVjydgqhSKJtcSOSUvl+FjlJ0wyTzF2LaEMU8WU85uve5XbzDgcy7vf9+kCuursbEWI4\n koOk/D4pubIncvaAs/iwBni7hJ8NQC4IXuKmKoHa6B/M+aZamQuEXaUioRLsgnUCX7s1\n 7rmwkKTk3q19WWfsnxkZjMvmUj4Ev7a+TXcGMxwKAJF83/NtyTBQgioF7UyRj+6EG02I gA==", "From": "Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>", "To": "<dev@dpdk.org>", "CC": "<bruce.richardson@intel.com>, <ciara.power@intel.com>,\n <jerinj@marvell.com>, <kirankumark@marvell.com>,\n <ndabilpuram@marvell.com>, <skori@marvell.com>, <skoteshwar@marvell.com>,\n Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>", "Date": "Tue, 3 Aug 2021 13:35:45 +0530", "Message-ID": "\n <6fc65455ac6cdbc1bdb4691a2c743d2889efde89.1627967359.git.gmuthukrishn@marvell.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<cover.1627967359.git.gmuthukrishn@marvell.com>", "References": "<cover.1627967359.git.gmuthukrishn@marvell.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-Proofpoint-ORIG-GUID": "7Swk94XQGLPs72vmyShUyryk728jKv3o", "X-Proofpoint-GUID": "7Swk94XQGLPs72vmyShUyryk728jKv3o", "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790\n definitions=2021-08-03_02:2021-08-03,\n 2021-08-03 signatures=0", "Subject": "[dpdk-dev] [v3,\n 2/3] test/telemetry: add unit tests for pointer value", "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", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Adding tests to evaluate pointer value in array and dict.\n\nSigned-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>\n---\n app/test/test_telemetry_data.c | 125 +++++++++++++++++++++++++++++++++\n app/test/test_telemetry_json.c | 29 ++++++--\n 2 files changed, 147 insertions(+), 7 deletions(-)", "diff": "diff --git a/app/test/test_telemetry_data.c b/app/test/test_telemetry_data.c\nindex f34d691265..2351ae5193 100644\n--- a/app/test/test_telemetry_data.c\n+++ b/app/test/test_telemetry_data.c\n@@ -301,6 +301,127 @@ test_array_with_array_u64_values(void)\n \treturn TEST_OUTPUT(\"{\\\"/test\\\":[[0,1,2,3,4],[0,1,2,3,4]]}\");\n }\n \n+static int\n+test_case_array_ptr(void)\n+{\n+\tint *p, i, j, a[] = {1, 2, 3, 4, 5};\n+\tchar exp[120];\n+\n+\tmemset(&response_data, 0, sizeof(response_data));\n+\tmemset(exp, 0, sizeof(exp));\n+\trte_tel_data_start_array(&response_data, RTE_TEL_PTR_VAL);\n+\n+\ti = sprintf(exp, \"{\\\"/test\\\":[\");\n+\tfor (j = 0; j < 5; j++) {\n+\t\tp = &a[j];\n+\t\ti += sprintf(exp + i, \"%\" PRIuPTR \",\", (uintptr_t)p);\n+\t\trte_tel_data_add_array_ptr(&response_data, p);\n+\t}\n+\n+\tsprintf(exp + i - 1, \"]}\");\n+\treturn TEST_OUTPUT(exp);\n+}\n+\n+static int\n+test_case_add_dict_ptr(void)\n+{\n+\tint *p, i, j, a[] = {1, 2, 3, 4, 5};\n+\tchar name[8], exp[160];\n+\n+\tmemset(&response_data, 0, sizeof(response_data));\n+\tmemset(exp, 0, sizeof(exp));\n+\trte_tel_data_start_dict(&response_data);\n+\n+\ti = sprintf(exp, \"{\\\"/test\\\":{\");\n+\tfor (j = 0; j < 5; j++) {\n+\t\tp = &a[j];\n+\t\tsprintf(name, \"dict_%d\", j);\n+\t\ti += sprintf(exp + i, \"\\\"%s\\\":%\" PRIuPTR \",\", name,\n+\t\t\t\t\t (uintptr_t)p);\n+\t\trte_tel_data_add_dict_ptr(&response_data, name, p);\n+\t}\n+\n+\tsprintf(exp + i - 1, \"}}\");\n+\treturn TEST_OUTPUT(exp);\n+}\n+\n+static int\n+test_dict_with_array_ptr_values(void)\n+{\n+\tint *p, i, j, a[] = {1, 2, 3, 4, 5};\n+\tchar exp[256];\n+\n+\tstruct rte_tel_data *child_data = rte_tel_data_alloc();\n+\trte_tel_data_start_array(child_data, RTE_TEL_PTR_VAL);\n+\n+\tstruct rte_tel_data *child_data2 = rte_tel_data_alloc();\n+\trte_tel_data_start_array(child_data2, RTE_TEL_PTR_VAL);\n+\n+\tmemset(&response_data, 0, sizeof(response_data));\n+\tmemset(exp, 0, sizeof(exp));\n+\trte_tel_data_start_dict(&response_data);\n+\n+\ti = sprintf(exp, \"{\\\"/test\\\":{\\\"dict_0\\\":[\");\n+\tfor (j = 0; j < 5; j++) {\n+\t\tp = &a[j];\n+\t\ti += sprintf(exp + i, \"%\" PRIuPTR \",\", (uintptr_t)p);\n+\t\trte_tel_data_add_array_ptr(child_data, p);\n+\t}\n+\n+\ti += sprintf(exp + i - 1, \"],\\\"dict_1\\\":[\");\n+\tfor (j = 5; j > 0; j--) {\n+\t\tp = &a[j - 1];\n+\t\ti += sprintf(exp + i - 1, \"%\" PRIuPTR \",\", (uintptr_t)p);\n+\t\trte_tel_data_add_array_ptr(child_data2, p);\n+\t}\n+\n+\tsprintf(exp + i - 2, \"]}}\");\n+\trte_tel_data_add_dict_container(&response_data, \"dict_0\",\n+\t\t\t\t\t\t\t\tchild_data, 0);\n+\trte_tel_data_add_dict_container(&response_data, \"dict_1\",\n+\t\t\t\t\t\t\t\tchild_data2, 0);\n+\n+\treturn TEST_OUTPUT(exp);\n+}\n+\n+static int\n+test_array_with_array_ptr_values(void)\n+{\n+\tint *p, i, j, a[] = {1, 2, 3, 4, 5};\n+\tchar exp[256];\n+\n+\tstruct rte_tel_data *child_data = rte_tel_data_alloc();\n+\trte_tel_data_start_array(child_data, RTE_TEL_PTR_VAL);\n+\n+\tstruct rte_tel_data *child_data2 = rte_tel_data_alloc();\n+\trte_tel_data_start_array(child_data2, RTE_TEL_PTR_VAL);\n+\n+\tmemset(&response_data, 0, sizeof(response_data));\n+\tmemset(exp, 0, sizeof(exp));\n+\trte_tel_data_start_array(&response_data, RTE_TEL_CONTAINER);\n+\n+\ti = sprintf(exp, \"{\\\"/test\\\":[[\");\n+\tfor (j = 0; j < 5; j++) {\n+\t\tp = &a[j];\n+\t\ti += sprintf(exp + i, \"%\" PRIuPTR \",\", (uintptr_t)p);\n+\t\trte_tel_data_add_array_ptr(child_data, p);\n+\t}\n+\n+\ti += sprintf(exp + i - 1, \"],[\");\n+\tfor (j = 5; j > 0; j--) {\n+\t\tp = &a[j - 1];\n+\t\ti += sprintf(exp + i - 1, \"%\" PRIuPTR \",\", (uintptr_t)p);\n+\t\trte_tel_data_add_array_ptr(child_data2, p);\n+\t}\n+\n+\tsprintf(exp + i - 2, \"]]}\");\n+\n+\trte_tel_data_add_array_container(&response_data, child_data, 0);\n+\trte_tel_data_add_array_container(&response_data, child_data2, 0);\n+\n+\treturn TEST_OUTPUT(exp);\n+}\n+\n static int\n connect_to_socket(void)\n {\n@@ -350,13 +471,17 @@ test_telemetry_data(void)\n \n \ttest_case test_cases[] = {test_case_array_string,\n \t\t\ttest_case_array_int, test_case_array_u64,\n+\t\t\ttest_case_array_ptr,\n \t\t\ttest_case_add_dict_int, test_case_add_dict_u64,\n+\t\t\ttest_case_add_dict_ptr,\n \t\t\ttest_case_add_dict_string,\n \t\t\ttest_dict_with_array_int_values,\n \t\t\ttest_dict_with_array_u64_values,\n+\t\t\ttest_dict_with_array_ptr_values,\n \t\t\ttest_dict_with_array_string_values,\n \t\t\ttest_array_with_array_int_values,\n \t\t\ttest_array_with_array_u64_values,\n+\t\t\ttest_array_with_array_ptr_values,\n \t\t\ttest_array_with_array_string_values };\n \n \trte_telemetry_register_cmd(REQUEST_CMD, test_cb, \"Test\");\ndiff --git a/app/test/test_telemetry_json.c b/app/test/test_telemetry_json.c\nindex 790181d316..68dc81c9cd 100644\n--- a/app/test/test_telemetry_json.c\n+++ b/app/test/test_telemetry_json.c\n@@ -11,18 +11,23 @@\n static int\n test_basic_array(void)\n {\n-\tconst char *expected = \"[\\\"meaning of life\\\",42]\";\n-\tchar buf[1024];\n-\tint used = 0;\n+\tchar buf[1024], expected[80];\n+\tint used = 0, n = 42, *p;\n \n \tprintf(\"%s: \", __func__);\n \tused = rte_tel_json_empty_array(buf, sizeof(buf), used);\n \tif (used != 2 || strcmp(buf, \"[]\"))\n \t\treturn -1;\n \n+\tp = &n;\n+\tmemset(expected, 0, sizeof(expected));\n+\tsprintf(expected, \"[\\\"meaning of life\\\",42,%\" PRIuPTR \"]\",\n+\t\t\t(uintptr_t)p);\n+\n \tused = rte_tel_json_add_array_string(buf, sizeof(buf), used,\n \t\t\"meaning of life\");\n-\tused = rte_tel_json_add_array_int(buf, sizeof(buf), used, 42);\n+\tused = rte_tel_json_add_array_int(buf, sizeof(buf), used, n);\n+\tused = rte_tel_json_add_array_ptr(buf, sizeof(buf), used, p);\n \n \tprintf(\"buf = '%s', expected = '%s'\\n\", buf, expected);\n \tif (used != (int)strlen(expected))\n@@ -33,14 +38,24 @@ test_basic_array(void)\n static int\n test_basic_obj(void)\n {\n-\tconst char *expected = \"{\\\"weddings\\\":4,\\\"funerals\\\":1}\";\n-\tchar buf[1024];\n-\tint used = 0;\n+\tchar buf[1024], expected[80];\n+\tint used = 0, n = 42, *p;\n+\n+\tp = &n;\n+\tmemset(expected, 0, sizeof(expected));\n+\tsprintf(expected,\n+\t\t\t\"{\\\"weddings\\\":4,\\\"funerals\\\":1,\"\n+\t\t\t\"\\\"address\\\":%\" PRIuPTR \",\\\"reset\\\":0}\", (uintptr_t)p);\n \n \tused = rte_tel_json_add_obj_u64(buf, sizeof(buf), used,\n \t\t\"weddings\", 4);\n \tused = rte_tel_json_add_obj_u64(buf, sizeof(buf), used,\n \t\t\"funerals\", 1);\n+\tused = rte_tel_json_add_obj_ptr(buf, sizeof(buf), used,\n+\t\t\"address\", p);\n+\tp = NULL;\n+\tused = rte_tel_json_add_obj_ptr(buf, sizeof(buf), used,\n+\t\t\"reset\", p);\n \n \tprintf(\"%s: buf = '%s', expected = '%s'\\n\", __func__, buf, expected);\n \tif (used != (int)strlen(expected))\n", "prefixes": [ "v3", "2/3" ] }{ "id": 96576, "url": "