From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byzZ1-0005Gg-9y for qemu-devel@nongnu.org; Tue, 25 Oct 2016 07:06:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1byzYx-0006XI-8L for qemu-devel@nongnu.org; Tue, 25 Oct 2016 07:06:39 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49648 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1byzYx-0006XA-1q for qemu-devel@nongnu.org; Tue, 25 Oct 2016 07:06:35 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9PB41Hb013981 for ; Tue, 25 Oct 2016 07:06:34 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 26a4frx1jf-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 25 Oct 2016 07:06:34 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 25 Oct 2016 12:06:32 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 6F0EB219005E for ; Tue, 25 Oct 2016 12:05:45 +0100 (BST) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u9PB6TRH10355086 for ; Tue, 25 Oct 2016 11:06:29 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u9PB6TRW031518 for ; Tue, 25 Oct 2016 05:06:29 -0600 References: <1477326663-67817-1-git-send-email-pbonzini@redhat.com> <1477326663-67817-3-git-send-email-pbonzini@redhat.com> From: Halil Pasic Date: Tue, 25 Oct 2016 13:06:29 +0200 MIME-Version: 1.0 In-Reply-To: <1477326663-67817-3-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Message-Id: Subject: Re: [Qemu-devel] [PATCH 2/2] tests: send error_report to test log List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: armbru@redhat.com, dglibert@redhat.com 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 [..] > 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) >