get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 69018,
    "url": "http://patches.dpdk.org/api/patches/69018/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200421123949.38270-8-ciara.power@intel.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": "<20200421123949.38270-8-ciara.power@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200421123949.38270-8-ciara.power@intel.com",
    "date": "2020-04-21T12:39:39",
    "name": "[v3,07/17] app/test: add telemetry json tests",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "b25b70db075836bca181ad005525fa4fadfc17d7",
    "submitter": {
        "id": 978,
        "url": "http://patches.dpdk.org/api/people/978/?format=api",
        "name": "Power, Ciara",
        "email": "ciara.power@intel.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/20200421123949.38270-8-ciara.power@intel.com/mbox/",
    "series": [
        {
            "id": 9543,
            "url": "http://patches.dpdk.org/api/series/9543/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=9543",
            "date": "2020-04-21T12:39:32",
            "name": "update and simplify telemetry library.",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/9543/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/69018/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/69018/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 65801A0597;\n\tTue, 21 Apr 2020 15:01:09 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 5C45E1D5B3;\n\tTue, 21 Apr 2020 14:59:45 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n by dpdk.org (Postfix) with ESMTP id 720501D59C\n for <dev@dpdk.org>; Tue, 21 Apr 2020 14:59:41 +0200 (CEST)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 21 Apr 2020 05:59:41 -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; 21 Apr 2020 05:59:38 -0700"
        ],
        "IronPort-SDR": [
            "\n y52j8mj5aWnhP9Q6O/6TzCCWuU5bKqnnpWr1gxoanGaQcI4fEJbuihEHXz0pUns325EnGoj0IA\n CmWBo9FNujIg==",
            "\n m0Aw42dQTGvjdNidvtJZGIHRaGKeoMpCq5e8E2HrcemUU3o3/I19bz60xpDrAIamZWGoXriQIs\n wBCJ1WbTdYCw=="
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.72,410,1580803200\"; d=\"scan'208\";a=\"279629118\"",
        "From": "Ciara Power <ciara.power@intel.com>",
        "To": "dev@dpdk.org,\n\tkevin.laatz@intel.com",
        "Cc": "reshma.pattan@intel.com, jerinjacobk@gmail.com, david.marchand@redhat.com,\n keith.wiles@intel.com, mb@smartsharesystems.com, thomas@monjalon.net,\n Bruce Richardson <bruce.richardson@intel.com>",
        "Date": "Tue, 21 Apr 2020 13:39:39 +0100",
        "Message-Id": "<20200421123949.38270-8-ciara.power@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20200421123949.38270-1-ciara.power@intel.com>",
        "References": "<20200319171907.60891-1-ciara.power@intel.com>\n <20200421123949.38270-1-ciara.power@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v3 07/17] app/test: add telemetry json tests",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "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": "From: Bruce Richardson <bruce.richardson@intel.com>\n\nThis patch adds tests for the json utility functions in the telemetry\nlibrary.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n app/test/Makefile              |   2 +\n app/test/meson.build           |   4 +\n app/test/test_telemetry_json.c | 136 +++++++++++++++++++++++++++++++++\n 3 files changed, 142 insertions(+)\n create mode 100644 app/test/test_telemetry_json.c",
    "diff": "diff --git a/app/test/Makefile b/app/test/Makefile\nindex be53d33c3f..bd6edb2284 100644\n--- a/app/test/Makefile\n+++ b/app/test/Makefile\n@@ -136,6 +136,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm_perf.c\n 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+\n SRCS-y += test_debug.c\n SRCS-y += test_errno.c\n SRCS-y += test_tailq.c\ndiff --git a/app/test/meson.build b/app/test/meson.build\nindex 04b59cffa4..9e49fbb52d 100644\n--- a/app/test/meson.build\n+++ b/app/test/meson.build\n@@ -320,6 +320,10 @@ endif\n 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+endif\n \n # The following linkages of drivers are required because\n # they are used via a driver-specific API.\ndiff --git a/app/test/test_telemetry_json.c b/app/test/test_telemetry_json.c\nnew file mode 100644\nindex 0000000000..5bd4f2caee\n--- /dev/null\n+++ b/app/test/test_telemetry_json.c\n@@ -0,0 +1,136 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright 2020 Intel Corporation\n+ */\n+\n+#include <string.h>\n+#include <rte_telemetry_json.h>\n+\n+#include \"test.h\"\n+\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+\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+\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+\n+\tprintf(\"buf = '%s', expected = '%s'\\n\", buf, expected);\n+\tif (used != (int)strlen(expected))\n+\t\treturn -1;\n+\treturn strncmp(expected, buf, sizeof(buf));\n+}\n+\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+\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+\n+\tprintf(\"%s: buf = '%s', expected = '%s'\\n\", __func__, buf, expected);\n+\tif (used != (int)strlen(expected))\n+\t\treturn -1;\n+\treturn strncmp(expected, buf, sizeof(buf));\n+}\n+\n+static int\n+test_overflow_array(void)\n+{\n+\tstatic const char * const strs[] = {\"Arsenal\", \"Chelsea\", \"Liverpool\",\n+\t\t\t\"Spurs\"};\n+\tconst char *expected = \"[\\\"Arsenal\\\",\\\"Chelsea\\\"]\";\n+\tchar buf[25];\n+\tint i, used = 0;\n+\n+\tfor (i = 0; i < (int)RTE_DIM(strs); i++)\n+\t\tused = rte_tel_json_add_array_string(buf, sizeof(buf), used,\n+\t\t\t\tstrs[i]);\n+\n+\tprintf(\"%s: buf = '%s', expected = '%s'\\n\", __func__, buf, expected);\n+\tif (buf[used - 1] != ']')\n+\t\treturn -1;\n+\tif (used != (int)strlen(expected))\n+\t\treturn -1;\n+\treturn strncmp(expected, buf, sizeof(buf));\n+}\n+\n+static int\n+test_overflow_obj(void)\n+{\n+\tstatic const char * const names[] = {\"Italy\", \"Wales\", \"Scotland\",\n+\t\t\t\"Ireland\", \"England\", \"France\"};\n+\tconst int vals[RTE_DIM(names)] = {20, 61, 10, 40, 55, 35};\n+\tconst char *expected = \"{\\\"Italy\\\":20,\\\"Wales\\\":61}\";\n+\tchar buf[25];\n+\tint i, used = 0;\n+\n+\tfor (i = 0; i < (int)RTE_DIM(names); i++)\n+\t\tused = rte_tel_json_add_obj_u64(buf, sizeof(buf), used,\n+\t\t\t\tnames[i], vals[i]);\n+\n+\tprintf(\"%s: buf = '%s', expected = '%s'\\n\", __func__, buf, expected);\n+\tif (buf[used - 1] != '}')\n+\t\treturn -1;\n+\tif (used != (int)strlen(expected))\n+\t\treturn -1;\n+\treturn strncmp(expected, buf, sizeof(buf));\n+}\n+\n+static int\n+test_large_array_element(void)\n+{\n+\tstatic const char str[] = \"A really long string to overflow buffer\";\n+\t/* buffer should be unmodified so initial value and expected are same */\n+\tconst char *expected = \"ABC\";\n+\tchar buf[sizeof(str) - 5] = \"ABC\";\n+\tint used = 0;\n+\n+\tused = rte_tel_json_add_array_string(buf, sizeof(buf), used, str);\n+\tprintf(\"%s: buf = '%s', expected = '%s'\\n\", __func__, buf, expected);\n+\n+\treturn strlen(buf) != 0;\n+}\n+\n+static int\n+test_large_obj_element(void)\n+{\n+\tstatic const char str[] = \"A really long string to overflow buffer\";\n+\t/* buffer should be unmodified so initial value and expected are same */\n+\tconst char *expected = \"XYZ\";\n+\tchar buf[sizeof(str) - 5] = \"XYZ\";\n+\tint used = 0;\n+\n+\tused = rte_tel_json_add_obj_u64(buf, sizeof(buf), used, str, 0);\n+\tprintf(\"%s: buf = '%s', expected = '%s'\\n\", __func__, buf, expected);\n+\n+\treturn strlen(buf) != 0;\n+}\n+\n+static int\n+test_telemetry_json(void)\n+{\n+\tif (test_basic_array() < 0 ||\n+\t\t\ttest_basic_obj() < 0 ||\n+\t\t\ttest_overflow_array() < 0 ||\n+\t\t\ttest_overflow_obj() < 0 ||\n+\t\t\ttest_large_array_element() < 0 ||\n++\t\t\ttest_large_obj_element() < 0)\n+\t\treturn -1;\n+\treturn 0;\n+}\n+\n+REGISTER_TEST_COMMAND(telemetry_json_autotest, test_telemetry_json);\n",
    "prefixes": [
        "v3",
        "07/17"
    ]
}