(I'm so sorry!) Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

iommufd/selftest: Skip when the mock device is not there

Both iommufd tests need the mock device the iommufd module registers under CONFIG_IOMMUFD_TEST, and they open /dev/iommu in every fixture without checking, so on a kernel that does not provide it every case fails on the open. Checking the open is not enough on its own. /dev/iommu appears as soon as the iommufd module is loaded, which says nothing about the mock device: the release config here is CONFIG_IOMMUFD=m with CONFIG_IOMMUFD_TEST unset, so the open succeeds and the tests fail later in the ioctls that drive the mock device instead. Only the debug config sets CONFIG_IOMMUFD_TEST. /sys/bus/iommufd_mock covers both, it exists only once the module is loaded and the kernel was built with CONFIG_IOMMUFD_TEST. Check for it once before handing over to the harness, rather than in each of the fixtures, and report a skip. test_harness_run() is what TEST_HARNESS_MAIN calls anyway, so the tests still run exactly as they did. Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com> Link: https://patch.msgid.link/20260908214825.2682078-2-eva.kurchatova@virtuozzo.com Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>


Author Eva Kurchatova Committer Jason Gunthorpe Date Commit Parent 1d56f4d6
+26 -2
2 changed files
+26 -2
2 changed files