Show a patch.

GET /api/patches/74501/
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 74501,
    "url": "https://patches.dpdk.org/api/patches/74501/",
    "web_url": "https://patches.dpdk.org/patch/74501/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<20200720140403.69865-3-ciara.power@intel.com>",
    "date": "2020-07-20T14:04:02",
    "name": "[v7,2/3] test/test_telemetry_data: add unit tests for data to JSON",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "c55612ae7894035bd7c06c305cce5597adb88ba8",
    "submitter": {
        "id": 978,
        "url": "https://patches.dpdk.org/api/people/978/",
        "name": "Ciara Power",
        "email": "ciara.power@intel.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@intel.com"
    },
    "mbox": "https://patches.dpdk.org/patch/74501/mbox/",
    "series": [
        {
            "id": 11173,
            "url": "https://patches.dpdk.org/api/series/11173/",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=11173",
            "date": "2020-07-20T14:04:00",
            "name": "add basic ethdev stats with data object recursion",
            "version": 7,
            "mbox": "https://patches.dpdk.org/series/11173/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/74501/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/74501/checks/",
    "tags": {},
    "headers": {
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9687\"; a=\"211458202\"",
            "E=Sophos;i=\"5.75,375,1589266800\"; d=\"scan'208\";a=\"211458202\"",
            "E=Sophos;i=\"5.75,375,1589266800\"; d=\"scan'208\";a=\"309857128\""
        ],
        "IronPort-SDR": [
            "\n K2z1yixV5vEYj1ekIKVbeybXD8bKZKZn6awTPePBrBThu9CY/cSaF4bdrUVozuo/fpCYAEqJ5G\n cKzhEbsqx5Ag==",
            "\n BFIwQhU1dE5lbfIp90kN9LAxtXfsel45X9/URhe5e1tFPfE3HQPcSjWSlqDViIFNamaJLFR2UB\n 5dvpe9Lp/fag=="
        ],
        "X-Amp-File-Uploaded": "False",
        "Precedence": "list",
        "X-Mailman-Version": "2.1.15",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "X-BeenThere": "dev@dpdk.org",
        "References": "<20200612105344.15383-1-ciara.power@intel.com>\n <20200720140403.69865-1-ciara.power@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v7 2/3] test/test_telemetry_data: add unit tests\n\tfor data to JSON",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 66104A0540;\n\tMon, 20 Jul 2020 16:10:08 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id DF4241BED5;\n\tMon, 20 Jul 2020 16:09:38 +0200 (CEST)",
            "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n by dpdk.org (Postfix) with ESMTP id EE69C1AFB\n for <dev@dpdk.org>; Mon, 20 Jul 2020 16:09:32 +0200 (CEST)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 20 Jul 2020 07:09:17 -0700",
            "from silpixa00399953.ir.intel.com (HELO\n silpixa00399953.ger.corp.intel.com) ([10.237.222.53])\n by fmsmga004.fm.intel.com with ESMTP; 20 Jul 2020 07:09:15 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "X-Mailer": "git-send-email 2.17.1",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "X-ExtLoop1": "1",
        "Date": "Mon, 20 Jul 2020 15:04:02 +0100",
        "To": "kevin.laatz@intel.com, thomas@monjalon.net, ferruh.yigit@intel.com,\n arybchenko@solarflare.com",
        "From": "Ciara Power <ciara.power@intel.com>",
        "In-Reply-To": "<20200720140403.69865-1-ciara.power@intel.com>",
        "Cc": "dev@dpdk.org, keith.wiles@intel.com, bruce.richardson@intel.com,\n Louise Kilheeney <louise.kilheeney@intel.com>,\n Ciara Power <ciara.power@intel.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Message-Id": "<20200720140403.69865-3-ciara.power@intel.com>",
        "Return-Path": "<dev-bounces@dpdk.org>"
    },
    "content": "From: Louise Kilheeney <louise.kilheeney@intel.com>\n\nThis patch adds tests for verifying telemetry data structures are\nconverted to JSON as expected. Both flat and recursive data structures\nare tested, for all possible value types.\n\nThe app connects to the telemetry socket as a client, and registers one\ncommand with a corresponding callback function. Each time the callback\nfunction is called, it copies a global data variable to the data pointer\npassed in by telemetry.\nWhen a test case is run, the test case function builds up the global\ndata variable with the relevant data types, and the expected json string\noutput which should be generated from that. The 'test_output()' function\nis used to trigger the callback and ensure the actual output matches\nthat expected.\n\nSigned-off-by: Louise Kilheeney <louise.kilheeney@intel.com>\nSigned-off-by: Ciara Power <ciara.power@intel.com>\n\n---\nv7:\n  - Simplified connecting to socket by removing use of glob.\n  - Fixed buffer overflow issue when reading from socket.\n  - Split expected response strings over multiple lines.\nv6:\n  - Fixed FreeBSD build error.\n  - Added comments and expanded commit log.\n  - Add loop to call test cases stored in a list.\n---\n app/test/Makefile              |   1 +\n app/test/meson.build           |   5 +-\n app/test/test_telemetry_data.c | 369 +++++++++++++++++++++++++++++++++\n 3 files changed, 373 insertions(+), 2 deletions(-)\n create mode 100644 app/test/test_telemetry_data.c",
    "diff": "diff --git a/app/test/Makefile b/app/test/Makefile\nindex f4065271e..1cb64089c 100644\n--- a/app/test/Makefile\n+++ b/app/test/Makefile\n@@ -145,6 +145,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm6.c\n SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm6_perf.c\n \n SRCS-$(CONFIG_RTE_LIBRTE_TELEMETRY) += test_telemetry_json.c\n+SRCS-$(CONFIG_RTE_LIBRTE_TELEMETRY) += test_telemetry_data.c\n \n SRCS-y += test_debug.c\n SRCS-y += test_errno.c\ndiff --git a/app/test/meson.build b/app/test/meson.build\nindex 786a21397..4a72fe5b6 100644\n--- a/app/test/meson.build\n+++ b/app/test/meson.build\n@@ -170,6 +170,7 @@ test_deps = ['acl',\n \t'ring',\n \t'security',\n \t'stack',\n+\t'telemetry',\n \t'timer'\n ]\n \n@@ -345,8 +346,8 @@ if dpdk_conf.has('RTE_LIBRTE_SKELETON_EVENTDEV_PMD')\n \ttest_deps += 'pmd_skeleton_event'\n endif\n if dpdk_conf.has('RTE_LIBRTE_TELEMETRY')\n-\ttest_sources += 'test_telemetry_json.c'\n-\tfast_tests += [['telemetry_json_autotest', true]]\n+\ttest_sources += ['test_telemetry_json.c', 'test_telemetry_data.c']\n+\tfast_tests += [['telemetry_json_autotest', true], ['telemetry_data_autotest', true]]\n endif\n \n # The following linkages of drivers are required because\ndiff --git a/app/test/test_telemetry_data.c b/app/test/test_telemetry_data.c\nnew file mode 100644\nindex 000000000..7a31e68a7\n--- /dev/null\n+++ b/app/test/test_telemetry_data.c\n@@ -0,0 +1,369 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright 2020 Intel Corporation\n+ */\n+\n+#include <string.h>\n+#include <sys/socket.h>\n+#include <sys/un.h>\n+#include <unistd.h>\n+#include <limits.h>\n+\n+#include <rte_eal.h>\n+#include <rte_common.h>\n+#include <rte_telemetry.h>\n+#include <rte_string_fns.h>\n+\n+#include \"test.h\"\n+#include \"telemetry_data.h\"\n+\n+#define TELEMETRY_VERSION \"v2\"\n+#define REQUEST_CMD \"/test\"\n+#define BUF_SIZE 1024\n+#define TEST_OUTPUT(exp) test_output(__func__, exp)\n+\n+static struct rte_tel_data response_data;\n+static int sock;\n+\n+/*\n+ * This function is the callback registered with Telemetry to be used when\n+ * the /test command is requested. This callback returns the global data built\n+ * up by the individual test cases.\n+ */\n+static int\n+test_cb(const char *cmd __rte_unused, const char *params __rte_unused,\n+\t\tstruct rte_tel_data *d)\n+{\n+\t*d = response_data;\n+\treturn 0;\n+}\n+\n+/*\n+ * This function is called by each test case function. It communicates with\n+ * the telemetry socket by requesting the /test command, and reading the\n+ * response. The expected response is passed in by the test case function,\n+ * and is compared to the actual response received from Telemetry.\n+ */\n+static int\n+test_output(const char *func_name, const char *expected)\n+{\n+\tint bytes;\n+\tchar buf[BUF_SIZE * 16];\n+\tif (write(sock, REQUEST_CMD, strlen(REQUEST_CMD)) < 0) {\n+\t\tprintf(\"%s: Error with socket write - %s\\n\", __func__,\n+\t\t\t\tstrerror(errno));\n+\t\treturn -1;\n+\t}\n+\tbytes = read(sock, buf, sizeof(buf) - 1);\n+\tif (bytes < 0) {\n+\t\tprintf(\"%s: Error with socket read - %s\\n\", __func__,\n+\t\t\t\tstrerror(errno));\n+\t\treturn -1;\n+\t}\n+\tbuf[bytes] = '\\0';\n+\tprintf(\"%s: buf = '%s', expected = '%s'\\n\", func_name, buf, expected);\n+\treturn strncmp(expected, buf, sizeof(buf));\n+}\n+\n+static int\n+test_dict_with_array_int_values(void)\n+{\n+\tint i;\n+\n+\tstruct rte_tel_data *child_data = rte_tel_data_alloc();\n+\trte_tel_data_start_array(child_data, RTE_TEL_INT_VAL);\n+\n+\tstruct rte_tel_data *child_data2 = rte_tel_data_alloc();\n+\trte_tel_data_start_array(child_data2, RTE_TEL_INT_VAL);\n+\n+\tmemset(&response_data, 0, sizeof(response_data));\n+\trte_tel_data_start_dict(&response_data);\n+\n+\tfor (i = 0; i < 5; i++) {\n+\t\trte_tel_data_add_array_int(child_data, i);\n+\t\trte_tel_data_add_array_int(child_data2, i);\n+\t}\n+\n+\trte_tel_data_add_dict_container(&response_data, \"dict_0\",\n+\t child_data, 0);\n+\trte_tel_data_add_dict_container(&response_data, \"dict_1\",\n+\t child_data2, 0);\n+\n+\treturn TEST_OUTPUT(\"{\\\"/test\\\":{\\\"dict_0\\\":[0,1,2,3,4],\"\n+\t\t\t\"\\\"dict_1\\\":[0,1,2,3,4]}}\");\n+}\n+\n+static int\n+test_array_with_array_int_values(void)\n+{\n+\tint i;\n+\n+\tstruct rte_tel_data *child_data = rte_tel_data_alloc();\n+\trte_tel_data_start_array(child_data, RTE_TEL_INT_VAL);\n+\n+\tstruct rte_tel_data *child_data2 = rte_tel_data_alloc();\n+\trte_tel_data_start_array(child_data2, RTE_TEL_INT_VAL);\n+\n+\tmemset(&response_data, 0, sizeof(response_data));\n+\trte_tel_data_start_array(&response_data, RTE_TEL_CONTAINER);\n+\n+\tfor (i = 0; i < 5; i++) {\n+\t\trte_tel_data_add_array_int(child_data, i);\n+\t\trte_tel_data_add_array_int(child_data2, i);\n+\t}\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(\"{\\\"/test\\\":[[0,1,2,3,4],[0,1,2,3,4]]}\");\n+}\n+\n+static int\n+test_case_array_int(void)\n+{\n+\tint i;\n+\tmemset(&response_data, 0, sizeof(response_data));\n+\trte_tel_data_start_array(&response_data, RTE_TEL_INT_VAL);\n+\tfor (i = 0; i < 5; i++)\n+\t\trte_tel_data_add_array_int(&response_data, i);\n+\treturn TEST_OUTPUT(\"{\\\"/test\\\":[0,1,2,3,4]}\");\n+}\n+\n+static int\n+test_case_add_dict_int(void)\n+{\n+\tint i = 0;\n+\tchar name_of_value[8];\n+\n+\tmemset(&response_data, 0, sizeof(response_data));\n+\trte_tel_data_start_dict(&response_data);\n+\n+\tfor (i = 0; i < 5; i++) {\n+\t\tsprintf(name_of_value, \"dict_%d\", i);\n+\t\trte_tel_data_add_dict_int(&response_data, name_of_value, i);\n+\t}\n+\n+\treturn TEST_OUTPUT(\"{\\\"/test\\\":{\\\"dict_0\\\":0,\\\"dict_1\\\":1,\\\"dict_2\\\":2,\"\n+\t\t\t\"\\\"dict_3\\\":3,\\\"dict_4\\\":4}}\");\n+}\n+\n+static int\n+test_case_array_string(void)\n+{\n+\tmemset(&response_data, 0, sizeof(response_data));\n+\trte_tel_data_start_array(&response_data, RTE_TEL_STRING_VAL);\n+\trte_tel_data_add_array_string(&response_data, \"aaaa\");\n+\trte_tel_data_add_array_string(&response_data, \"bbbb\");\n+\trte_tel_data_add_array_string(&response_data, \"cccc\");\n+\trte_tel_data_add_array_string(&response_data, \"dddd\");\n+\trte_tel_data_add_array_string(&response_data, \"eeee\");\n+\n+\treturn TEST_OUTPUT(\"{\\\"/test\\\":[\\\"aaaa\\\",\\\"bbbb\\\",\\\"cccc\\\",\\\"dddd\\\",\"\n+\t\t\t\"\\\"eeee\\\"]}\");\n+}\n+\n+static int\n+test_case_add_dict_string(void)\n+{\n+\tmemset(&response_data, 0, sizeof(response_data));\n+\trte_tel_data_start_dict(&response_data);\n+\n+\trte_tel_data_add_dict_string(&response_data, \"dict_0\", \"aaaa\");\n+\trte_tel_data_add_dict_string(&response_data, \"dict_1\", \"bbbb\");\n+\trte_tel_data_add_dict_string(&response_data, \"dict_2\", \"cccc\");\n+\trte_tel_data_add_dict_string(&response_data, \"dict_3\", \"dddd\");\n+\n+\treturn TEST_OUTPUT(\"{\\\"/test\\\":{\\\"dict_0\\\":\\\"aaaa\\\",\\\"dict_1\\\":\"\n+\t\t\t\"\\\"bbbb\\\",\\\"dict_2\\\":\\\"cccc\\\",\\\"dict_3\\\":\\\"dddd\\\"}}\");\n+}\n+\n+\n+static int\n+test_dict_with_array_string_values(void)\n+{\n+\tstruct rte_tel_data *child_data = rte_tel_data_alloc();\n+\trte_tel_data_start_array(child_data, RTE_TEL_STRING_VAL);\n+\n+\tstruct rte_tel_data *child_data2 = rte_tel_data_alloc();\n+\trte_tel_data_start_array(child_data2, RTE_TEL_STRING_VAL);\n+\n+\tmemset(&response_data, 0, sizeof(response_data));\n+\trte_tel_data_start_dict(&response_data);\n+\n+\trte_tel_data_add_array_string(child_data, \"aaaa\");\n+\trte_tel_data_add_array_string(child_data2, \"bbbb\");\n+\n+\trte_tel_data_add_dict_container(&response_data, \"dict_0\",\n+\t child_data, 0);\n+\trte_tel_data_add_dict_container(&response_data, \"dict_1\",\n+\t child_data2, 0);\n+\n+\treturn TEST_OUTPUT(\"{\\\"/test\\\":{\\\"dict_0\\\":[\\\"aaaa\\\"],\\\"dict_1\\\":\"\n+\t\t\t\"[\\\"bbbb\\\"]}}\");\n+}\n+\n+static int\n+test_array_with_array_string_values(void)\n+{\n+\tstruct rte_tel_data *child_data = rte_tel_data_alloc();\n+\trte_tel_data_start_array(child_data, RTE_TEL_STRING_VAL);\n+\n+\tstruct rte_tel_data *child_data2 = rte_tel_data_alloc();\n+\trte_tel_data_start_array(child_data2, RTE_TEL_STRING_VAL);\n+\n+\tmemset(&response_data, 0, sizeof(response_data));\n+\trte_tel_data_start_array(&response_data, RTE_TEL_CONTAINER);\n+\n+\trte_tel_data_add_array_string(child_data, \"aaaa\");\n+\trte_tel_data_add_array_string(child_data2, \"bbbb\");\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(\"{\\\"/test\\\":[[\\\"aaaa\\\"],[\\\"bbbb\\\"]]}\");\n+}\n+\n+static int\n+test_case_array_u64(void)\n+{\n+\tint i;\n+\tmemset(&response_data, 0, sizeof(response_data));\n+\trte_tel_data_start_array(&response_data, RTE_TEL_U64_VAL);\n+\tfor (i = 0; i < 5; i++)\n+\t\trte_tel_data_add_array_u64(&response_data, i);\n+\treturn TEST_OUTPUT(\"{\\\"/test\\\":[0,1,2,3,4]}\");\n+}\n+\n+static int\n+test_case_add_dict_u64(void)\n+{\n+\tint i = 0;\n+\tchar name_of_value[8];\n+\n+\tmemset(&response_data, 0, sizeof(response_data));\n+\trte_tel_data_start_dict(&response_data);\n+\n+\tfor (i = 0; i < 5; i++) {\n+\t\tsprintf(name_of_value, \"dict_%d\", i);\n+\t\trte_tel_data_add_dict_u64(&response_data, name_of_value, i);\n+\t}\n+\treturn TEST_OUTPUT(\"{\\\"/test\\\":{\\\"dict_0\\\":0,\\\"dict_1\\\":1,\\\"dict_2\\\":2,\"\n+\t\t\t\"\\\"dict_3\\\":3,\\\"dict_4\\\":4}}\");\n+}\n+\n+static int\n+test_dict_with_array_u64_values(void)\n+{\n+\tint i;\n+\n+\tstruct rte_tel_data *child_data = rte_tel_data_alloc();\n+\trte_tel_data_start_array(child_data, RTE_TEL_U64_VAL);\n+\n+\tstruct rte_tel_data *child_data2 = rte_tel_data_alloc();\n+\trte_tel_data_start_array(child_data2, RTE_TEL_U64_VAL);\n+\n+\tmemset(&response_data, 0, sizeof(response_data));\n+\trte_tel_data_start_dict(&response_data);\n+\n+\tfor (i = 0; i < 10; i++) {\n+\t\trte_tel_data_add_array_u64(child_data, i);\n+\t\trte_tel_data_add_array_u64(child_data2, i);\n+\t}\n+\n+\trte_tel_data_add_dict_container(&response_data, \"dict_0\",\n+\t child_data, 0);\n+\trte_tel_data_add_dict_container(&response_data, \"dict_1\",\n+\t child_data2, 0);\n+\n+\treturn TEST_OUTPUT(\"{\\\"/test\\\":{\\\"dict_0\\\":[0,1,2,3,4,5,6,7,8,9],\"\n+\t\t\t\"\\\"dict_1\\\":[0,1,2,3,4,5,6,7,8,9]}}\");\n+}\n+\n+static int\n+test_array_with_array_u64_values(void)\n+{\n+\tint i;\n+\n+\tstruct rte_tel_data *child_data = rte_tel_data_alloc();\n+\trte_tel_data_start_array(child_data, RTE_TEL_U64_VAL);\n+\n+\tstruct rte_tel_data *child_data2 = rte_tel_data_alloc();\n+\trte_tel_data_start_array(child_data2, RTE_TEL_U64_VAL);\n+\n+\tmemset(&response_data, 0, sizeof(response_data));\n+\trte_tel_data_start_array(&response_data, RTE_TEL_CONTAINER);\n+\n+\tfor (i = 0; i < 5; i++) {\n+\t\trte_tel_data_add_array_u64(child_data, i);\n+\t\trte_tel_data_add_array_u64(child_data2, i);\n+\t}\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(\"{\\\"/test\\\":[[0,1,2,3,4],[0,1,2,3,4]]}\");\n+}\n+\n+static int\n+connect_to_socket(void)\n+{\n+\tchar buf[BUF_SIZE];\n+\tint sock, bytes;\n+\tstruct sockaddr_un telem_addr;\n+\n+\tsock = socket(AF_UNIX, SOCK_SEQPACKET, 0);\n+\tif (sock < 0) {\n+\t\tprintf(\"\\n%s: Error creating socket: %s\\n\", __func__,\n+\t\t\t\tstrerror(errno));\n+\t\treturn -1;\n+\t}\n+\ttelem_addr.sun_family = AF_UNIX;\n+\tsnprintf(telem_addr.sun_path, sizeof(telem_addr.sun_path),\n+\t\t\t\"%s/dpdk_telemetry.%s\",\trte_eal_get_runtime_dir(),\n+\t\t\tTELEMETRY_VERSION);\n+\tif (connect(sock, (struct sockaddr *) &telem_addr,\n+\t\t\tsizeof(telem_addr)) < 0)\n+\t\tprintf(\"\\n%s: Error connecting to socket: %s\\n\", __func__,\n+\t\t\t\tstrerror(errno));\n+\n+\tbytes = read(sock, buf, sizeof(buf) - 1);\n+\tif (bytes < 0) {\n+\t\tprintf(\"%s: Error with socket read - %s\\n\", __func__,\n+\t\t\t\tstrerror(errno));\n+\t\treturn -1;\n+\t}\n+\tbuf[bytes] = '\\0';\n+\tprintf(\"\\n%s: %s\\n\", __func__, buf);\n+\treturn sock;\n+}\n+\n+static int\n+test_telemetry_data(void)\n+{\n+\ttypedef int (*test_case)(void);\n+\tunsigned int i = 0;\n+\n+\tsock = connect_to_socket();\n+\tif (sock <= 0)\n+\t\treturn -1;\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_add_dict_int, test_case_add_dict_u64,\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_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_string_values };\n+\n+\trte_telemetry_register_cmd(REQUEST_CMD, test_cb, \"Test\");\n+\tfor (i = 0; i < RTE_DIM(test_cases); i++) {\n+\t\tif (test_cases[i]() != 0) {\n+\t\t\tclose(sock);\n+\t\t\treturn -1;\n+\t\t}\n+\t}\n+\tclose(sock);\n+\treturn 0;\n+}\n+\n+REGISTER_TEST_COMMAND(telemetry_data_autotest, test_telemetry_data);\n",
    "prefixes": [
        "v7",
        "2/3"
    ]
}