[Intel-gfx] [PATCH igt] igt/vgem_basic: Test DRM_IOCTL_SETVERSION
Chris Wilson
chris at chris-wilson.co.uk
Wed Jun 21 14:12:01 UTC 2017
vgem is a nasty test case for various parts of the core as it is a
virtual device with drm_device.dev == NULL; this includes drm_setversion
for example.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
tests/intel-ci/fast-feedback.testlist | 1 +
tests/vgem_basic.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/tests/intel-ci/fast-feedback.testlist b/tests/intel-ci/fast-feedback.testlist
index ce7a41f0..abe928d9 100644
--- a/tests/intel-ci/fast-feedback.testlist
+++ b/tests/intel-ci/fast-feedback.testlist
@@ -263,6 +263,7 @@ igt at prime_vgem@basic-read
igt at prime_vgem@basic-sync-default
igt at prime_vgem@basic-wait-default
igt at prime_vgem@basic-write
+igt at vgem_basic@setversion
igt at vgem_basic@create
igt at vgem_basic@debugfs
igt at vgem_basic@dmabuf-export
diff --git a/tests/vgem_basic.c b/tests/vgem_basic.c
index cce9229f..982da73a 100644
--- a/tests/vgem_basic.c
+++ b/tests/vgem_basic.c
@@ -34,6 +34,34 @@
IGT_TEST_DESCRIPTION("Basic sanity check of Virtual GEM module (vGEM).");
+static int __gem_setversion(int fd, drm_set_version_t *sv)
+{
+ int err;
+
+ err = 0;
+ if (igt_ioctl(fd, DRM_IOCTL_SET_VERSION, sv))
+ err = -errno;
+ errno = 0;
+
+ return err;
+}
+
+static void test_setversion(int fd)
+{
+ drm_set_version_t sv;
+
+ memset(&sv, 0, sizeof(sv));
+ sv.drm_di_major = 1; /* must be equal to DRM_IF_MAJOR */
+ sv.drm_di_minor = 4; /* must be less than DRM_IF_MINOR */
+ sv.drm_dd_major = -1; /* don't care */
+ sv.drm_dd_minor = -1; /* don't care */
+ igt_assert_eq(__gem_setversion(fd, &sv), 0);
+
+ igt_info("vgem DRM interface v%d.%d, device v%d.%d\n",
+ sv.drm_di_major, sv.drm_di_minor,
+ sv.drm_dd_major, sv.drm_dd_minor);
+}
+
static void test_client(int fd)
{
close(drm_open_driver(DRIVER_VGEM));
@@ -381,6 +409,9 @@ igt_main
fd = drm_open_driver(DRIVER_VGEM);
}
+ igt_subtest_f("setversion")
+ test_setversion(fd);
+
igt_subtest_f("second-client")
test_client(fd);
--
2.11.0
More information about the Intel-gfx
mailing list