get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 43858,
    "url": "http://patches.dpdk.org/api/patches/43858/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1535115087-2442-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": "<1535115087-2442-4-git-send-email-naga.sureshx.somarowthu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1535115087-2442-4-git-send-email-naga.sureshx.somarowthu@intel.com",
    "date": "2018-08-24T12:51:26",
    "name": "[v13,3/4] test: add unit tests for latencystats library",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "2233fef852157a6f81ecf4036fd276f5e431e295",
    "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/1535115087-2442-4-git-send-email-naga.sureshx.somarowthu@intel.com/mbox/",
    "series": [
        {
            "id": 1045,
            "url": "http://patches.dpdk.org/api/series/1045/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1045",
            "date": "2018-08-24T12:51:23",
            "name": "add unit tests for bitrate, latency and pdump libraries",
            "version": 13,
            "mbox": "http://patches.dpdk.org/series/1045/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/43858/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/43858/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "X-Amp-File-Uploaded": "False",
        "Subject": "[dpdk-dev] [PATCH v13 3/4] test: add unit tests for latencystats\n\tlibrary",
        "List-Post": "<mailto:dev@dpdk.org>",
        "X-Mailer": "git-send-email 1.7.12.2",
        "X-Original-To": "patchwork@dpdk.org",
        "Cc": "reshma.pattan@intel.com,\n\tNaga Suresh Somarowthu <naga.sureshx.somarowthu@intel.com>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "From": "Naga Suresh Somarowthu <naga.sureshx.somarowthu@intel.com>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-BeenThere": "dev@dpdk.org",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Date": "Fri, 24 Aug 2018 13:51:26 +0100",
        "Precedence": "list",
        "In-Reply-To": "<1535115087-2442-1-git-send-email-naga.sureshx.somarowthu@intel.com>",
        "Message-Id": "<1535115087-2442-4-git-send-email-naga.sureshx.somarowthu@intel.com>",
        "X-Mailman-Version": "2.1.15",
        "Errors-To": "dev-bounces@dpdk.org",
        "References": "<1533299698-20950-1-git-send-email-naga.sureshx.somarowthu@intel.com>\n\t<1535115087-2442-1-git-send-email-naga.sureshx.somarowthu@intel.com>",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "Delivered-To": "patchwork@dpdk.org",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id EA41A4F9C;\n\tFri, 24 Aug 2018 14:52:03 +0200 (CEST)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby dpdk.org (Postfix) with ESMTP id 00A334F90\n\tfor <dev@dpdk.org>; Fri, 24 Aug 2018 14:52:01 +0200 (CEST)",
            "from fmsmga007.fm.intel.com ([10.253.24.52])\n\tby orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t24 Aug 2018 05:52:01 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga007.fm.intel.com with ESMTP; 24 Aug 2018 05:51: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\tw7OCpfdm031747; Fri, 24 Aug 2018 13:51:41 +0100",
            "from wgcvswdev001.ir.intel.com (localhost [127.0.0.1])\n\tby wgcvswdev001.ir.intel.com with ESMTP id w7OCpYhg002546;\n\tFri, 24 Aug 2018 13:51:34 +0100",
            "(from jmparthx@localhost)\n\tby wgcvswdev001.ir.intel.com with ? id w7OCpY4E002541;\n\tFri, 24 Aug 2018 13:51:34 +0100"
        ],
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "X-ExtLoop1": "1",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "To": "dev@dpdk.org",
        "X-IronPort-AV": "E=Sophos;i=\"5.53,281,1531810800\"; d=\"scan'208\";a=\"64899924\""
    },
    "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 MAINTAINERS                   |   1 +\n test/test/Makefile            |   1 +\n test/test/autotest_data.py    |   6 ++\n test/test/meson.build         |   3 +\n test/test/test_latencystats.c | 224 ++++++++++++++++++++++++++++++++++++++++++\n 5 files changed, 235 insertions(+)\n create mode 100644 test/test/test_latencystats.c",
    "diff": "diff --git a/MAINTAINERS b/MAINTAINERS\nindex 4e55c97e1..886646fd1 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -1149,6 +1149,7 @@ F: test/test/test_bitratestats.c\n Latency statistics\n M: Reshma Pattan <reshma.pattan@intel.com>\n F: lib/librte_latencystats/\n+F: test/test/test_latencystats.c\n \n BPF - EXPERIMENTAL\n M: Konstantin Ananyev <konstantin.ananyev@intel.com>\ndiff --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 b253bf8f0..f44e31d33 100644\n--- a/test/test/autotest_data.py\n+++ b/test/test/autotest_data.py\n@@ -488,6 +488,12 @@\n         \"Func\":    default_autotest,\n         \"Report\":  None,\n     },\n+    {\n+        \"Name\":    \"Latencystats autotest\",\n+        \"Command\": \"latencystats_autotest\",\n+        \"Func\":    default_autotest,\n+        \"Report\":  None,\n+    },\n     #\n     #Please always keep all dump tests at the end and together!\n     #\ndiff --git a/test/test/meson.build b/test/test/meson.build\nindex f9fab3109..d3385a3e2 100644\n--- a/test/test/meson.build\n+++ b/test/test/meson.build\n@@ -47,6 +47,7 @@ test_sources = files('commands.c',\n \t'test_interrupts.c',\n \t'test_kni.c',\n \t'test_kvargs.c',\n+\t'test_latencystats.c',\n \t'test_link_bonding.c',\n \t'test_link_bonding_mode4.c',\n \t'test_logs.c',\n@@ -112,6 +113,7 @@ test_deps = ['acl',\n \t'eventdev',\n \t'flow_classify',\n \t'hash',\n+\t'latencystats',\n \t'lpm',\n \t'member',\n \t'metrics',\n@@ -170,6 +172,7 @@ test_names = [\n \t'interrupt_autotest',\n \t'kni_autotest',\n \t'kvargs_autotest',\n+\t'latencystats_autotest',\n \t'link_bonding_autotest',\n \t'link_bonding_mode4_autotest',\n \t'logs_autotest',\ndiff --git a/test/test/test_latencystats.c b/test/test/test_latencystats.c\nnew file mode 100644\nindex 000000000..039c508cd\n--- /dev/null\n+++ b/test/test/test_latencystats.c\n@@ -0,0 +1,224 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2018 Intel Corporation\n+ */\n+\n+#include <stdio.h>\n+#include <stdint.h>\n+#include <string.h>\n+\n+#include <rte_latencystats.h>\n+#include \"rte_lcore.h\"\n+#include \"rte_metrics.h\"\n+\n+#include \"sample_packet_forward.h\"\n+#include \"test.h\"\n+\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, i = 0;\n+\tint size = 0;\n+\tstruct rte_metric_name names[NUM_STATS];\n+\tstruct rte_metric_name wrongnames[NUM_STATS - 2];\n+\n+\tsize_t m_size = sizeof(struct rte_metric_name);\n+\tfor (i = 0; i < NUM_STATS; i++)\n+\t\tmemset(&names[i], 0, m_size);\n+\tfor (i = 0; i < NUM_STATS - 2; i++)\n+\t\tmemset(&wrongnames[i], 0, m_size);\n+\n+\t/* Success Test: Valid names and size */\n+\tsize = NUM_STATS;\n+\tret = rte_latencystats_get_names(names, size);\n+\tfor (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, i = 0;\n+\tint size = 0;\n+\tstruct rte_metric_value values[NUM_STATS];\n+\tstruct rte_metric_value wrongvalues[NUM_STATS - 2];\n+\n+\tsize_t v_size = sizeof(struct rte_metric_value);\n+\tfor (i = 0; i < NUM_STATS; i++)\n+\t\tmemset(&values[i], 0, v_size);\n+\tfor (i = 0; i < NUM_STATS - 2; i++)\n+\t\tmemset(&wrongvalues[i], 0, v_size);\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+\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": [
        "v13",
        "3/4"
    ]
}