[PATCH i-g-t] tests/sriov_basic: verify VF disabling when its fd remains open

Lukasz Laguna lukasz.laguna at intel.com
Wed Feb 26 14:42:54 UTC 2025


Introduce a subtest that verifies the VF disabling when its file
descriptor remains open. The expected behaviour is forceful VF driver
unbind and VF disabling.

Signed-off-by: Lukasz Laguna <lukasz.laguna at intel.com>
---
 tests/sriov_basic.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tests/sriov_basic.c b/tests/sriov_basic.c
index 36bca4149..986566dc2 100644
--- a/tests/sriov_basic.c
+++ b/tests/sriov_basic.c
@@ -118,6 +118,21 @@ static void bind_unbind_vf(int pf_fd, unsigned int vf_num)
 	igt_sriov_disable_vfs(pf_fd);
 }
 
+/**
+ * SUBTEST: disable-vf-with-open-fd
+ * Description:
+ *   Verify the VF disabling when its file descriptor remains open
+ */
+static void disable_vf_with_open_fd(int pf_fd)
+{
+	igt_require(igt_sriov_get_enabled_vfs(pf_fd) == 0);
+
+	igt_sriov_enable_driver_autoprobe(pf_fd);
+	igt_sriov_enable_vfs(pf_fd, 1);
+	igt_assert_fd(igt_sriov_open_vf_drm_device(pf_fd, 1));
+	igt_sriov_disable_vfs(pf_fd);
+}
+
 igt_main
 {
 	int pf_fd;
@@ -209,6 +224,10 @@ igt_main
 		}
 	}
 
+	igt_describe("Verify the VF disabling when its file descriptor remains open");
+	igt_subtest("disable-vf-with-open-fd")
+		disable_vf_with_open_fd(pf_fd);
+
 	igt_fixture {
 		igt_sriov_disable_vfs(pf_fd);
 		/* abort to avoid execution of next tests with enabled VFs */
-- 
2.40.0



More information about the igt-dev mailing list