From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH for 3.0 2/4] tests: don't silence error reporting for all tests
Date: Tue, 24 Jul 2018 17:35:00 +0100 [thread overview]
Message-ID: <20180724163500.GN19167@redhat.com> (raw)
In-Reply-To: <38b24622-d0e5-6ee9-24af-e23e2e5a6656@amsat.org>
On Wed, Jul 18, 2018 at 10:44:11AM -0300, Philippe Mathieu-Daudé wrote:
> Hi Daniel,
>
> On 07/18/2018 06:38 AM, Daniel P. Berrangé wrote:
> > The test-vmstate test is a bit chatty because it triggers various
> > expected failure scenarios and the code in question uses error_report
> > instead of accepting 'Error **errp' parameters. To silence this test the
> > stubs for error_vprintf() were changed to send errors via
> > g_test_message() instead of stderr:
> >
> > commit 28017e010ddf6849cfa830e898da3e44e6610952
> > Author: Paolo Bonzini <pbonzini@redhat.com>
> > Date: Mon Oct 24 18:31:03 2016 +0200
> >
> > tests: send error_report to test log
> >
> > Implement error_vprintf to send the output of error_report to
> > the test log. This silences test-vmstate.
> >
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > Message-Id: <1477326663-67817-3-git-send-email-pbonzini@redhat.com>
> >
> > Unfortunately this change has global impact across the entire test suite
> > and means that when tests fail for unexpected reasons, the message is
> > not displayed on stderr. eg when using &error_abort in a call the test
> > merely prints
> >
> > Unexpected error in qcrypto_tls_session_check_certificate() at crypto/tlssession.c:280:
> >
> > and the actual error message is hidden, making it impossible to diagnose
> > the failure. This is especially problematic in CI or build systems where
> > it isn't possible to easily pass the --debug-log flag to tests and
> > re-run with the test log visible.
> >
> > This change makes the previous big hammer much more nuanced, providing a
> > flag in the stub error_vprintf() that can used on a per-test basis to
> > silence the errors. Only the test-vmstate silences errors initially.
> >
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> > stubs/error-printf.c | 5 ++++-
> > tests/test-vmstate.c | 3 +++
> > 2 files changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/stubs/error-printf.c b/stubs/error-printf.c
> > index ac6b92aa69..2199d79d28 100644
> > --- a/stubs/error-printf.c
> > +++ b/stubs/error-printf.c
> > @@ -2,9 +2,12 @@
> > #include "qemu-common.h"
> > #include "qemu/error-report.h"
> >
> > +bool silence_test_errors;
>
> This is not used.
Yes, accidentally left over from earlier version of patch
>
> > +
> > void error_vprintf(const char *fmt, va_list ap)
> > {
> > - if (g_test_initialized() && !g_test_subprocess()) {
> > + if (g_test_initialized() && !g_test_subprocess() &&
> > + getenv("QTEST_SILENT_ERRORS")) {
> > char *msg = g_strdup_vprintf(fmt, ap);
> > g_test_message("%s", msg);
> > g_free(msg);
> > diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c
> > index 087844b6c8..42923bb1df 100644
> > --- a/tests/test-vmstate.c
> > +++ b/tests/test-vmstate.c
> > @@ -32,6 +32,7 @@
> > #include "../migration/qemu-file-channel.h"
> > #include "../migration/savevm.h"
> > #include "qemu/coroutine.h"
> > +#include "qemu/error-report.h"
>
> Why? This doesn't seem necessary, neither related to this patch.
Left over from an earlier version of the patch, I'll cull it.
>
> > #include "io/channel-file.h"
> >
> > static char temp_file[] = "/tmp/vmst.test.XXXXXX";
> > @@ -859,6 +860,8 @@ int main(int argc, char **argv)
> >
> > module_call_init(MODULE_INIT_QOM);
> >
> > + setenv("QTEST_SILENT_ERRORS", "1", 1);
> > +
> > g_test_init(&argc, &argv, NULL);
> > g_test_add_func("/vmstate/simple/primitive", test_simple_primitive);
> > g_test_add_func("/vmstate/versioned/load/v1", test_load_v1);
> >
>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2018-07-24 16:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-18 9:38 [Qemu-devel] [PATCH for 3.0 0/4] Multiple fixes and improvements to TLS tests Daniel P. Berrangé
2018-07-18 9:38 ` [Qemu-devel] [PATCH for 3.0 1/4] tests: call qcrypto_init instead of gnutls_global_init Daniel P. Berrangé
2018-07-18 13:41 ` Philippe Mathieu-Daudé
2018-07-18 9:38 ` [Qemu-devel] [PATCH for 3.0 2/4] tests: don't silence error reporting for all tests Daniel P. Berrangé
2018-07-18 13:44 ` Philippe Mathieu-Daudé
2018-07-24 16:35 ` Daniel P. Berrangé [this message]
2018-07-18 9:38 ` [Qemu-devel] [PATCH for 3.0 3/4] tests: use error_abort in places expecting errors Daniel P. Berrangé
2018-07-18 13:47 ` Philippe Mathieu-Daudé
2018-07-18 9:38 ` [Qemu-devel] [PATCH for 3.0 4/4] tests: fix TLS handshake failure with TLS 1.3 Daniel P. Berrangé
2018-07-24 15:30 ` Eric Blake
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=20180724163500.GN19167@redhat.com \
--to=berrange@redhat.com \
--cc=f4bug@amsat.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).