From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <aburakov@ecsmtp.ir.intel.com>
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by dpdk.org (Postfix) with ESMTP id 02F771B2D9;
 Thu, 21 Dec 2017 19:19:48 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 21 Dec 2017 10:19:47 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.45,437,1508828400"; d="scan'208";a="15593193"
Received: from irvmail001.ir.intel.com ([163.33.26.43])
 by fmsmga001.fm.intel.com with ESMTP; 21 Dec 2017 10:19:46 -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
 vBLIJjTF012358; Thu, 21 Dec 2017 18:19:45 GMT
Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1])
 by sivswdev01.ir.intel.com with ESMTP id vBLIJjFT032754;
 Thu, 21 Dec 2017 18:19:45 GMT
Received: (from aburakov@localhost)
 by sivswdev01.ir.intel.com with LOCAL id vBLIJjZf032750;
 Thu, 21 Dec 2017 18:19:45 GMT
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>, stable@dpdk.org
Date: Thu, 21 Dec 2017 18:19:44 +0000
Message-Id: <38c97df0b43676153ddf13923d676b98937c2f68.1513866482.git.anatoly.burakov@intel.com>
X-Mailer: git-send-email 1.7.0.7
In-Reply-To: <5c1a7f3bfe6bbfc86f536541833de4ab1789a95c.1513866482.git.anatoly.burakov@intel.com>
References: <5c1a7f3bfe6bbfc86f536541833de4ab1789a95c.1513866482.git.anatoly.burakov@intel.com>
In-Reply-To: <5c1a7f3bfe6bbfc86f536541833de4ab1789a95c.1513866482.git.anatoly.burakov@intel.com>
References: <5c1a7f3bfe6bbfc86f536541833de4ab1789a95c.1513866482.git.anatoly.burakov@intel.com>
Subject: [dpdk-stable] [PATCH 3/3] test: fix wrong test in memzone autotest
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 21 Dec 2017 18:19:49 -0000

When reserving memzones in autotest, it makes no sense to expect a
failed memzone reserve when we specify both size flags - instead,
we should expect a memzone reserved with one of the two sizes.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 test/test/test_memzone.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/test/test/test_memzone.c b/test/test/test_memzone.c
index 5c0567f..ecd9880 100644
--- a/test/test/test_memzone.c
+++ b/test/test/test_memzone.c
@@ -289,10 +289,19 @@ test_memzone_reserve_flags(void)
 		if (hugepage_2MB_avail && hugepage_1GB_avail) {
 			mz = rte_memzone_reserve("flag_zone_2M_HINT", size, SOCKET_ID_ANY,
 								RTE_MEMZONE_2MB|RTE_MEMZONE_1GB);
-			if (mz != NULL) {
+			if (mz == NULL) {
 				printf("BOTH SIZES SET\n");
 				return -1;
 			}
+			if (mz->hugepage_sz != RTE_PGSIZE_1G &&
+					mz->hugepage_sz != RTE_PGSIZE_2M) {
+				printf("Wrong size when both sizes set\n");
+				return -1;
+			}
+			if (rte_memzone_free(mz)) {
+				printf("Fail memzone free\n");
+				return -1;
+			}
 		}
 	}
 	/*
@@ -424,10 +433,19 @@ test_memzone_reserve_flags(void)
 			mz = rte_memzone_reserve("flag_zone_16M_HINT", size,
 				SOCKET_ID_ANY,
 				RTE_MEMZONE_16MB|RTE_MEMZONE_16GB);
-			if (mz != NULL) {
+			if (mz == NULL) {
 				printf("BOTH SIZES SET\n");
 				return -1;
 			}
+			if (mz->hugepage_sz != RTE_PGSIZE_16G &&
+					mz->hugepage_sz != RTE_PGSIZE_16M) {
+				printf("Wrong size when both sizes set\n");
+				return -1;
+			}
+			if (rte_memzone_free(mz)) {
+				printf("Fail memzone free\n");
+				return -1;
+			}
 		}
 	}
 	return 0;
-- 
2.7.4