DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Olivier MATZ <olivier.matz@6wind.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH] app/test: fix failure on mempool autotest retry
Date: Wed, 25 Apr 2018 18:00:37 +0100	[thread overview]
Message-ID: <1524675637-3037-1-git-send-email-arybchenko@solarflare.com> (raw)

Single producer / single consumer mempool handle is stored in static
variable and the mempool allocated if stored value is NULL.
If the mempool is freed, NULL should be restored to make sure that
the mempool is allocated once again next time when the test is run.

Fixes: 8ef772aee072 ("app/test: rework mempool test")
Cc: stable@dpdk.org

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 test/test/test_mempool.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c
index 8d29af21e..eebb1f24d 100644
--- a/test/test/test_mempool.c
+++ b/test/test/test_mempool.c
@@ -327,17 +327,17 @@ test_mempool_sp_sc(void)
 	}
 	if (rte_mempool_lookup("test_mempool_sp_sc") != mp_spsc) {
 		printf("Cannot lookup mempool from its name\n");
-		rte_mempool_free(mp_spsc);
-		RET_ERR();
+		ret = -1;
+		goto err;
 	}
 	lcore_next = rte_get_next_lcore(lcore_id, 0, 1);
 	if (lcore_next >= RTE_MAX_LCORE) {
-		rte_mempool_free(mp_spsc);
-		RET_ERR();
+		ret = -1;
+		goto err;
 	}
 	if (rte_eal_lcore_role(lcore_next) != ROLE_RTE) {
-		rte_mempool_free(mp_spsc);
-		RET_ERR();
+		ret = -1;
+		goto err;
 	}
 	rte_spinlock_init(&scsp_spinlock);
 	memset(scsp_obj_table, 0, sizeof(scsp_obj_table));
@@ -348,7 +348,10 @@ test_mempool_sp_sc(void)
 
 	if (rte_eal_wait_lcore(lcore_next) < 0)
 		ret = -1;
+
+err:
 	rte_mempool_free(mp_spsc);
+	mp_spsc = NULL;
 
 	return ret;
 }
-- 
2.14.1

             reply	other threads:[~2018-04-25 17:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-25 17:00 Andrew Rybchenko [this message]
2018-04-26 16:17 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1524675637-3037-1-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).