OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
* [Devel] [PATCH vz10] selftests/iommu: skip when /dev/iommu is not available
@ 2026-08-21 15:05 Eva Kurchatova
  2026-08-24  9:40 ` Konstantin Khorenko
  0 siblings, 1 reply; 2+ messages in thread
From: Eva Kurchatova @ 2026-08-21 15:05 UTC (permalink / raw)


Without iommufd all 237 subtests fail in FIXTURE_SETUP on the open().

https://virtuozzo.atlassian.net/browse/VSTOR-142443
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 tools/testing/selftests/iommu/iommufd.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tools/testing/selftests/iommu/iommufd.c b/tools/testing/selftests/iommu/iommufd.c
index de348d641279..0625e1596bbf 100644
--- a/tools/testing/selftests/iommu/iommufd.c
+++ b/tools/testing/selftests/iommu/iommufd.c
@@ -66,6 +66,8 @@ FIXTURE(iommufd)
 FIXTURE_SETUP(iommufd)
 {
 	self->fd = open("/dev/iommu", O_RDWR);
+	if (self->fd < 0)
+		SKIP(return, "/dev/iommu is not available");
 	ASSERT_NE(-1, self->fd);
 }
 
@@ -254,6 +256,8 @@ FIXTURE_VARIANT(change_process)
 FIXTURE_SETUP(change_process)
 {
 	self->fd = open("/dev/iommu", O_RDWR);
+	if (self->fd < 0)
+		SKIP(return, "/dev/iommu is not available");
 	ASSERT_NE(-1, self->fd);
 
 	drop_cap_ipc_lock(_metadata);
@@ -360,6 +364,8 @@ FIXTURE_SETUP(iommufd_ioas)
 
 
 	self->fd = open("/dev/iommu", O_RDWR);
+	if (self->fd < 0)
+		SKIP(return, "/dev/iommu is not available");
 	ASSERT_NE(-1, self->fd);
 	test_ioctl_ioas_alloc(&self->ioas_id);
 
@@ -1641,6 +1647,8 @@ FIXTURE_SETUP(iommufd_mock_domain)
 	unsigned int i;
 
 	self->fd = open("/dev/iommu", O_RDWR);
+	if (self->fd < 0)
+		SKIP(return, "/dev/iommu is not available");
 	ASSERT_NE(-1, self->fd);
 	test_ioctl_ioas_alloc(&self->ioas_id);
 
@@ -2114,6 +2122,8 @@ FIXTURE_SETUP(iommufd_dirty_tracking)
 	}
 
 	self->fd = open("/dev/iommu", O_RDWR);
+	if (self->fd < 0)
+		SKIP(return, "/dev/iommu is not available");
 	ASSERT_NE(-1, self->fd);
 
 	mmap_flags = MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED;
@@ -2484,6 +2494,8 @@ FIXTURE_SETUP(vfio_compat_mock_domain)
 	};
 
 	self->fd = open("/dev/iommu", O_RDWR);
+	if (self->fd < 0)
+		SKIP(return, "/dev/iommu is not available");
 	ASSERT_NE(-1, self->fd);
 
 	/* Create what VFIO would consider a group */
@@ -2773,6 +2785,8 @@ FIXTURE_VARIANT(iommufd_viommu)
 FIXTURE_SETUP(iommufd_viommu)
 {
 	self->fd = open("/dev/iommu", O_RDWR);
+	if (self->fd < 0)
+		SKIP(return, "/dev/iommu is not available");
 	ASSERT_NE(-1, self->fd);
 	test_ioctl_ioas_alloc(&self->ioas_id);
 	test_ioctl_set_default_memory_limit();
@@ -3236,6 +3250,8 @@ FIXTURE_VARIANT(iommufd_device_pasid)
 FIXTURE_SETUP(iommufd_device_pasid)
 {
 	self->fd = open("/dev/iommu", O_RDWR);
+	if (self->fd < 0)
+		SKIP(return, "/dev/iommu is not available");
 	ASSERT_NE(-1, self->fd);
 	test_ioctl_ioas_alloc(&self->ioas_id);
 
-- 
2.55.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-24  9:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-21 15:05 [Devel] [PATCH vz10] selftests/iommu: skip when /dev/iommu is not available Eva Kurchatova
2026-08-24  9:40 ` Konstantin Khorenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox