get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 43402,
    "url": "http://patches.dpdk.org/api/patches/43402/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1532609430-2753-4-git-send-email-naga.sureshx.somarowthu@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": "<1532609430-2753-4-git-send-email-naga.sureshx.somarowthu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1532609430-2753-4-git-send-email-naga.sureshx.somarowthu@intel.com",
    "date": "2018-07-26T12:50:29",
    "name": "[v7,3/4] test: add unit tests for latencystats library",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "71269ef610b97652e5dac298310b55ea91fba280",
    "submitter": {
        "id": 1053,
        "url": "http://patches.dpdk.org/api/people/1053/?format=api",
        "name": "Naga Suresh Somarowthu",
        "email": "naga.sureshx.somarowthu@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/1532609430-2753-4-git-send-email-naga.sureshx.somarowthu@intel.com/mbox/",
    "series": [
        {
            "id": 790,
            "url": "http://patches.dpdk.org/api/series/790/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=790",
            "date": "2018-07-26T12:50:26",
            "name": "add unit tests for bitrate, latency and pdump libraries",
            "version": 7,
            "mbox": "http://patches.dpdk.org/series/790/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/43402/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/43402/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 0AF12325F;\n\tThu, 26 Jul 2018 14:50:58 +0200 (CEST)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 762DC325F\n\tfor <dev@dpdk.org>; Thu, 26 Jul 2018 14:50:56 +0200 (CEST)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t26 Jul 2018 05:50:55 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga008.fm.intel.com with ESMTP; 26 Jul 2018 05:50:42 -0700",
            "from wgcvswdev001.ir.intel.com (wgcvswdev001.ir.intel.com\n\t[10.102.246.100])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tw6QCog7s024688; Thu, 26 Jul 2018 13:50:42 +0100",
            "from wgcvswdev001.ir.intel.com (localhost [127.0.0.1])\n\tby wgcvswdev001.ir.intel.com with ESMTP id w6QCoeHN002872;\n\tThu, 26 Jul 2018 13:50:40 +0100",
            "(from jmparthx@localhost)\n\tby wgcvswdev001.ir.intel.com with ? id w6QCoe73002868;\n\tThu, 26 Jul 2018 13:50:40 +0100"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,405,1526367600\"; d=\"scan'208\";a=\"58061171\"",
        "From": "Naga Suresh Somarowthu <naga.sureshx.somarowthu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "remy.horton@intel.com, reshma.pattan@intel.com,\n\tNaga Suresh Somarowthu <naga.sureshx.somarowthu@intel.com>",
        "Date": "Thu, 26 Jul 2018 13:50:29 +0100",
        "Message-Id": "<1532609430-2753-4-git-send-email-naga.sureshx.somarowthu@intel.com>",
        "X-Mailer": "git-send-email 1.7.12.2",
        "In-Reply-To": "<1532609430-2753-1-git-send-email-naga.sureshx.somarowthu@intel.com>",
        "References": "<1532538360-8773-1-git-send-email-naga.sureshx.somarowthu@intel.com>\n\t<1532609430-2753-1-git-send-email-naga.sureshx.somarowthu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v7 3/4] test: add unit tests for latencystats\n\tlibrary",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Unit Test Cases added for latencystats library.\n\nSigned-off-by: Naga Suresh Somarowthu <naga.sureshx.somarowthu@intel.com>\nReviewed-by: Reshma Pattan <reshma.pattan@intel.com>\n---\n test/test/Makefile            |   1 +\n test/test/autotest_data.py    |   6 ++\n test/test/test_latencystats.c | 216 ++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 223 insertions(+)\n create mode 100644 test/test/test_latencystats.c",
    "diff": "diff --git a/test/test/Makefile b/test/test/Makefile\nindex c619877f0..bba3be1be 100644\n--- a/test/test/Makefile\n+++ b/test/test/Makefile\n@@ -184,6 +184,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_blockcipher.c\n SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c\n SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_asym.c\n SRCS-$(CONFIG_RTE_LIBRTE_BITRATE) += test_bitratestats.c\n+SRCS-$(CONFIG_RTE_LIBRTE_LATENCY_STATS) += test_latencystats.c\n \n ifeq ($(CONFIG_RTE_COMPRESSDEV_TEST),y)\n SRCS-$(CONFIG_RTE_LIBRTE_COMPRESSDEV) += test_compressdev.c\ndiff --git a/test/test/autotest_data.py b/test/test/autotest_data.py\nindex 419520342..3eccc4e1a 100644\n--- a/test/test/autotest_data.py\n+++ b/test/test/autotest_data.py\n@@ -299,6 +299,12 @@ def per_sockets(num):\n                 \"Report\":  None,\n             },\n             {\n+                \"Name\":    \"Latencystats autotest\",\n+                \"Command\": \"latencystats_autotest\",\n+                \"Func\":    default_autotest,\n+                \"Report\":  None,\n+            },\n+            {\n                 \"Name\":    \"PMD ring autotest\",\n                 \"Command\": \"ring_pmd_autotest\",\n                 \"Func\":    default_autotest,\ndiff --git a/test/test/test_latencystats.c b/test/test/test_latencystats.c\nnew file mode 100644\nindex 000000000..f2287a2b7\n--- /dev/null\n+++ b/test/test/test_latencystats.c\n@@ -0,0 +1,216 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2018 Intel Corporation\n+ */\n+\n+#include <stdio.h>\n+#include <string.h>\n+#include <errno.h>\n+#include <time.h>\n+\n+#include <rte_common.h>\n+#include <rte_metrics.h>\n+#include <rte_latencystats.h>\n+#include <rte_eth_ring.h>\n+#include <rte_ethdev.h>\n+#include <rte_mbuf.h>\n+#include \"test.h\"\n+#include \"sample_packet_forward.h\"\n+#define NUM_STATS 4\n+#define LATENCY_NUM_PACKETS 10\n+#define QUEUE_ID 0\n+\n+uint16_t portid;\n+struct rte_ring *ring;\n+\n+struct rte_metric_name lat_stats_strings[] = {\n+\t{\"min_latency_ns\"},\n+\t{\"avg_latency_ns\"},\n+\t{\"max_latency_ns\"},\n+\t{\"jitter_ns\"},\n+};\n+\n+/* Test case for latency init with metrics init */\n+static int test_latency_init(void)\n+{\n+\tint ret = 0;\n+\n+\t/* Metrics Initialization */\n+\trte_metrics_init(rte_socket_id());\n+\n+\tret = rte_latencystats_init(1, NULL);\n+\tTEST_ASSERT(ret >= 0, \"Test Failed: rte_latencystats_init failed\");\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+/* Test case to update the latency stats */\n+static int test_latency_update(void)\n+{\n+\tint ret = 0;\n+\n+\tret = rte_latencystats_update();\n+\tTEST_ASSERT(ret >= 0, \"Test Failed: rte_latencystats_update failed\");\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+/* Test case to uninit latency stats */\n+static int test_latency_uninit(void)\n+{\n+\tint ret = 0;\n+\n+\tret = rte_latencystats_uninit();\n+\tTEST_ASSERT(ret >= 0, \"Test Failed: rte_latencystats_uninit failed\");\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+/* Test case to get names of latency stats */\n+static int test_latencystats_get_names(void)\n+{\n+\tint ret = 0;\n+\tint size = 0;\n+\tstruct rte_metric_name names[NUM_STATS] = { 0 };\n+\tstruct rte_metric_name wrongnames[NUM_STATS - 2] = { 0 };\n+\n+\t/* Success Test: Valid names and size */\n+\tsize = NUM_STATS;\n+\tret = rte_latencystats_get_names(names, size);\n+\tfor (int i = 0; i <= NUM_STATS; i++) {\n+\t\tif (strcmp(lat_stats_strings[i].name, names[i].name) == 0)\n+\t\t\tprintf(\" %s\\n\", names[i].name);\n+\t\telse\n+\t\t\tprintf(\"Failed: Names are not matched\\n\");\n+\t}\n+\tTEST_ASSERT((ret == NUM_STATS), \"Test Failed to get metrics names\");\n+\n+\t/* Failure Test: Invalid names and valid size */\n+\tret = rte_latencystats_get_names(NULL, size);\n+\tTEST_ASSERT((ret == NUM_STATS), \"Test Failed to get the metrics count,\"\n+\t\t    \"Actual: %d Expected: %d\", ret, NUM_STATS);\n+\n+\t/* Failure Test: Valid names and invalid size */\n+\tsize = 0;\n+\tret = rte_latencystats_get_names(names, size);\n+\tTEST_ASSERT((ret == NUM_STATS), \"Test Failed to get the metrics count,\"\n+\t\t    \"Actual: %d Expected: %d\", ret, NUM_STATS);\n+\n+\t/* Failure Test: Invalid names (array size lesser than size) */\n+\tsize = NUM_STATS + 1;\n+\tret = rte_latencystats_get_names(wrongnames, size);\n+\tTEST_ASSERT((ret == NUM_STATS), \"Test Failed to get metrics names\");\n+\treturn TEST_SUCCESS;\n+}\n+\n+/* Test case to get latency stats values */\n+static int test_latencystats_get(void)\n+{\n+\tint ret = 0;\n+\tint size = 0;\n+\tstruct rte_metric_value values[NUM_STATS] = { 0 };\n+\tstruct rte_metric_value wrongvalues[NUM_STATS - 2] = { 0 };\n+\n+\t/* Success Test: Valid values and valid size */\n+\tsize = NUM_STATS;\n+\tret = rte_latencystats_get(values, size);\n+\tTEST_ASSERT((ret == NUM_STATS), \"Test Failed to get latency metrics\"\n+\t\t\t\" values\");\n+\tfor (int i = 0; i < NUM_STATS; i++)\n+\t\tprintf(\"values: %ld\\n\", values[i].value);\n+\n+\t/* Failure Test: Invalid values and valid size */\n+\tret = rte_latencystats_get(NULL, size);\n+\tTEST_ASSERT((ret == NUM_STATS), \"Test Failed to get the stats count,\"\n+\t\t    \"Actual: %d Expected: %d\", ret, NUM_STATS);\n+\n+\t/* Failure Test: Valid values and invalid size */\n+\tsize = 0;\n+\tret = rte_latencystats_get(values, size);\n+\tTEST_ASSERT((ret == NUM_STATS), \"Test Failed to get the stats count,\"\n+\t\t    \"Actual: %d Expected: %d\", ret, NUM_STATS);\n+\n+\t/* Failure Test: Invalid values(array size lesser than size)\n+\t * and invalid size\n+\t */\n+\tsize = NUM_STATS + 2;\n+\tret = rte_latencystats_get(wrongvalues, size);\n+\tTEST_ASSERT(ret == NUM_STATS, \"Test Failed to get latency metrics\"\n+\t\t\t\" values\");\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+static int test_latency_ring_setup(void)\n+{\n+\ttest_ring_setup(&ring, &portid);\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+static void test_latency_ring_free(void)\n+{\n+\ttest_ring_free(ring);\n+\ttest_vdev_uninit(\"net_ring_net_ringa\");\n+}\n+\n+static int test_latency_packet_forward(void)\n+{\n+\tint ret;\n+\tstruct rte_mbuf *pbuf[LATENCY_NUM_PACKETS] = { };\n+\tstruct rte_mempool *mp;\n+\tchar poolname[] = \"mbuf_pool\";\n+\n+\tret = test_get_mbuf_from_pool(&mp, pbuf, poolname);\n+\tif (ret < 0) {\n+\t\tprintf(\"allocate mbuf pool Failed\\n\");\n+\t\treturn TEST_FAILED;\n+\t}\n+\tret = test_packet_forward(pbuf, portid, QUEUE_ID);\n+\tif (ret < 0)\n+\t\tprintf(\"send pkts Failed\\n\");\n+\ttest_put_mbuf_to_pool(mp, pbuf);\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+static struct\n+unit_test_suite latencystats_testsuite = {\n+\t.suite_name = \"Latency Stats Unit Test Suite\",\n+\t.setup = test_latency_ring_setup,\n+\t.teardown = test_latency_ring_free,\n+\t.unit_test_cases = {\n+\n+\t\t/* Test Case 1: To check latency init with\n+\t\t * metrics init\n+\t\t */\n+\t\tTEST_CASE_ST(NULL, NULL, test_latency_init),\n+\n+\t\t/* Test Case 2: Do packet forwarding for metrics\n+\t\t * calculation and check the latency metrics values\n+\t\t * are updated\n+\t\t */\n+\t\tTEST_CASE_ST(test_latency_packet_forward, NULL,\n+\t\t\t\ttest_latency_update),\n+\t\t/* Test Case 3: To check whether latency stats names\n+\t\t * are retrieved\n+\t\t */\n+\t\tTEST_CASE_ST(NULL, NULL, test_latencystats_get_names),\n+\n+\t\t/* Test Case 4: To check whether latency stats\n+\t\t * values are retrieved\n+\t\t */\n+\t\tTEST_CASE_ST(NULL, NULL, test_latencystats_get),\n+\n+\t\t/* Test Case 5: To check uninit of latency test */\n+\t\tTEST_CASE_ST(NULL, NULL, test_latency_uninit),\n+\n+\t\tTEST_CASES_END()\n+\t}\n+};\n+\n+static int test_latencystats(void)\n+{\n+\treturn unit_test_suite_runner(&latencystats_testsuite);\n+}\n+\n+REGISTER_TEST_COMMAND(latencystats_autotest, test_latencystats);\n",
    "prefixes": [
        "v7",
        "3/4"
    ]
}