summaryrefslogtreecommitdiff
path: root/lib/drmtest.h
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2015-10-01 13:02:38 +0100
committerDaniel Stone <daniels@collabora.com>2015-10-07 17:57:26 +0100
commitc8cec6b88511f43b5c0301864081fe6ca6e39049 (patch)
treedbe9511296fefaf15ac4fa5144dc5175650dc4aa /lib/drmtest.h
parent31821fce59d6ce3288b5b8e0f18f60417b76c61a (diff)
lib/drmtest: Add do_ioctl_err to expect failure
do_ioctl demands that the ioctl returns success; add a variant named do_ioctl_err, which expects the ioctl to fail, and demands a particular result. Signed-off-by: Daniel Stone <daniels@collabora.com>
Diffstat (limited to 'lib/drmtest.h')
-rw-r--r--lib/drmtest.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/drmtest.h b/lib/drmtest.h
index bb504087..ed384ffe 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -101,7 +101,23 @@ void gem_quiescent_gpu(int fd);
* successfully executed.
*/
#define do_ioctl(fd, ioc, ioc_data) do { \
- igt_assert(drmIoctl((fd), (ioc), (ioc_data)) == 0); \
+ igt_assert_eq(drmIoctl((fd), (ioc), (ioc_data)), 0); \
+ errno = 0; \
+} while (0)
+
+/**
+ * do_ioctl_err:
+ * @fd: open i915 drm file descriptor
+ * @ioc: ioctl op definition from drm headers
+ * @ioc_data: data pointer for the ioctl operation
+ * @err: value to expect in errno
+ *
+ * This macro wraps drmIoctl() and uses igt_assert to check that it fails,
+ * returning a particular value in errno.
+ */
+#define do_ioctl_err(fd, ioc, ioc_data, err) do { \
+ igt_assert_eq(drmIoctl((fd), (ioc), (ioc_data)), -1); \
+ igt_assert_eq(errno, err); \
errno = 0; \
} while (0)