From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id D8266C3A2 for ; Sat, 6 Jun 2015 12:32:33 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 06 Jun 2015 03:32:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,563,1427785200"; d="scan'208";a="742160962" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 06 Jun 2015 03:32:14 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t56AWD9K024230; Sat, 6 Jun 2015 11:32:13 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t56AWDRJ028307; Sat, 6 Jun 2015 11:32:13 +0100 Received: (from smonroy@localhost) by sivswdev02.ir.intel.com with id t56AWDoi028303; Sat, 6 Jun 2015 11:32:13 +0100 From: Sergio Gonzalez Monroy To: dev@dpdk.org Date: Sat, 6 Jun 2015 11:32:12 +0100 Message-Id: <1433586732-28217-8-git-send-email-sergio.gonzalez.monroy@intel.com> X-Mailer: git-send-email 1.8.5.4 In-Reply-To: <1433586732-28217-1-git-send-email-sergio.gonzalez.monroy@intel.com> References: <1431103079-18096-1-git-send-email-sergio.gonzalez.monroy@intel.com> <1433586732-28217-1-git-send-email-sergio.gonzalez.monroy@intel.com> Subject: [dpdk-dev] [PATCH v2 7/7] app/test: update unit test with rte_memzone_free X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Jun 2015 10:32:34 -0000 Update memzone unit test for the new rte_memzone_free API. Signed-off-by: Sergio Gonzalez Monroy --- app/test/test_memzone.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/app/test/test_memzone.c b/app/test/test_memzone.c index c5e4872..7667d30 100644 --- a/app/test/test_memzone.c +++ b/app/test/test_memzone.c @@ -683,6 +683,51 @@ test_memzone_bounded(void) return (0); } +static int +test_memzone_free(void) +{ + const struct rte_memzone *mz[4]; + + mz[0] = rte_memzone_reserve("tempzone0", 2000, SOCKET_ID_ANY, 0); + mz[1] = rte_memzone_reserve("tempzone1", 4000, SOCKET_ID_ANY, 0); + + if (mz[0] > mz[1]) + return -1; + if (!rte_memzone_lookup("tempzone0")) + return -1; + if (!rte_memzone_lookup("tempzone1")) + return -1; + + if (rte_memzone_free(mz[0])) { + printf("Fail memzone free - tempzone0\n"); + return -1; + } + if (rte_memzone_lookup("tempzone0")) { + printf("Found previously free memzone - tempzone0\n"); + return -1; + } + mz[2] = rte_memzone_reserve("tempzone2", 2000, SOCKET_ID_ANY, 0); + + if (mz[2] > mz[1]) { + printf("tempzone2 should have gotten the free entry from tempzone0\n"); + return -1; + } + if (rte_memzone_free(mz[2])) { + printf("Fail memzone free - tempzone2\n"); + return -1; + } + if (rte_memzone_lookup("tempzone2")) { + printf("Found previously free memzone - tempzone2\n"); + return -1; + } + if (rte_memzone_free(mz[1])) { + printf("Fail memzone free - tempzone1\n"); + return -1; + } + if (rte_memzone_lookup("tempzone1")) { + printf("Found previously free memzone - tempzone1\n"); + return -1; + } return 0; } @@ -795,6 +840,10 @@ test_memzone(void) if (test_memzone_reserve_max_aligned() < 0) return -1; + printf("test free memzone\n"); + if (test_memzone_free() < 0) + return -1; + return 0; } -- 1.9.3