get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 42563,
    "url": "http://patchwork.dpdk.org/api/patches/42563/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1530900059-9531-1-git-send-email-jananeex.m.parthasarathy@intel.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": "<1530900059-9531-1-git-send-email-jananeex.m.parthasarathy@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1530900059-9531-1-git-send-email-jananeex.m.parthasarathy@intel.com",
    "date": "2018-07-06T18:00:59",
    "name": "test: add unit tests for latencystats library",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ae732d60c7c0276c6b13451f1ab9bdcc6cd9ae34",
    "submitter": {
        "id": 1024,
        "url": "http://patchwork.dpdk.org/api/people/1024/?format=api",
        "name": "Jananee Parthasarathy",
        "email": "jananeex.m.parthasarathy@intel.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1530900059-9531-1-git-send-email-jananeex.m.parthasarathy@intel.com/mbox/",
    "series": [
        {
            "id": 462,
            "url": "http://patchwork.dpdk.org/api/series/462/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=462",
            "date": "2018-07-06T18:00:59",
            "name": "test: add unit tests for latencystats library",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/462/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/42563/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/42563/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 531A31BF9F;\n\tFri,  6 Jul 2018 20:01:15 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n\tby dpdk.org (Postfix) with ESMTP id 4C0D71BF99\n\tfor <dev@dpdk.org>; Fri,  6 Jul 2018 20:01:12 +0200 (CEST)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t06 Jul 2018 11:01:11 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga005.fm.intel.com with ESMTP; 06 Jul 2018 11:01:10 -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\tw66I19R5010276; Fri, 6 Jul 2018 19:01:09 +0100",
            "from wgcvswdev001.ir.intel.com (localhost [127.0.0.1])\n\tby wgcvswdev001.ir.intel.com with ESMTP id w66I18p6009894;\n\tFri, 6 Jul 2018 19:01:08 +0100",
            "(from jmparthx@localhost)\n\tby wgcvswdev001.ir.intel.com with ? id w66I18g5009889;\n\tFri, 6 Jul 2018 19:01:08 +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,317,1526367600\"; d=\"scan'208\";a=\"243197529\"",
        "From": "Jananee Parthasarathy <jananeex.m.parthasarathy@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "remy.horton@intel.com, reshma.pattan@intel.com,\n\tJananee Parthasarathy <jananeex.m.parthasarathy@intel.com>,\n\tAgalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>",
        "Date": "Fri,  6 Jul 2018 19:00:59 +0100",
        "Message-Id": "<1530900059-9531-1-git-send-email-jananeex.m.parthasarathy@intel.com>",
        "X-Mailer": "git-send-email 1.7.12.2",
        "Subject": "[dpdk-dev] [PATCH] test: add unit tests for latencystats library",
        "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": "From: Jananee Parthasarathy <jananeex.m.parthasarathy@intel.com> \n\nUnit Test Cases added for latencystats library.\n\nSigned-off-by: Agalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>\nReviewed-by: Reshma Pattan <reshma.pattan@intel.com>\n---\n test/test/Makefile            |   3 +\n test/test/test_latencystats.c | 178 ++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 181 insertions(+)\n create mode 100644 test/test/test_latencystats.c",
    "diff": "diff --git a/test/test/Makefile b/test/test/Makefile\nindex eccc8efcf..5b73dab0e 100644\n--- a/test/test/Makefile\n+++ b/test/test/Makefile\n@@ -134,6 +134,7 @@ SRCS-y += test_func_reentrancy.c\n \n SRCS-y += test_service_cores.c\n \n+\n SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline.c\n SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_num.c\n SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_etheraddr.c\n@@ -180,6 +181,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring_perf.c\n SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_blockcipher.c\n SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c\n \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\n endif\ndiff --git a/test/test/test_latencystats.c b/test/test/test_latencystats.c\nnew file mode 100644\nindex 000000000..6d9809883\n--- /dev/null\n+++ b/test/test/test_latencystats.c\n@@ -0,0 +1,178 @@\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+\n+#include \"test.h\"\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\n+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\n+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\n+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\n+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+\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\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\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\n+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 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\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\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 values\");\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+\n+static struct\n+unit_test_suite latencystats_testsuite  = {\n+\t.suite_name = \"Latency Stats Unit Test Suite\",\n+\t.setup = test_ring_setup,\n+\t.teardown = NULL,\n+\t.unit_test_cases = {\n+\n+\t\t/* Test Case 1: To check latency init with metrics init */\n+\t\tTEST_CASE_ST(NULL, NULL, test_latency_init),\n+\n+\t\t/* Test Case 2: Do packet forwarding for metrics calculation\n+\t\t * and check the latency metrics values are updated\n+\t\t */\n+\t\tTEST_CASE_ST(test_packet_forward, NULL, test_latency_update),\n+\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\n+test_latencystats(void)\n+{\n+\treturn unit_test_suite_runner(&latencystats_testsuite);\n+}\n+\n+REGISTER_TEST_COMMAND(latencystats_autotest, test_latencystats);\n",
    "prefixes": []
}