* [dpdk-stable] [PATCH 1/2] raw/skeleton: fix failing test case
[not found] <20190619170802.7691-1-bruce.richardson@intel.com>
@ 2019-06-19 17:08 ` Bruce Richardson
2019-06-19 17:08 ` [dpdk-stable] [PATCH 2/2] app/test: add missing rawdev autotest to meson build Bruce Richardson
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Bruce Richardson @ 2019-06-19 17:08 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, shreyansh.jain, stable
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 <bruce.richardson@intel.com>
---
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);
--
2.21.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-stable] [PATCH 2/2] app/test: add missing rawdev autotest to meson build
[not found] <20190619170802.7691-1-bruce.richardson@intel.com>
2019-06-19 17:08 ` [dpdk-stable] [PATCH 1/2] raw/skeleton: fix failing test case Bruce Richardson
@ 2019-06-19 17:08 ` Bruce Richardson
[not found] ` <20190621155659.29297-1-bruce.richardson@intel.com>
[not found] ` <20190702095608.20722-1-bruce.richardson@intel.com>
3 siblings, 0 replies; 8+ messages in thread
From: Bruce Richardson @ 2019-06-19 17:08 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, shreyansh.jain, stable
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 <bruce.richardson@intel.com>
---
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',
--
2.21.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-stable] [PATCH v2 1/4] raw/skeleton: fix failing test case
[not found] ` <20190621155659.29297-1-bruce.richardson@intel.com>
@ 2019-06-21 15:56 ` Bruce Richardson
2019-06-27 11:50 ` [dpdk-stable] [dpdk-dev] " Hemant Agrawal
2019-07-01 18:03 ` [dpdk-stable] " Thomas Monjalon
2019-06-21 15:56 ` [dpdk-stable] [PATCH v2 2/4] app/test: add missing rawdev test to meson build Bruce Richardson
1 sibling, 2 replies; 8+ messages in thread
From: Bruce Richardson @ 2019-06-21 15:56 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, shreyansh.jain, stable
Rawdev unit test for setting and getting parameters is failing because
of a pointer value being dereferenced after the memory it pointed to is
freed.
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 <bruce.richardson@intel.com>
---
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);
--
2.21.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-stable] [PATCH v2 2/4] app/test: add missing rawdev test to meson build
[not found] ` <20190621155659.29297-1-bruce.richardson@intel.com>
2019-06-21 15:56 ` [dpdk-stable] [PATCH v2 1/4] raw/skeleton: fix failing test case Bruce Richardson
@ 2019-06-21 15:56 ` Bruce Richardson
2019-07-01 18:10 ` Thomas Monjalon
1 sibling, 1 reply; 8+ messages in thread
From: Bruce Richardson @ 2019-06-21 15:56 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, shreyansh.jain, stable
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 <bruce.richardson@intel.com>
---
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',
--
2.21.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH v2 1/4] raw/skeleton: fix failing test case
2019-06-21 15:56 ` [dpdk-stable] [PATCH v2 1/4] raw/skeleton: fix failing test case Bruce Richardson
@ 2019-06-27 11:50 ` Hemant Agrawal
2019-07-01 18:03 ` [dpdk-stable] " Thomas Monjalon
1 sibling, 0 replies; 8+ messages in thread
From: Hemant Agrawal @ 2019-06-27 11:50 UTC (permalink / raw)
To: Bruce Richardson, dev; +Cc: Shreyansh Jain, stable
Series-Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
On 21-Jun-19 9:26 PM, Bruce Richardson wrote:
> Rawdev unit test for setting and getting parameters is failing because
> of a pointer value being dereferenced after the memory it pointed to is
> freed.
>
> 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 <bruce.richardson@intel.com>
> ---
> 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);
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-stable] [PATCH v2 1/4] raw/skeleton: fix failing test case
2019-06-21 15:56 ` [dpdk-stable] [PATCH v2 1/4] raw/skeleton: fix failing test case Bruce Richardson
2019-06-27 11:50 ` [dpdk-stable] [dpdk-dev] " Hemant Agrawal
@ 2019-07-01 18:03 ` Thomas Monjalon
1 sibling, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2019-07-01 18:03 UTC (permalink / raw)
To: Bruce Richardson; +Cc: stable, dev, shreyansh.jain
21/06/2019 17:56, Bruce Richardson:
> Rawdev unit test for setting and getting parameters is failing because
> of a pointer value being dereferenced after the memory it pointed to is
> freed.
>
> 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 <bruce.richardson@intel.com>
This test is already fixed by another patch:
http://git.dpdk.org/dpdk/commit/?id=dcb1595956
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-stable] [PATCH v2 2/4] app/test: add missing rawdev test to meson build
2019-06-21 15:56 ` [dpdk-stable] [PATCH v2 2/4] app/test: add missing rawdev test to meson build Bruce Richardson
@ 2019-07-01 18:10 ` Thomas Monjalon
0 siblings, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2019-07-01 18:10 UTC (permalink / raw)
To: Bruce Richardson; +Cc: stable, dev, shreyansh.jain
21/06/2019 17:56, Bruce Richardson:
> 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 <bruce.richardson@intel.com>
> ---
> @@ -179,6 +181,7 @@ fast_parallel_test_names = [
> 'multiprocess_autotest',
> 'per_lcore_autotest',
> 'prefetch_autotest',
> + 'rawdev_autotest',
> 'rcu_qsbr_autotest',
> 'red_autotest',
> 'ring_autotest',
For consistency, I think rawdev_autotest should go in driver_test_names,
as it is testing the skeleton driver.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-stable] [PATCH v3 1/3] app/test: add missing rawdev autotest to meson build
[not found] ` <20190702095608.20722-1-bruce.richardson@intel.com>
@ 2019-07-02 9:56 ` Bruce Richardson
0 siblings, 0 replies; 8+ messages in thread
From: Bruce Richardson @ 2019-07-02 9:56 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, shreyansh.jain, stable, Hemant Agrawal
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 <bruce.richardson@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
app/test/meson.build | 3 +++
1 file changed, 3 insertions(+)
diff --git a/app/test/meson.build b/app/test/meson.build
index 562b93efb..466fd56da 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -91,6 +91,7 @@ test_sources = files('commands.c',
'test_power_kvm_vm.c',
'test_prefetch.c',
'test_rand_perf.c',
+ 'test_rawdev.c',
'test_rcu_qsbr.c',
'test_rcu_qsbr_perf.c',
'test_reciprocal_division.c',
@@ -142,6 +143,7 @@ test_deps = ['acl',
'metrics',
'pipeline',
'port',
+ 'rawdev',
'rcu',
'reorder',
'ring',
@@ -279,6 +281,7 @@ driver_test_names = [
'link_bonding_autotest',
'link_bonding_mode4_autotest',
'link_bonding_rssconf_autotest',
+ 'rawdev_autotest',
]
dump_test_names = [
--
2.21.0
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-07-02 9:56 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20190619170802.7691-1-bruce.richardson@intel.com>
2019-06-19 17:08 ` [dpdk-stable] [PATCH 1/2] raw/skeleton: fix failing test case Bruce Richardson
2019-06-19 17:08 ` [dpdk-stable] [PATCH 2/2] app/test: add missing rawdev autotest to meson build Bruce Richardson
[not found] ` <20190621155659.29297-1-bruce.richardson@intel.com>
2019-06-21 15:56 ` [dpdk-stable] [PATCH v2 1/4] raw/skeleton: fix failing test case Bruce Richardson
2019-06-27 11:50 ` [dpdk-stable] [dpdk-dev] " Hemant Agrawal
2019-07-01 18:03 ` [dpdk-stable] " Thomas Monjalon
2019-06-21 15:56 ` [dpdk-stable] [PATCH v2 2/4] app/test: add missing rawdev test to meson build Bruce Richardson
2019-07-01 18:10 ` Thomas Monjalon
[not found] ` <20190702095608.20722-1-bruce.richardson@intel.com>
2019-07-02 9:56 ` [dpdk-stable] [PATCH v3 1/3] app/test: add missing rawdev autotest " Bruce Richardson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).