All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH igt 1/2] drmtest: don't discard return value in do_ioctl()
@ 2016-05-04 15:15 Robert Bragg
  2016-05-04 15:15 ` [PATCH igt 2/2] igt/perf: add i915 perf stream tests Robert Bragg
  2016-05-04 15:27 ` [PATCH igt 1/2] drmtest: don't discard return value in do_ioctl() Chris Wilson
  0 siblings, 2 replies; 6+ messages in thread
From: Robert Bragg @ 2016-05-04 15:15 UTC (permalink / raw)
  To: intel-gfx; +Cc: Sourab Gupta

In preparation for testing DRM_IOCTL_I915_PERF_OPEN which returns a file
descriptor this allows us to get the return value of ioctl called by the
do_ioctl() utility.

Signed-off-by: Robert Bragg <robert@sixbynine.org>
---
 lib/drmtest.h | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/drmtest.h b/lib/drmtest.h
index c391464..6aee1e8 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -104,11 +104,16 @@ bool is_i915_device(int fd);
  *
  * This macro wraps drmIoctl() and uses igt_assert to check that it has been
  * successfully executed.
+ *
+ * It's implemented using a gcc statement expression to still be able to
+ * assign the ioctl's return value after the assertion too.
  */
-#define do_ioctl(fd, ioc, ioc_data) do { \
-	igt_assert_eq(igt_ioctl((fd), (ioc), (ioc_data)), 0); \
+#define do_ioctl(fd, ioc, ioc_data) ({ \
+        int _ret = drmIoctl((fd), (ioc), (ioc_data)); \
+        igt_assert(_ret >= 0); \
 	errno = 0; \
-} while (0)
+        _ret; \
+})
 
 /**
  * do_ioctl_err:
-- 
2.7.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-05-05 16:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-04 15:15 [PATCH igt 1/2] drmtest: don't discard return value in do_ioctl() Robert Bragg
2016-05-04 15:15 ` [PATCH igt 2/2] igt/perf: add i915 perf stream tests Robert Bragg
2016-05-04 15:27 ` [PATCH igt 1/2] drmtest: don't discard return value in do_ioctl() Chris Wilson
2016-05-05 15:06   ` [PATCH] " Robert Bragg
2016-05-05 15:59     ` Chris Wilson
2016-05-05 16:14       ` Robert Bragg

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.