From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anatoly Burakov Subject: [PATCH v3 1/2] test/memzone: add test for memzone count in eal mem config Date: Thu, 1 Feb 2018 10:02:49 +0000 Message-ID: References: To: dev@dpdk.org Return-path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 6DC74276C for ; Thu, 1 Feb 2018 11:02:53 +0100 (CET) Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id w11A2peo021729 for ; Thu, 1 Feb 2018 10:02:51 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w11A2pom009580 for ; Thu, 1 Feb 2018 10:02:51 GMT Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w11A2ofO009544 for dev@dpdk.org; Thu, 1 Feb 2018 10:02:50 GMT In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Ensure that memzone count in eal mem config is incremented and decremented whenever memzones are allocated and freed. Signed-off-by: Anatoly Burakov --- 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