Check hugetlbfs support before starting tests in run_hugetlbfs_test.sh.

Otherwise on a system that does not support hugetlbfs the free huge
pages availability check will fail with:
  ./run_hugetlbfs_test.sh: line 47: [: -lt: unary operator expected
  ./run_hugetlbfs_test.sh: line 60: 12577 Aborted                 (core dumped) 
./memfd_test hugetlbfs
  Aborted (core dumped)

And it will left a fuse_mnt process behind, which may cause some
unexpected issues.

Signed-off-by: Po-Hsu Lin <po-hsu....@canonical.com>
---
 tools/testing/selftests/memfd/run_hugetlbfs_test.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/memfd/run_hugetlbfs_test.sh 
b/tools/testing/selftests/memfd/run_hugetlbfs_test.sh
index fb633eeb0290..15f4d1299563 100755
--- a/tools/testing/selftests/memfd/run_hugetlbfs_test.sh
+++ b/tools/testing/selftests/memfd/run_hugetlbfs_test.sh
@@ -10,6 +10,11 @@ ksft_skip=4
 #
 hpages_test=8
 
+if ! grep -q hugetlbfs /proc/filesystems; then
+       echo "hugetlbfs not supported, test skipped."
+       exit $ksft_skip
+fi
+
 #
 # Get count of free huge pages from /proc/meminfo
 #
-- 
2.34.1


Reply via email to