OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Subject: [Devel] [PATCH vz10] selftests/iommu: skip when /dev/iommu is not available
Date: Fri, 21 Aug 2026 18:05:55 +0300	[thread overview]
Message-ID: <20260821150557.792945-1-eva.kurchatova@virtuozzo.com> (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


             reply	other threads:[~2026-08-21 15:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 15:05 Eva Kurchatova [this message]
2026-08-24  9:40 ` Konstantin Khorenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260821150557.792945-1-eva.kurchatova@virtuozzo.com \
    --to=eva.kurchatova@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox