<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 5, 2016 at 4:59 PM, Chris Wilson <span dir="ltr"><<a href="mailto:chris@chris-wilson.co.uk" target="_blank">chris@chris-wilson.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Thu, May 05, 2016 at 04:06:02PM +0100, Robert Bragg wrote:<br>
> Fixed a rebase mistake where I dropped the use of the igt_ioctl wrapper in<br>
> do_ioctl().<br>
><br>
> I'm not entirely sure a.t.m whether the assertion change from ret == 0 to<br>
> ret >= 0 will break anything, though comparing run-tests.sh -s -t basic<br>
> before/after didn't seem to highlight a problem for me.<br>
><br>
> --- >8 ---<br>
><br>
> In preparation for testing DRM_IOCTL_I915_PERF_OPEN which returns a file<br>
> descriptor this allows us to get the return value of ioctl called by the<br>
> do_ioctl() utility.<br>
><br>
> Signed-off-by: Robert Bragg <<a href="mailto:robert@sixbynine.org">robert@sixbynine.org</a>><br>
> ---<br>
> lib/drmtest.h | 11 ++++++++---<br>
> 1 file changed, 8 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/lib/drmtest.h b/lib/drmtest.h<br>
> index c391464..b917ecb 100644<br>
> --- a/lib/drmtest.h<br>
> +++ b/lib/drmtest.h<br>
> @@ -104,11 +104,16 @@ bool is_i915_device(int fd);<br>
> *<br>
> * This macro wraps drmIoctl() and uses igt_assert to check that it has been<br>
> * successfully executed.<br>
> + *<br>
> + * It's implemented using a gcc statement expression to still be able to<br>
> + * assign the ioctl's return value after the assertion too.<br>
> */<br>
> -#define do_ioctl(fd, ioc, ioc_data) do { \<br>
> - igt_assert_eq(igt_ioctl((fd), (ioc), (ioc_data)), 0); \<br>
> +#define do_ioctl(fd, ioc, ioc_data) ({ \<br>
> + int _ret = igt_ioctl((fd), (ioc), (ioc_data)); \<br>
> + igt_assert(_ret >= 0); \<br>
<br>
</div></div>And now we have the unhelpful error message !(_ret >= 0)<br>
<br>
For the single user, just don't use do_ioctl.<br></blockquote><div><br></div><div>Ah, right, not great.<br><br></div><div>I suppose having something like igt_assert((_ret = igt_ioctl((fd), (ioc), (ioc_data))) >= 0); might be a bit better, but adds noise to the simpler cases. Sounds ok to just have a special case ioctl wrapper in tests/perf.c.<br><br></div><div>- Robert<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">-Chris<br>
<br>
--<br>
Chris Wilson, Intel Open Source Technology Centre<br>
</div></div></blockquote></div><br></div></div>