Running meson test requires specific kernel modules (like nfit_test.ko) to be loaded. This process involves building and installing test modules from the kernel source.
1. Kernel Configuration
For kernels < v4.8, you must configure the kernel to make memory available to the Contiguous Memory Allocator (CMA) to emulate DAX. Use either:
CONFIG_DMA_CMA=y and CONFIG_CMA_SIZE_MBYTES=200 in the kernel config.cma=200M on the kernel command line.
2. Required Kernel Config Options
Ensure your kernel configuration includes the following options to support NVDIMM and DAX testing:
CONFIG_X86_PMEM_LEGACY=m
CONFIG_ZONE_DEVICE=y
CONFIG_LIBNVDIMM=m
CONFIG_BLK_DEV_PMEM=m
CONFIG_BTT=y
CONFIG_NVDIMM_PFN=y
CONFIG_NVDIMM_DAX=y
CONFIG_DEV_DAX_PMEM=m
CONFIG_FS_DAX=y
CONFIG_EXT4_FS=m
CONFIG_XFS_FS=m
CONFIG_DAX=m
CONFIG_DEV_DAX=m
CONFIG_ENCRYPTED_KEYS=y
CONFIG_NVDIMM_SECURITY_TEST=y
CONFIG_STRICT_DEVMEM=y
CONFIG_IO_STRICT_DEVMEM=y
CONFIG_ACPI_NFIT=m
CONFIG_NFIT_SECURITY_DEBUG=y
CONFIG_MEMORY_FAILURE=y
CONFIG_MEMORY_HOTPLUG=y
CONFIG_MEMORY_HOTREMOVE=y
CONFIG_TRANSPARENT_HUGEPAGE=y
3. Install Dependencies (Fedora)
dnf install e2fsprogs xfsprogs parted jq trace-cmd hostname fio fio-engine-dev-dax
4. Build and Install Test Modules
Build and install the libnvdimm test modules in this specific order to ensure they are available before depmod runs:
make M=tools/testing/nvdimm
sudo make M=tools/testing/nvdimm modules_install
sudo make modules_install
5. Running Tests
Run the tests using meson:
meson test -C build
Or, if ndctl was built with -Dtest=enabled, use:
ndctl test
Destructive Tests
To run tests that may clobber existing pmem configurations and data, enable the destructive option:
meson configure -Dtest=enabled -Ddestructive=enabled build