public inbox for intel-gfx@lists.freedesktop.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 4/4] core: Apply the same treatment to the in errno message in __igt_fail_assert()
Date: Wed, 9 Jul 2014 13:58:53 +0200	[thread overview]
Message-ID: <20140709115853.GQ17271@phenom.ffwll.local> (raw)
In-Reply-To: <1404902721-9267-4-git-send-email-damien.lespiau@intel.com>

On Wed, Jul 09, 2014 at 11:45:21AM +0100, Damien Lespiau wrote:
> Just like the it was done for the requirement message, display the errno
> message only if errno is set, and display it at the end of the assert
> message.
> 
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>

Patches 2&4 are Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>, patch
3 is imo ok with the free dropped.
-Daniel
> ---
>  lib/igt_core.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index e66d096..53f750a 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -682,11 +682,17 @@ void __igt_fail_assert(int exitcode, const char *file,
>  {
>  	va_list args;
>  	int err = errno;
> +	char *err_str = NULL;
> +
> +	if (err)
> +		asprintf(&err_str, "Last errno: %i, %s\n", err, strerror(err));
>  
>  	printf("Test assertion failure function %s, file %s:%i:\n"
> -	       "Last errno: %i, %s\n"
> -	       "Failed assertion: %s\n",
> -	       func, file, line, err, strerror(err), assertion);
> +	       "Failed assertion: %s\n"
> +	       "%s",
> +	       func, file, line, assertion, err_str ?: "");
> +
> +	free(err_str);
>  
>  	if (f) {
>  		va_start(args, f);
> -- 
> 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:58 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
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 [this message]
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=20140709115853.GQ17271@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox