On Wed, Sep 09, 2026 at 12:48:12AM +0300, Eva Kurchatova wrote: > 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 <[email protected]> > --- > tools/testing/selftests/iommu/iommufd.c | 15 ++++++++++++++- > tools/testing/selftests/iommu/iommufd_fail_nth.c | 15 ++++++++++++++- > 2 files changed, 28 insertions(+), 2 deletions(-)
Applied thanks Jason

