get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 43856,
    "url": "http://patches.dpdk.org/api/patches/43856/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1535115087-2442-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": "<1535115087-2442-3-git-send-email-naga.sureshx.somarowthu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1535115087-2442-3-git-send-email-naga.sureshx.somarowthu@intel.com",
    "date": "2018-08-24T12:51:25",
    "name": "[v13,2/4] test: add unit tests for bitrate library",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "704d07478afe31408af36177b98b19a08264b094",
    "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-3-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/43856/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/43856/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 8C0714CB3;\n\tFri, 24 Aug 2018 14:51:49 +0200 (CEST)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby dpdk.org (Postfix) with ESMTP id 2D9754C95\n\tfor <dev@dpdk.org>; Fri, 24 Aug 2018 14:51:43 +0200 (CEST)",
            "from orsmga007.jf.intel.com ([10.7.209.58])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t24 Aug 2018 05:51:42 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga007.jf.intel.com with ESMTP; 24 Aug 2018 05:51:41 -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\tw7OCpeCd031744; Fri, 24 Aug 2018 13:51:40 +0100",
            "from wgcvswdev001.ir.intel.com (localhost [127.0.0.1])\n\tby wgcvswdev001.ir.intel.com with ESMTP id w7OCpXO4002537;\n\tFri, 24 Aug 2018 13:51:33 +0100",
            "(from jmparthx@localhost)\n\tby wgcvswdev001.ir.intel.com with ? id w7OCpX1N002532;\n\tFri, 24 Aug 2018 13:51:33 +0100"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.53,281,1531810800\"; d=\"scan'208\";a=\"67568753\"",
        "From": "Naga Suresh Somarowthu <naga.sureshx.somarowthu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "reshma.pattan@intel.com,\n\tNaga Suresh Somarowthu <naga.sureshx.somarowthu@intel.com>",
        "Date": "Fri, 24 Aug 2018 13:51:25 +0100",
        "Message-Id": "<1535115087-2442-3-git-send-email-naga.sureshx.somarowthu@intel.com>",
        "X-Mailer": "git-send-email 1.7.12.2",
        "In-Reply-To": "<1535115087-2442-1-git-send-email-naga.sureshx.somarowthu@intel.com>",
        "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>",
        "Subject": "[dpdk-dev] [PATCH v13 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 MAINTAINERS                   |   1 +\n test/test/Makefile            |   1 +\n test/test/autotest_data.py    |   6 ++\n test/test/meson.build         |   4 +\n test/test/test_bitratestats.c | 226 ++++++++++++++++++++++++++++++++++++++++++\n 5 files changed, 238 insertions(+)\n create mode 100644 test/test/test_bitratestats.c",
    "diff": "diff --git a/MAINTAINERS b/MAINTAINERS\nindex e2e0a27da..4e55c97e1 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -1144,6 +1144,7 @@ F: lib/librte_metrics/\n Bit-rate statistics\n M: Remy Horton <remy.horton@intel.com>\n F: lib/librte_bitratestats/\n+F: test/test/test_bitratestats.c\n \n Latency statistics\n M: Reshma Pattan <reshma.pattan@intel.com>\ndiff --git a/test/test/Makefile b/test/test/Makefile\nindex 9f7d398e4..c619877f0 100644\n--- a/test/test/Makefile\n+++ b/test/test/Makefile\n@@ -183,6 +183,7 @@ 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 SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_asym.c\n+SRCS-$(CONFIG_RTE_LIBRTE_BITRATE) += test_bitratestats.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 f68d9b111..b253bf8f0 100644\n--- a/test/test/autotest_data.py\n+++ b/test/test/autotest_data.py\n@@ -482,6 +482,12 @@\n         \"Func\":    default_autotest,\n         \"Report\":  None,\n     },\n+    {\n+        \"Name\":    \"Bitratestats autotest\",\n+        \"Command\": \"bitratestats_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 2a7e7d074..f9fab3109 100644\n--- a/test/test/meson.build\n+++ b/test/test/meson.build\n@@ -9,6 +9,7 @@ test_sources = files('commands.c',\n \t'test_alarm.c',\n \t'test_atomic.c',\n \t'test_barrier.c',\n+\t'test_bitratestats.c',\n \t'test_bpf.c',\n \t'test_byteorder.c',\n \t'test_cmdline.c',\n@@ -100,6 +101,7 @@ test_sources = files('commands.c',\n )\n \n test_deps = ['acl',\n+\t'bitratestats',\n \t'bpf',\n \t'cfgfile',\n \t'cmdline',\n@@ -112,6 +114,7 @@ test_deps = ['acl',\n \t'hash',\n \t'lpm',\n \t'member',\n+\t'metrics',\n \t'pipeline',\n \t'port',\n \t'reorder',\n@@ -124,6 +127,7 @@ test_names = [\n \t'alarm_autotest',\n \t'atomic_autotest',\n \t'barrier_autotest',\n+\t'bitratestats_autotest',\n \t'byteorder_autotest',\n \t'cmdline_autotest',\n \t'common_autotest',\ndiff --git a/test/test/test_bitratestats.c b/test/test/test_bitratestats.c\nnew file mode 100644\nindex 000000000..32b1b0fc0\n--- /dev/null\n+++ b/test/test/test_bitratestats.c\n@@ -0,0 +1,226 @@\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 <errno.h>\n+#include <rte_lcore.h>\n+#include <rte_memzone.h>\n+#include <rte_metrics.h>\n+#include <rte_bitrate.h>\n+\n+#include \"sample_packet_forward.h\"\n+#include \"test.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;\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);\n+\ttest_vdev_uninit(\"net_ring_net_ringa\");\n+\trte_memzone_free(rte_memzone_lookup(\"RTE_METRICS\"));\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": [
        "v13",
        "2/4"
    ]
}