Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/43481/?format=api
http://patches.dpdk.org/api/patches/43481/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1533055256-10317-4-git-send-email-reshma.pattan@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": "<1533055256-10317-4-git-send-email-reshma.pattan@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1533055256-10317-4-git-send-email-reshma.pattan@intel.com", "date": "2018-07-31T16:40:54", "name": "[v9,3/5] test: add unit tests for latencystats library", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "67c607a6ef9ab51ee7ecdf74977a4ebfc75c685a", "submitter": { "id": 70, "url": "http://patches.dpdk.org/api/people/70/?format=api", "name": "Pattan, Reshma", "email": "reshma.pattan@intel.com" }, "delegate": null, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1533055256-10317-4-git-send-email-reshma.pattan@intel.com/mbox/", "series": [ { "id": 841, "url": "http://patches.dpdk.org/api/series/841/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=841", "date": "2018-07-31T16:40:51", "name": "add unit tests for bitrate, latency and pdump libraries", "version": 9, "mbox": "http://patches.dpdk.org/series/841/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/43481/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/43481/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 1ABF84C93;\n\tTue, 31 Jul 2018 18:41:10 +0200 (CEST)", "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id 93AB43572\n\tfor <dev@dpdk.org>; Tue, 31 Jul 2018 18:41:05 +0200 (CEST)", "from fmsmga007.fm.intel.com ([10.253.24.52])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t31 Jul 2018 09:41:04 -0700", "from sivswdev02.ir.intel.com (HELO localhost.localdomain)\n\t([10.237.217.46])\n\tby fmsmga007.fm.intel.com with ESMTP; 31 Jul 2018 09:41:03 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.51,427,1526367600\"; d=\"scan'208\";a=\"58605938\"", "From": "Reshma Pattan <reshma.pattan@intel.com>", "To": "thomas@monjalon.net,\n\tdev@dpdk.org", "Cc": "anatoly.burakov@intel.com, jananeex.m.parthasarathy@intel.com,\n\tNaga Suresh Somarowthu <naga.sureshx.somarowthu@intel.com>", "Date": "Tue, 31 Jul 2018 17:40:54 +0100", "Message-Id": "<1533055256-10317-4-git-send-email-reshma.pattan@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": "<1533055256-10317-1-git-send-email-reshma.pattan@intel.com>", "References": "<1533055256-10317-1-git-send-email-reshma.pattan@intel.com>", "Subject": "[dpdk-dev] [PATCH v9 3/5] test: add unit tests for latencystats\n\tlibrary", "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: Naga Suresh Somarowthu <naga.sureshx.somarowthu@intel.com>\n\nUnit 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 test/test/Makefile | 1 +\n test/test/test_latencystats.c | 216 ++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 217 insertions(+)\n create mode 100644 test/test/test_latencystats.c", "diff": "diff --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/test_latencystats.c b/test/test/test_latencystats.c\nnew file mode 100644\nindex 000000000..f2287a2b7\n--- /dev/null\n+++ b/test/test/test_latencystats.c\n@@ -0,0 +1,216 @@\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+#include <rte_mbuf.h>\n+#include \"test.h\"\n+#include \"sample_packet_forward.h\"\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;\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\");\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;\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\"\n+\t\t\t\" 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 \"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": [ "v9", "3/5" ] }{ "id": 43481, "url": "