From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter 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 Message-ID: <20140709115853.GQ17271@phenom.ffwll.local> References: <1404902721-9267-1-git-send-email-damien.lespiau@intel.com> <1404902721-9267-4-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-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) by gabe.freedesktop.org (Postfix) with ESMTP id 86526893E8 for ; Wed, 9 Jul 2014 04:58:43 -0700 (PDT) Received: by mail-wi0-f181.google.com with SMTP id n3so2606870wiv.14 for ; Wed, 09 Jul 2014 04:58:42 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1404902721-9267-4-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: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 Patches 2&4 are Reviewed-by: Daniel Vetter , 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