Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/42553/?format=api
http://patchwork.dpdk.org/api/patches/42553/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1530897688-22716-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": "<1530897688-22716-1-git-send-email-jananeex.m.parthasarathy@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1530897688-22716-1-git-send-email-jananeex.m.parthasarathy@intel.com", "date": "2018-07-06T17:21:28", "name": "test: add unit tests for bitrate library", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "7c003401e1e09d24becf69428b178fa9756759f4", "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/1530897688-22716-1-git-send-email-jananeex.m.parthasarathy@intel.com/mbox/", "series": [ { "id": 461, "url": "http://patchwork.dpdk.org/api/series/461/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=461", "date": "2018-07-06T17:21:28", "name": "test: add unit tests for bitrate library", "version": 1, "mbox": "http://patchwork.dpdk.org/series/461/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/42553/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/42553/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 E5CC01BF9A;\n\tFri, 6 Jul 2018 19:21:56 +0200 (CEST)", "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby dpdk.org (Postfix) with ESMTP id 82CDD1BF38\n\tfor <dev@dpdk.org>; Fri, 6 Jul 2018 19:21:46 +0200 (CEST)", "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t06 Jul 2018 10:21:45 -0700", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga002.jf.intel.com with ESMTP; 06 Jul 2018 10:21:38 -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\tw66HLc2t001258; Fri, 6 Jul 2018 18:21:38 +0100", "from wgcvswdev001.ir.intel.com (localhost [127.0.0.1])\n\tby wgcvswdev001.ir.intel.com with ESMTP id w66HLbwG022822;\n\tFri, 6 Jul 2018 18:21:37 +0100", "(from jmparthx@localhost)\n\tby wgcvswdev001.ir.intel.com with ? id w66HLb0H022818;\n\tFri, 6 Jul 2018 18:21:37 +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=\"72787342\"", "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\tChaitanya Babu Talluri <tallurix.chaitanya.babu@intel.com>", "Date": "Fri, 6 Jul 2018 18:21:28 +0100", "Message-Id": "<1530897688-22716-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 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": "From: Jananee Parthasarathy <jananeex.m.parthasarathy@intel.com> \n\nUnit Test Cases for BitRate library.\n\nSigned-off-by: Chaitanya Babu Talluri <tallurix.chaitanya.babu@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_bitratestats.c | 187 ++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 194 insertions(+)\n create mode 100644 test/test/test_bitratestats.c", "diff": "diff --git a/test/test/Makefile b/test/test/Makefile\nindex eccc8efcf..039b6ac6d 100644\n--- a/test/test/Makefile\n+++ b/test/test/Makefile\n@@ -179,6 +179,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring_perf.c\n \n SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_blockcipher.c\n SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.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 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..8014475af\n--- /dev/null\n+++ b/test/test/test_bitratestats.c\n@@ -0,0 +1,187 @@\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_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+extern int tx_portid, rx_portid;\n+struct rte_stats_bitrates *bitrate_data;\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+\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, tx_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, tx_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 struct\n+unit_test_suite bitratestats_testsuite = {\n+\t.suite_name = \"BitRate Stats Unit Test Suite\",\n+\t.setup = test_ring_setup,\n+\t.teardown = NULL,\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_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": [] }{ "id": 42553, "url": "