qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/2] tests: send error_report to test log


From: Halil Pasic
Subject: Re: [Qemu-devel] [PATCH 2/2] tests: send error_report to test log
Date: Tue, 25 Oct 2016 13:06:29 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0


On 10/24/2016 06:31 PM, Paolo Bonzini wrote:
> Implement error_vprintf to send the output of error_report to
> the test log.  This silences test-vmstate.
> 
> Signed-off-by: Paolo Bonzini <address@hidden>
[..]
>  void error_vprintf(const char *fmt, va_list ap)
>  {
> -    vfprintf(stderr, fmt, ap);
> +    if (g_test_initialized() && !g_test_subprocess()) {

I like the approach. What I do not like is:
* we still generate noise only less visible
* it's indiscriminate (silences all error reports of this type)
* can't be incorporated into the test logic

IMHO these are no major problems, and what I'm going to suggest
might be over-engineering, but I will ask nevertheless.

Have you considered a thread local function pointer to 
defaulting to something sane (eg. to this test log stuff
or to a wrapped vprintf)?

This would invalidate all the points above, and make the compat
macros unnecessary -- which have bitten me on my ancient RHEL
(because glib is too old). I have tried out the idea, so
if you want I can send you a patch on top of this.

Halil

> +        char *msg = g_strdup_vprintf(fmt, ap);
> +        g_test_message("%s", msg);
> +        g_free(msg);
> +    } else {
> +        vfprintf(stderr, fmt, ap);
> +    }
>  }
> 
>  void error_vprintf_unless_qmp(const char *fmt, va_list ap)
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]