* [dpdk-dev] [PATCH] test/test: clean up memory for func reentrancy test
@ 2018-01-31 14:17 Anatoly Burakov
2018-02-01 13:00 ` Olivier Matz
0 siblings, 1 reply; 3+ messages in thread
From: Anatoly Burakov @ 2018-01-31 14:17 UTC (permalink / raw)
To: dev; +Cc: Olivier Matz, Bruce Richardson, Pablo de Lara
Function reentrancy test limits maximum number of iterations based
on the number of memzones and cores, however it doesn't free the
memzones after the fact, so on a machine with big amount of cores
the tests will fail due to running out of memzones.
Fix this by introducing cleanup functions for ring and mempool
reentrancy tests.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
test/test/test_func_reentrancy.c | 40 +++++++++++++++++++++++++++++++++++++---
1 file changed, 37 insertions(+), 3 deletions(-)
diff --git a/test/test/test_func_reentrancy.c b/test/test/test_func_reentrancy.c
index f43ec2e..a0ed19d 100644
--- a/test/test/test_func_reentrancy.c
+++ b/test/test/test_func_reentrancy.c
@@ -81,6 +81,22 @@ test_eal_init_once(__attribute__((unused)) void *arg)
/*
* ring create/lookup reentrancy test
*/
+static void
+ring_clean(unsigned int lcore_id)
+{
+ struct rte_ring *rp;
+ char ring_name[MAX_STRING_SIZE];
+ int i;
+
+ for (i = 0; i < MAX_ITER_TIMES; i++) {
+ snprintf(ring_name, sizeof(ring_name),
+ "fr_test_%d_%d", lcore_id, i);
+ rp = rte_ring_lookup(ring_name);
+ if (rp != NULL)
+ rte_ring_free(rp);
+ }
+}
+
static int
ring_create_lookup(__attribute__((unused)) void *arg)
{
@@ -127,6 +143,23 @@ my_obj_init(struct rte_mempool *mp, __attribute__((unused)) void *arg,
*objnum = i;
}
+static void
+mempool_clean(unsigned int lcore_id)
+{
+ struct rte_mempool *mp;
+ char mempool_name[MAX_STRING_SIZE];
+ int i;
+
+ /* verify all ring created successful */
+ for (i = 0; i < MAX_ITER_TIMES; i++) {
+ snprintf(mempool_name, sizeof(mempool_name), "fr_test_%d_%d",
+ lcore_id, i);
+ mp = rte_mempool_lookup(mempool_name);
+ if (mp != NULL)
+ rte_mempool_free(mp);
+ }
+}
+
static int
mempool_create_lookup(__attribute__((unused)) void *arg)
{
@@ -312,7 +345,7 @@ fbk_create_free(__attribute__((unused)) void *arg)
#ifdef RTE_LIBRTE_LPM
static void
-lpm_clean(unsigned lcore_id)
+lpm_clean(unsigned int lcore_id)
{
char lpm_name[MAX_STRING_SIZE];
struct rte_lpm *lpm;
@@ -383,8 +416,9 @@ struct test_case{
/* All test cases in the test suite */
struct test_case test_cases[] = {
{ test_eal_init_once, NULL, NULL, "eal init once" },
- { ring_create_lookup, NULL, NULL, "ring create/lookup" },
- { mempool_create_lookup, NULL, NULL, "mempool create/lookup" },
+ { ring_create_lookup, NULL, ring_clean, "ring create/lookup" },
+ { mempool_create_lookup, NULL, mempool_clean,
+ "mempool create/lookup" },
#ifdef RTE_LIBRTE_HASH
{ hash_create_free, NULL, hash_clean, "hash create/free" },
{ fbk_create_free, NULL, fbk_clean, "fbk create/free" },
--
2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] test/test: clean up memory for func reentrancy test
2018-01-31 14:17 [dpdk-dev] [PATCH] test/test: clean up memory for func reentrancy test Anatoly Burakov
@ 2018-02-01 13:00 ` Olivier Matz
2018-02-06 0:44 ` Thomas Monjalon
0 siblings, 1 reply; 3+ messages in thread
From: Olivier Matz @ 2018-02-01 13:00 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, Bruce Richardson, Pablo de Lara
On Wed, Jan 31, 2018 at 02:17:32PM +0000, Anatoly Burakov wrote:
> Function reentrancy test limits maximum number of iterations based
> on the number of memzones and cores, however it doesn't free the
> memzones after the fact, so on a machine with big amount of cores
> the tests will fail due to running out of memzones.
>
> Fix this by introducing cleanup functions for ring and mempool
> reentrancy tests.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Not specifically related to this patch, but it seems that the func_reent
test cannot be launched twice, because the objects "fr_test_once" are
not freed. I'll see if I can submit a patch in the coming days.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] test/test: clean up memory for func reentrancy test
2018-02-01 13:00 ` Olivier Matz
@ 2018-02-06 0:44 ` Thomas Monjalon
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2018-02-06 0:44 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, Olivier Matz, Bruce Richardson, Pablo de Lara
01/02/2018 14:00, Olivier Matz:
> On Wed, Jan 31, 2018 at 02:17:32PM +0000, Anatoly Burakov wrote:
> > Function reentrancy test limits maximum number of iterations based
> > on the number of memzones and cores, however it doesn't free the
> > memzones after the fact, so on a machine with big amount of cores
> > the tests will fail due to running out of memzones.
> >
> > Fix this by introducing cleanup functions for ring and mempool
> > reentrancy tests.
> >
> > Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
Applied, thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-02-06 0:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-31 14:17 [dpdk-dev] [PATCH] test/test: clean up memory for func reentrancy test Anatoly Burakov
2018-02-01 13:00 ` Olivier Matz
2018-02-06 0:44 ` Thomas Monjalon
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).