From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id CC336DE0 for ; Thu, 1 Feb 2018 11:14:54 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Feb 2018 02:14:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,443,1511856000"; d="scan'208";a="31151686" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 01 Feb 2018 02:14:51 -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 w11AEpLe027287 for ; Thu, 1 Feb 2018 10:14:51 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w11AEpwV008564 for ; Thu, 1 Feb 2018 10:14:51 GMT Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w11AEoPs008560 for dev@dpdk.org; Thu, 1 Feb 2018 10:14:50 GMT From: Anatoly Burakov To: dev@dpdk.org Date: Thu, 1 Feb 2018 10:14:49 +0000 Message-Id: X-Mailer: git-send-email 1.7.0.7 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v4 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: Thu, 01 Feb 2018 10:14:55 -0000 Ensure that memzone count in eal mem config is incremented and decremented whenever memzones are allocated and freed. Reviewed-by: Radoslaw Biernacki Signed-off-by: Anatoly Burakov --- Notes: v4: added missing reviewed-by tag 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