get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 43303,
    "url": "http://patches.dpdk.org/api/patches/43303/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1532429671-1606-3-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": "<1532429671-1606-3-git-send-email-naga.sureshx.somarowthu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1532429671-1606-3-git-send-email-naga.sureshx.somarowthu@intel.com",
    "date": "2018-07-24T10:54:29",
    "name": "[v5,2/4] test: add unit tests for bitrate library",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "94dc7189cf41bdaaa1a324584b92b155259b87ce",
    "submitter": {
        "id": 1053,
        "url": "http://patches.dpdk.org/api/people/1053/?format=api",
        "name": "Naga Suresh Somarowthu",
        "email": "naga.sureshx.somarowthu@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1532429671-1606-3-git-send-email-naga.sureshx.somarowthu@intel.com/mbox/",
    "series": [
        {
            "id": 737,
            "url": "http://patches.dpdk.org/api/series/737/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=737",
            "date": "2018-07-24T10:54:27",
            "name": "add unit tests for bitrate, latency and pdump libraries",
            "version": 5,
            "mbox": "http://patches.dpdk.org/series/737/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/43303/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/43303/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 3EA0B1DA4;\n\tTue, 24 Jul 2018 12:55:58 +0200 (CEST)",
            "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n\tby dpdk.org (Postfix) with ESMTP id 04E5698\n\tfor <dev@dpdk.org>; Tue, 24 Jul 2018 12:55:55 +0200 (CEST)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t24 Jul 2018 03:55:54 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga004.fm.intel.com with ESMTP; 24 Jul 2018 03:54:54 -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\tw6OAsrc0013923; Tue, 24 Jul 2018 11:54:53 +0100",
            "from wgcvswdev001.ir.intel.com (localhost [127.0.0.1])\n\tby wgcvswdev001.ir.intel.com with ESMTP id w6OAspNM001761;\n\tTue, 24 Jul 2018 11:54:51 +0100",
            "(from jmparthx@localhost)\n\tby wgcvswdev001.ir.intel.com with ? id w6OAspWY001756;\n\tTue, 24 Jul 2018 11:54:51 +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,397,1526367600\"; d=\"scan'208\";a=\"74021523\"",
        "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": "Tue, 24 Jul 2018 11:54:29 +0100",
        "Message-Id": "<1532429671-1606-3-git-send-email-naga.sureshx.somarowthu@intel.com>",
        "X-Mailer": "git-send-email 1.7.12.2",
        "In-Reply-To": "<1532429671-1606-1-git-send-email-naga.sureshx.somarowthu@intel.com>",
        "References": "<1531821650-5506-1-git-send-email-jananeex.m.parthasarathy@intel.com>\n\t<1532429671-1606-1-git-send-email-naga.sureshx.somarowthu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v5 2/4] test: add unit tests for bitrate 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": "Unit Test Cases for BitRate library.\n\nSigned-off-by: Naga Suresh Somarowthu <naga.sureshx.somarowthu@intel.com>\nReviewed-by: Reshma Pattan <reshma.pattan@intel.com>\nReviewed-by: Remy Horton <remy.horton@intel.com>\n---\n test/test/Makefile            |   1 +\n test/test/autotest_data.py    |   6 ++\n test/test/test_bitratestats.c | 227 ++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 234 insertions(+)\n create mode 100644 test/test/test_bitratestats.c",
    "diff": "diff --git a/test/test/Makefile b/test/test/Makefile\nindex 9f7d398e4..8407ae36e 100644\n--- a/test/test/Makefile\n+++ b/test/test/Makefile\n@@ -166,6 +166,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_REORDER) += test_reorder.c\n SRCS-y += virtual_pmd.c\n SRCS-y += packet_burst_generator.c\n SRCS-y += sample_packet_forward.c\n+SRCS-$(CONFIG_RTE_LIBRTE_BITRATE) += test_bitratestats.c\n SRCS-$(CONFIG_RTE_LIBRTE_ACL) += test_acl.c\n \n ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)\ndiff --git a/test/test/autotest_data.py b/test/test/autotest_data.py\nindex aacfe0a66..419520342 100644\n--- a/test/test/autotest_data.py\n+++ b/test/test/autotest_data.py\n@@ -293,6 +293,12 @@ def per_sockets(num):\n         \"Tests\":\n         [\n             {\n+                \"Name\":    \"Bitratestats autotest\",\n+                \"Command\": \"bitratestats_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_bitratestats.c b/test/test/test_bitratestats.c\nnew file mode 100644\nindex 000000000..ccb0acd7c\n--- /dev/null\n+++ b/test/test/test_bitratestats.c\n@@ -0,0 +1,227 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2018 Intel Corporation\n+ */\n+\n+#include <string.h>\n+#include <errno.h>\n+#include <time.h>\n+\n+#include <rte_log.h>\n+#include <rte_lcore.h>\n+#include <rte_mbuf.h>\n+#include <rte_malloc.h>\n+#include <rte_common.h>\n+#include <rte_metrics.h>\n+#include <rte_bitrate.h>\n+\n+#include \"test.h\"\n+#include \"sample_packet_forward.h\"\n+\n+#define BIT_NUM_PACKETS 10\n+#define QUEUE_ID 0\n+\n+uint16_t portid;\n+struct rte_stats_bitrates *bitrate_data;\n+struct rte_ring *ring[NUM_RINGS];\n+\n+/* To test whether rte_stats_bitrate_create is successful */\n+static int\n+test_stats_bitrate_create(void)\n+{\n+\tbitrate_data = rte_stats_bitrate_create();\n+\tTEST_ASSERT(bitrate_data != NULL, \"rte_stats_bitrate_create failed\");\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+/* To test bit rate registration */\n+static int\n+test_stats_bitrate_reg(void)\n+{\n+\tint ret = 0;\n+\n+\t/* Test to register bit rate without metrics init */\n+\tret = rte_stats_bitrate_reg(bitrate_data);\n+\tTEST_ASSERT(ret < 0, \"Test Failed: rte_stats_bitrate_reg succeeded \"\n+\t\t\t\"without metrics init, ret:%d\", ret);\n+\n+\t/* Metrics initialization */\n+\trte_metrics_init(rte_socket_id());\n+\t/* Test to register bit rate after metrics init */\n+\tret = rte_stats_bitrate_reg(bitrate_data);\n+\tTEST_ASSERT((ret >= 0), \"Test Failed: rte_stats_bitrate_reg %d\", ret);\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+/* To test the bit rate registration with invalid pointer */\n+static int\n+test_stats_bitrate_reg_invalidpointer(void)\n+{\n+\tint ret = 0;\n+\n+\tret = rte_stats_bitrate_reg(NULL);\n+\tTEST_ASSERT(ret < 0, \"Test Failed: Expected failure < 0 but \"\n+\t\t\t\"got %d\", ret);\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+/* To test bit rate calculation with invalid bit rate data pointer */\n+static int\n+test_stats_bitrate_calc_invalid_bitrate_data(void)\n+{\n+\tint ret = 0;\n+\n+\tret = rte_stats_bitrate_calc(NULL, portid);\n+\tTEST_ASSERT(ret < 0, \"Test Failed: rte_stats_bitrate_calc \"\n+\t\t\t\"ret:%d\", ret);\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+/* To test the bit rate calculation with invalid portid\n+ * (higher than max ports)\n+ */\n+static int\n+test_stats_bitrate_calc_invalid_portid_1(void)\n+{\n+\tint ret = 0;\n+\n+\tret = rte_stats_bitrate_calc(bitrate_data, 33);\n+\tTEST_ASSERT(ret == -EINVAL, \"Test Failed: Expected -%d for higher \"\n+\t\t\t\"portid rte_stats_bitrate_calc ret:%d\", EINVAL, ret);\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+/* To test the bit rate calculation with invalid portid (lesser than 0) */\n+static int\n+test_stats_bitrate_calc_invalid_portid_2(void)\n+{\n+\tint ret = 0;\n+\n+\tret = rte_stats_bitrate_calc(bitrate_data, -1);\n+\tTEST_ASSERT(ret == -EINVAL, \"Test Failed: Expected -%d for invalid \"\n+\t\t\t\"portid rte_stats_bitrate_calc ret:%d\", EINVAL, ret);\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+/* To test the bit rate calculation with non-existing portid */\n+static int\n+test_stats_bitrate_calc_non_existing_portid(void)\n+{\n+\tint ret = 0;\n+\n+\tret = rte_stats_bitrate_calc(bitrate_data, 31);\n+\tTEST_ASSERT(ret ==  -EINVAL, \"Test Failed: Expected -%d for \"\n+\t\t\t\"non-existing portid rte_stats_bitrate_calc ret:%d\",\n+\t\t\tEINVAL, ret);\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+/* To test the bit rate calculation with valid bit rate data, valid portid */\n+static int\n+test_stats_bitrate_calc(void)\n+{\n+\tint ret = 0;\n+\n+\tret = rte_stats_bitrate_calc(bitrate_data, portid);\n+\tTEST_ASSERT(ret >= 0, \"Test Failed: Expected >=0 for valid portid \"\n+\t\t\t\"rte_stats_bitrate_calc ret:%d\", ret);\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+static int\n+test_bit_packet_forward(void)\n+{\n+\tint ret;\n+\tstruct rte_mbuf *pbuf[BIT_NUM_PACKETS] = { };\n+\tstruct rte_mempool *mp;\n+\tchar poolname[] = \"mbuf_pool\";\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 int\n+test_bit_ring_setup(void)\n+{\n+\ttest_ring_setup(ring, &portid);\n+\tprintf(\"port in ring setup : %d\\n\", portid);\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+static void\n+test_bit_ring_free(void)\n+{\n+\ttest_ring_free(ring[0]);\n+\ttest_vdev_uninit(\"net_ring_net_ringa\");\n+}\n+\n+static struct\n+unit_test_suite bitratestats_testsuite  = {\n+\t.suite_name = \"BitRate Stats Unit Test Suite\",\n+\t.setup = test_bit_ring_setup,\n+\t.teardown = test_bit_ring_free,\n+\t.unit_test_cases = {\n+\t\t/* TEST CASE 1: Test to create bit rate data */\n+\t\tTEST_CASE(test_stats_bitrate_create),\n+\n+\t\t/* TEST CASE 2: Test to register bit rate metrics\n+\t\t * without metrics init and after metrics init\n+\t\t */\n+\t\tTEST_CASE(test_stats_bitrate_reg),\n+\n+\t\t/* TEST CASE 3: Test to register bit rate metrics\n+\t\t * with invalid bit rate data\n+\t\t */\n+\t\tTEST_CASE(test_stats_bitrate_reg_invalidpointer),\n+\n+\t\t/* TEST CASE 4: Test to calculate bit rate data metrics\n+\t\t * with invalid bit rate data\n+\t\t */\n+\t\tTEST_CASE(test_stats_bitrate_calc_invalid_bitrate_data),\n+\n+\t\t/* TEST CASE 5: Test to calculate bit rate data metrics\n+\t\t * with portid exceeding the max ports\n+\t\t */\n+\t\tTEST_CASE(test_stats_bitrate_calc_invalid_portid_1),\n+\n+\t\t/* TEST CASE 6: Test to calculate bit rate data metrics\n+\t\t * with portid less than 0\n+\t\t */\n+\t\tTEST_CASE(test_stats_bitrate_calc_invalid_portid_2),\n+\n+\t\t/* TEST CASE 7: Test to calculate bit rate data metrics\n+\t\t * with non-existing portid\n+\t\t */\n+\t\tTEST_CASE(test_stats_bitrate_calc_non_existing_portid),\n+\n+\t\t/* TEST CASE 8: Test to calculate bit rate data metrics\n+\t\t * with valid portid, valid bit rate data\n+\t\t */\n+\t\tTEST_CASE_ST(test_bit_packet_forward, NULL,\n+\t\t\t\ttest_stats_bitrate_calc),\n+\t\tTEST_CASES_END()\n+\t}\n+};\n+\n+static int\n+test_bitratestats(void)\n+{\n+\treturn unit_test_suite_runner(&bitratestats_testsuite);\n+}\n+REGISTER_TEST_COMMAND(bitratestats_autotest, test_bitratestats);\n",
    "prefixes": [
        "v5",
        "2/4"
    ]
}