DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] test/memzone: add test for memzone count in eal mem config
@ 2018-01-26 17:40 Anatoly Burakov
  2018-01-26 17:40 ` [dpdk-dev] [PATCH 2/2] test/memzone: handle previously allocated memzones Anatoly Burakov
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Anatoly Burakov @ 2018-01-26 17:40 UTC (permalink / raw)
  To: dev

Ensure that memzone count in eal mem config is incremented and
decremented whenever memzones are allocated and freed.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 test/test/test_memzone.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/test/test/test_memzone.c b/test/test/test_memzone.c
index f6c9b56..00d340f 100644
--- a/test/test/test_memzone.c
+++ b/test/test/test_memzone.c
@@ -841,6 +841,9 @@ test_memzone_basic(void)
 	const struct rte_memzone *memzone3;
 	const struct rte_memzone *memzone4;
 	const struct rte_memzone *mz;
+	int memzone_cnt_after, memzone_cnt_expected;
+	int memzone_cnt_before =
+			rte_eal_get_configuration()->mem_config->memzone_cnt;
 
 	memzone1 = rte_memzone_reserve("testzone1", 100,
 				SOCKET_ID_ANY, 0);
@@ -858,6 +861,18 @@ test_memzone_basic(void)
 	if (memzone1 == NULL || memzone2 == NULL || memzone4 == NULL)
 		return -1;
 
+	/* check how many memzones we are expecting */
+	memzone_cnt_expected = memzone_cnt_before +
+			(memzone1 != NULL) + (memzone2 != NULL) +
+			(memzone3 != NULL) + (memzone4 != NULL);
+
+	memzone_cnt_after =
+			rte_eal_get_configuration()->mem_config->memzone_cnt;
+
+	if (memzone_cnt_after != memzone_cnt_expected)
+		return -1;
+
+
 	rte_memzone_dump(stdout);
 
 	/* check cache-line alignments */
@@ -930,6 +945,11 @@ test_memzone_basic(void)
 		return -1;
 	}
 
+	memzone_cnt_after =
+			rte_eal_get_configuration()->mem_config->memzone_cnt;
+	if (memzone_cnt_after != memzone_cnt_before)
+		return -1;
+
 	return 0;
 }
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2018-02-06  0:49 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-26 17:40 [dpdk-dev] [PATCH 1/2] test/memzone: add test for memzone count in eal mem config Anatoly Burakov
2018-01-26 17:40 ` [dpdk-dev] [PATCH 2/2] test/memzone: handle previously allocated memzones Anatoly Burakov
2018-01-27 14:46   ` Radoslaw Biernacki
2018-01-31  7:51   ` Phil Yang
2018-01-31 10:05     ` Burakov, Anatoly
2018-01-31 10:08       ` Phil Yang
2018-01-27 14:53 ` [dpdk-dev] [PATCH 1/2] test/memzone: add test for memzone count in eal mem config Radoslaw Biernacki
2018-01-29  9:40   ` Burakov, Anatoly
2018-01-31 15:29 ` [dpdk-dev] [PATCH v2 " Anatoly Burakov
2018-02-01  0:12   ` Thomas Monjalon
2018-02-01 10:05     ` Burakov, Anatoly
2018-02-01 10:02   ` [dpdk-dev] [PATCH v3 " Anatoly Burakov
2018-02-01 10:14     ` [dpdk-dev] [PATCH v4 " Anatoly Burakov
2018-02-06  0:49       ` Thomas Monjalon
2018-02-01 10:14     ` [dpdk-dev] [PATCH v4 2/2] test/memzone: handle previously allocated memzones Anatoly Burakov
2018-02-01 10:02   ` [dpdk-dev] [PATCH v3 " Anatoly Burakov
2018-01-31 15:29 ` [dpdk-dev] [PATCH v2 " Anatoly Burakov

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).