From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter 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 Message-ID: <20140709115759.GP17271@phenom.ffwll.local> References: <1404902721-9267-1-git-send-email-damien.lespiau@intel.com> <1404902721-9267-3-git-send-email-damien.lespiau@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by gabe.freedesktop.org (Postfix) with ESMTP id 0949D6E2B8 for ; Wed, 9 Jul 2014 04:57:48 -0700 (PDT) Received: by mail-wg0-f50.google.com with SMTP id n12so396553wgh.21 for ; Wed, 09 Jul 2014 04:57:48 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1404902721-9267-3-git-send-email-damien.lespiau@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Damien Lespiau Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Wed, Jul 09, 2014 at 11:45:20AM +0100, Damien Lespiau wrote: > Signed-off-by: Damien Lespiau > --- > 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