[LTP] [PATCH v2 1/2] tst_test.c: Add hugepage check in prepare_and_mount_hugetlb_fs
Wei Gao
wegao@suse.com
Thu Sep 4 03:58:58 CEST 2025
If test case only enable .needs_hugetlbfs without .hugepages then
will trigger mount error in prepare_and_mount_hugetlb_fs. So Add
hugepage check within prepare_and_mount_hugetlb_fs.
Signed-off-by: Wei Gao <wegao@suse.com>
---
lib/tst_test.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/tst_test.c b/lib/tst_test.c
index b8894f782..2217595e6 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -38,6 +38,7 @@
#include "old_device.h"
#include "old_tmpdir.h"
#include "ltp-version.h"
+#include "tst_hugepage.h"
/*
* Hack to get TCID defined in newlib tests
@@ -1192,6 +1193,9 @@ static void prepare_and_mount_dev_fs(const char *mntpoint)
static void prepare_and_mount_hugetlb_fs(void)
{
+ if (access(PATH_HUGEPAGES, F_OK))
+ tst_brk(TCONF, "hugetlbfs is not supported");
+
SAFE_MOUNT("none", tst_test->mntpoint, "hugetlbfs", 0, NULL);
context->mntpoint_mounted = 1;
}
--
2.51.0
More information about the ltp
mailing list