From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id CDF4F1B760 for ; Wed, 31 Jan 2018 16:29:36 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jan 2018 07:29:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,440,1511856000"; d="scan'208";a="200124605" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga005.fm.intel.com with ESMTP; 31 Jan 2018 07:29:34 -0800 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 w0VFTX4t001128 for ; Wed, 31 Jan 2018 15:29:33 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w0VFTXl4021691 for ; Wed, 31 Jan 2018 15:29:33 GMT Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w0VFTXdR021687 for dev@dpdk.org; Wed, 31 Jan 2018 15:29:33 GMT From: Anatoly Burakov To: dev@dpdk.org Date: Wed, 31 Jan 2018 15:29:32 +0000 Message-Id: X-Mailer: git-send-email 1.7.0.7 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 1/2] test/memzone: add test for memzone count in eal mem config X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 15:29:37 -0000 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