[LTP] [PATCH] hugemmap32: Check for hugetlbfs availability
Martin Doucha
mdoucha@suse.cz
Thu May 11 13:17:35 CEST 2023
Trying to open PATH_HUGEPAGE unconditionally will fail if hugepage
support is disabled in kernel or not provided by hardware.
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c
index 85d57319f..36a426a09 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c
@@ -47,6 +47,9 @@ static void setup(void)
struct dirent *ent;
unsigned long hpage_size;
+ if (access(PATH_HUGEPAGE, F_OK))
+ tst_brk(TCONF, "hugetlbfs is not supported");
+
dir = SAFE_OPENDIR(PATH_HUGEPAGE);
while ((ent = SAFE_READDIR(dir))) {
if ((sscanf(ent->d_name, "hugepages-%lukB", &hpage_size) == 1) &&
--
2.40.0
More information about the ltp
mailing list