public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/2] pkey01: disable hugetlb test if failed to reserve hugepage
Date: Thu, 28 Nov 2019 16:45:06 +0800	[thread overview]
Message-ID: <20191128084506.7587-2-liwang@redhat.com> (raw)
In-Reply-To: <20191128084506.7587-1-liwang@redhat.com>

To handle the false positive:
  pkey01.c:69: BROK: nr_hugepages = 0, but expect 1

Signed-off-by: Li Wang <liwang@redhat.com>
---
 testcases/kernel/syscalls/pkeys/pkey01.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/testcases/kernel/syscalls/pkeys/pkey01.c b/testcases/kernel/syscalls/pkeys/pkey01.c
index fa84e71f3..b5831af37 100644
--- a/testcases/kernel/syscalls/pkeys/pkey01.c
+++ b/testcases/kernel/syscalls/pkeys/pkey01.c
@@ -61,13 +61,12 @@ static void setup(void)
 		size = getpagesize();
 		no_hugepage = 1;
 	} else {
-		int val;
-		SAFE_FILE_PRINTF(PATH_VM_NRHPS, "%d", 1);
-		SAFE_FILE_SCANF(PATH_VM_NRHPS, "%d", &val);
-		if (val != 1)
-			tst_brk(TBROK, "nr_hugepages = %d, but expect %d",
-					val, 1);
-		size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
+		if (tst_request_hugepages(1)) {
+			size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
+		} else {
+			size = getpagesize();
+			no_hugepage = 1;
+		}
 	}
 
 	check_pkey_support();
-- 
2.20.1


  reply	other threads:[~2019-11-28  8:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-28  8:45 [LTP] [PATCH 1/2] lib: add tst_request_hugepages Li Wang
2019-11-28  8:45 ` Li Wang [this message]
2019-12-03 10:49 ` Cyril Hrubis
2019-12-04  6:40   ` Li Wang
2019-12-04  9:26     ` Li Wang
2019-12-04 11:10       ` Cyril Hrubis

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=20191128084506.7587-2-liwang@redhat.com \
    --to=liwang@redhat.com \
    --cc=ltp@lists.linux.it \
    /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