[Intel-gfx] [PATCH 3/3] tests/gem_wait: argument validation tests

Daniel Vetter daniel.vetter at ffwll.ch
Mon Sep 29 14:54:26 CEST 2014


Shockingly we don't check for 0 flags!

Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 tests/gem_wait.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/tests/gem_wait.c b/tests/gem_wait.c
index 0a8ccf62150d..83ddb97216ab 100644
--- a/tests/gem_wait.c
+++ b/tests/gem_wait.c
@@ -216,6 +216,37 @@ static void render_timeout(int fd)
 	close(fd);
 }
 
+static void invalid_flags(int fd)
+{
+	struct drm_i915_gem_wait wait;
+	int ret;
+	uint32_t handle;
+
+	handle = gem_create(fd, 4096);
+
+	wait.bo_handle = handle;
+	wait.timeout_ns = 1;
+	wait.flags = 0xffffffff;
+	ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_WAIT, &wait);
+
+	igt_assert(ret != 0 && errno == EINVAL);
+
+	gem_close(fd, handle);
+}
+
+static void invalid_buf(int fd)
+{
+	struct drm_i915_gem_wait wait;
+	int ret;
+
+	wait.bo_handle = 0;
+	wait.timeout_ns = 1;
+	wait.flags = 0;
+	ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_WAIT, &wait);
+
+	igt_assert(ret != 0 && errno == ENOENT);
+}
+
 int drm_fd;
 
 igt_main
@@ -226,6 +257,11 @@ igt_main
 	igt_subtest("render_timeout")
 		render_timeout(drm_fd);
 
+	igt_subtest("invalid-flags")
+		invalid_flags(drm_fd);
+
+	igt_subtest("invalid-buf")
+		invalid_buf(drm_fd);
 
 	igt_fixture
 		close(drm_fd);
-- 
1.9.3




More information about the Intel-gfx mailing list