All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: DRI Development <dri-devel@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH i-g-t 1/2] tests/kms_addfb_basic: Add invalid tests to set fb props
Date: Fri, 22 Apr 2016 22:04:15 +0200	[thread overview]
Message-ID: <1461355456-21005-1-git-send-email-daniel.vetter@ffwll.ch> (raw)

There's no properties on fb modeset objects, bug bugs in the
kernel when trying to use those ioctls in such an invalid way.

Cc: Dave Airlie <airlied@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 tests/kms_addfb_basic.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
index 64047303dea7..de77b3cd907d 100644
--- a/tests/kms_addfb_basic.c
+++ b/tests/kms_addfb_basic.c
@@ -477,6 +477,70 @@ static void addfb25_ytile(int fd)
 	}
 }
 
+static void prop_tests(int fd)
+{
+	struct drm_mode_fb_cmd2 f = {};
+	struct drm_mode_obj_get_properties get_props = {};
+	struct drm_mode_obj_set_property set_prop = {};
+	uint64_t prop, prop_val;
+
+	f.width = 1024;
+	f.height = 1024;
+	f.pixel_format = DRM_FORMAT_XRGB8888;
+	f.pitches[0] = 1024*4;
+
+	igt_fixture {
+		gem_bo = igt_create_bo_with_dimensions(fd, 1024, 1024,
+			DRM_FORMAT_XRGB8888, 0, 0, NULL, NULL, NULL);
+		igt_assert(gem_bo);
+
+		f.handles[0] = gem_bo;
+
+		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f) == 0);
+	}
+
+	get_props.props_ptr = (uintptr_t) &prop;
+	get_props.prop_values_ptr = (uintptr_t) &prop_val;
+	get_props.count_props = 1;
+	get_props.obj_id = f.fb_id;
+
+	igt_subtest("invalid-get-prop-any") {
+		get_props.obj_type = 0; /* DRM_MODE_OBJECT_ANY */
+
+		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_OBJ_GETPROPERTIES,
+				    &get_props) == -1 && errno == EINVAL);
+	}
+
+	igt_subtest("invalid-get-prop") {
+		get_props.obj_type = DRM_MODE_OBJECT_FB;
+
+		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_OBJ_GETPROPERTIES,
+				    &get_props) == -1 && errno == EINVAL);
+	}
+
+	set_prop.value = 0;
+	set_prop.prop_id = 1;
+	set_prop.obj_id = f.fb_id;
+
+	igt_subtest("invalid-set-prop-any") {
+		set_prop.obj_type = 0; /* DRM_MODE_OBJECT_ANY */
+
+		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_OBJ_SETPROPERTY,
+				    &set_prop) == -1 && errno == EINVAL);
+	}
+
+	igt_subtest("invalid-set-prop") {
+		set_prop.obj_type = DRM_MODE_OBJECT_FB;
+
+		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_OBJ_SETPROPERTY,
+				    &set_prop) == -1 && errno == EINVAL);
+	}
+
+	igt_fixture
+		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f.fb_id) == 0);
+
+}
+
 int fd;
 
 igt_main
@@ -496,6 +560,8 @@ igt_main
 
 	tiling_tests(fd);
 
+	prop_tests(fd);
+
 	igt_fixture
 		close(fd);
 }
-- 
2.5.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2016-04-22 20:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-22 20:04 Daniel Vetter [this message]
2016-04-22 20:04 ` [PATCH i-g-t 2/2] tests/core_prop_blob: Add invalid tests to set fb props Daniel Vetter

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=1461355456-21005-1-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.