From patchwork Wed Jun 19 17:08:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 55079 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 975C41D0C9; Wed, 19 Jun 2019 19:08:16 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 1DF471D0C0; Wed, 19 Jun 2019 19:08:13 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jun 2019 10:08:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,393,1557212400"; d="scan'208";a="165076985" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.223.2]) by orsmga006.jf.intel.com with ESMTP; 19 Jun 2019 10:08:12 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , shreyansh.jain@nxp.com, stable@dpdk.org Date: Wed, 19 Jun 2019 18:08:01 +0100 Message-Id: <20190619170802.7691-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190619170802.7691-1-bruce.richardson@intel.com> References: <20190619170802.7691-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 1/2] raw/skeleton: fix failing test case X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The freeing of the malloced memory is difficult when using asserts to cause early abort of the test cases, since that can leak memory. The original placement of the free call caused a memory leak if the test finished early, while a fix for that leak caused the test to fail at times due to the memory variable being referenced after free. For a case like this, using stack rather than heap memory is just easier and avoids all issues. Fixes: 55ca1b0f2151 ("raw/skeleton: add test cases") Fixes: 88d0e47880ec ("raw/skeleton: fix memory leak on test failure") Cc: shreyansh.jain@nxp.com Cc: stable@dpdk.org Signed-off-by: Bruce Richardson --- drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c b/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c index 359c9e296..a0961c77b 100644 --- a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c +++ b/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c @@ -274,17 +274,14 @@ static int test_rawdev_attr_set_get(void) { int ret; - int *dummy_value; + int dummy_value_store; + int *dummy_value = &dummy_value_store; uint64_t ret_value; /* Set an attribute and fetch it */ ret = rte_rawdev_set_attr(TEST_DEV_ID, "Test1", 100); RTE_TEST_ASSERT(!ret, "Unable to set an attribute (Test1)"); - dummy_value = malloc(sizeof(int)); - if (!dummy_value) - RTE_TEST_ASSERT(1, "Unable to allocate memory (dummy_value)"); - *dummy_value = 200; ret = rte_rawdev_set_attr(TEST_DEV_ID, "Test2", (uintptr_t)dummy_value); @@ -294,7 +291,6 @@ test_rawdev_attr_set_get(void) "Attribute (Test1) not set correctly (%" PRIu64 ")", ret_value); - free(dummy_value); ret_value = 0; ret = rte_rawdev_get_attr(TEST_DEV_ID, "Test2", &ret_value); From patchwork Wed Jun 19 17:08:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 55080 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BB5811D0DF; Wed, 19 Jun 2019 19:08:19 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 957DB1D0D0; Wed, 19 Jun 2019 19:08:17 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jun 2019 10:08:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,393,1557212400"; d="scan'208";a="165076996" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.223.2]) by orsmga006.jf.intel.com with ESMTP; 19 Jun 2019 10:08:16 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , shreyansh.jain@nxp.com, stable@dpdk.org Date: Wed, 19 Jun 2019 18:08:02 +0100 Message-Id: <20190619170802.7691-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190619170802.7691-1-bruce.richardson@intel.com> References: <20190619170802.7691-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 2/2] app/test: add missing rawdev autotest to meson build X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" the test_rawdev.c file was missing from the meson.build file, and the test case from the list of test commands. Fixes: 55ca1b0f2151 ("raw/skeleton: add test cases") Cc: shreyansh.jain@nxp.com Cc: stable@dpdk.org Signed-off-by: Bruce Richardson --- app/test/meson.build | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/test/meson.build b/app/test/meson.build index 4de856f93..9b52ec9d7 100644 --- a/app/test/meson.build +++ b/app/test/meson.build @@ -89,6 +89,7 @@ test_sources = files('commands.c', 'test_power_acpi_cpufreq.c', 'test_power_kvm_vm.c', 'test_prefetch.c', + 'test_rawdev.c', 'test_rcu_qsbr.c', 'test_rcu_qsbr_perf.c', 'test_reciprocal_division.c', @@ -140,6 +141,7 @@ test_deps = ['acl', 'metrics', 'pipeline', 'port', + 'rawdev', 'rcu', 'reorder', 'ring', @@ -179,6 +181,7 @@ fast_parallel_test_names = [ 'multiprocess_autotest', 'per_lcore_autotest', 'prefetch_autotest', + 'rawdev_autotest', 'rcu_qsbr_autotest', 'red_autotest', 'ring_autotest',