DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH 3/3] test: fix wrong test in memzone autotest
Date: Thu, 21 Dec 2017 18:19:44 +0000	[thread overview]
Message-ID: <38c97df0b43676153ddf13923d676b98937c2f68.1513866482.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <5c1a7f3bfe6bbfc86f536541833de4ab1789a95c.1513866482.git.anatoly.burakov@intel.com>
In-Reply-To: <5c1a7f3bfe6bbfc86f536541833de4ab1789a95c.1513866482.git.anatoly.burakov@intel.com>

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

  parent reply	other threads:[~2017-12-21 18:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-21 18:19 [dpdk-dev] [PATCH 1/3] test: fix typo " Anatoly Burakov
2017-12-21 18:19 ` [dpdk-dev] [PATCH 2/3] test: fix copypaste error " Anatoly Burakov
2017-12-21 18:19 ` Anatoly Burakov [this message]
2018-01-03 12:01 ` [dpdk-dev] [PATCH 1/3] test: fix typo " Radoslaw Biernacki
2018-01-17 23:35   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=38c97df0b43676153ddf13923d676b98937c2f68.1513866482.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=sergio.gonzalez.monroy@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).