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@xxxxxxxxxxxxx> --- lib/drmtest.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/drmtest.h b/lib/drmtest.h index bb50408..ed384ff 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) -- 2.5.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx