All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Robert Bragg <robert@sixbynine.org>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drmtest: don't discard return value in do_ioctl()
Date: Thu, 5 May 2016 16:59:44 +0100	[thread overview]
Message-ID: <20160505155944.GC7026@nuc-i3427.alporthouse.com> (raw)
In-Reply-To: <1462460762-19028-1-git-send-email-robert@sixbynine.org>

On Thu, May 05, 2016 at 04:06:02PM +0100, Robert Bragg wrote:
> Fixed a rebase mistake where I dropped the use of the igt_ioctl wrapper in
> do_ioctl().
> 
> I'm not entirely sure a.t.m whether the assertion change from ret == 0 to
> ret >= 0 will break anything, though comparing run-tests.sh -s -t basic 
> before/after didn't seem to highlight a problem for me.
> 
> --- >8 ---
> 
> 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..b917ecb 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 = igt_ioctl((fd), (ioc), (ioc_data)); \
> +        igt_assert(_ret >= 0); \

And now we have the unhelpful error message !(_ret >= 0)

For the single user, just don't use do_ioctl.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-05-05 15:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2016-05-05 16:14       ` Robert Bragg

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=20160505155944.GC7026@nuc-i3427.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=robert@sixbynine.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.