All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Damien Lespiau <damien.lespiau@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 3/4] core: Only display the errno message if errno is set
Date: Wed, 9 Jul 2014 13:57:59 +0200	[thread overview]
Message-ID: <20140709115759.GP17271@phenom.ffwll.local> (raw)
In-Reply-To: <1404902721-9267-3-git-send-email-damien.lespiau@intel.com>

On Wed, Jul 09, 2014 at 11:45:20AM +0100, Damien Lespiau wrote:
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
>  lib/igt_core.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 4dbcb1a..e66d096 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -575,6 +575,10 @@ void __igt_skip_check(const char *file, const int line,
>  {
>  	va_list args;
>  	int err = errno;
> +	char *err_str = NULL;
> +
> +	if (err)
> +		asprintf(&err_str, "Last errno: %i, %s\n", err, strerror(err));
>  
>  	if (f) {
>  		static char *buf;
> @@ -589,16 +593,18 @@ void __igt_skip_check(const char *file, const int line,
>  
>  		igt_skip("Test requirement not met in function %s, file %s:%i:\n"
>  			 "Test requirement: (%s)\n%s"
> -			 "Last errno: %i, %s\n",
> -			 func, file, line, check, buf, err, strerror(err));
> +			 "%s",
> +			 func, file, line, check, buf, err_str ?: "");
>  
>  		free(buf);
>  	} else {
>  		igt_skip("Test requirement not met in function %s, file %s:%i:\n"
>  			 "Test requirement: (%s)\n"
> -			 "Last errno: %i, %s\n",
> -			 func, file, line, check, err, strerror(err));
> +			 "%s",
> +			 func, file, line, check, err_str ?: "");
>  	}
> +
> +	free(err_str);

Same issue about dead code. But I like the idea.
-Daniel

>  }
>  
>  /**
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  reply	other threads:[~2014-07-09 11:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-09 10:45 [PATCH i-g-t 1/4] core: Free buffer allocated with vasprintf() Damien Lespiau
2014-07-09 10:45 ` [PATCH i-g-t 2/4] core: Put the requirement failure messages together Damien Lespiau
2014-07-09 10:45 ` [PATCH i-g-t 3/4] core: Only display the errno message if errno is set Damien Lespiau
2014-07-09 11:57   ` Daniel Vetter [this message]
2014-07-09 10:45 ` [PATCH i-g-t 4/4] core: Apply the same treatment to the in errno message in __igt_fail_assert() Damien Lespiau
2014-07-09 11:58   ` Daniel Vetter
2014-07-09 11:56 ` [PATCH i-g-t 1/4] core: Free buffer allocated with vasprintf() Daniel Vetter
2014-07-09 12:06   ` Damien Lespiau
2014-07-09 12:14     ` Daniel Vetter

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=20140709115759.GP17271@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=damien.lespiau@intel.com \
    --cc=intel-gfx@lists.freedesktop.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.