Skip to contentSkip to conversation

selftests/memfd: add memfd_create hugetlbfs selftest

PATCH In review [email protected] 1 participant 1 message Sep 6, 2017 Kselftest

lore
Share & tools
lore
#0 lore raw

PATCH 103/119 selftests/memfd: add memfd_create hugetlbfs selftest

From: Mike Kravetz <[email protected]>
Subject: selftests/memfd: add memfd_create hugetlbfs selftest

With the addition of hugetlbfs support in memfd_create, the memfd selftests should verify correct functionality with hugetlbfs.

Instead of writing a separate memfd hugetlbfs test, modify the memfd_test program to take an optional argument 'hugetlbfs'. If the hugetlbfs argument is specified, basic memfd_create functionality will be exercised on hugetlbfs. If hugetlbfs is not specified, the current functionality of the test is unchanged.

Note that many of the tests in memfd_test test file sealing operations. hugetlbfs does not support file sealing, therefore for hugetlbfs all sealing related tests are skipped.

In order to test on hugetlbfs, there needs to be preallocated huge pages. A new script (run_tests) is added. This script will first run the existing memfd_create tests. It will then, attempt to allocate the required number of huge pages before running the hugetlbfs test. At the end of testing, it will release any huge pages allocated for testing purposes.

---

 tools/testing/selftests/memfd/Makefile     |    2 
 tools/testing/selftests/memfd/memfd_test.c |  372 ++++++++++++++-----
 tools/testing/selftests/memfd/run_tests.sh |   69 +++
 3 files changed, 357 insertions(+), 86 deletions(-)
tools/testing/selftests/memfd/Makefile renamed from tools/testing/selftests/memfd/Makefile~selftests-memfd-add-memfd_create-hugetlbfs-selftest +1 -1
diff -puN tools/testing/selftests/memfd/Makefile~selftests-memfd-add-memfd_create-hugetlbfs-selftest tools/testing/selftests/memfd/Makefile
@@ -3,7 +3,7 @@ CFLAGS += -I../../../../include/uapi/
 CFLAGS += -I../../../../include/
 CFLAGS += -I../../../../usr/include/
 
-TEST_PROGS := run_fuse_test.sh
+TEST_PROGS := run_tests.sh
 TEST_GEN_FILES := memfd_test fuse_mnt fuse_test
 
 fuse_mnt.o: CFLAGS += $(shell pkg-config fuse --cflags)
tools/testing/selftests/memfd/memfd_test.c renamed from tools/testing/selftests/memfd/memfd_test.c~selftests-memfd-add-memfd_create-hugetlbfs-selftest +287 -85

696 lines not on this page · raw message

tools/testing/selftests/memfd/run_tests.sh new file +69 -0

69 lines not on this page · raw message

_