[libvirt] [PATCH] Improve error reporting in test suites

Before running each test case clear the thread local error indicator. After running each test case, dispatch any error that was reported * tests/testutils.c: Fix error reporting in test suites --- tests/testutils.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/tests/testutils.c b/tests/testutils.c index 8171f10..70e7538 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -124,8 +124,12 @@ virtTestRun(const char *title, int nloops, int (*body)(const void *data), const if (ts) GETTIMEOFDAY(&before); + virResetLastError(); if ((ret = body(data)) != 0) break; + virErrorPtr err = virGetLastError(); + if (err) + virDispatchError(NULL); if (ts) { GETTIMEOFDAY(&after); ts[i] = DIFF_MSEC(&after, &before); -- 1.7.2.3

On 10/13/2010 05:11 AM, Daniel P. Berrange wrote:
Before running each test case clear the thread local error indicator. After running each test case, dispatch any error that was reported
* tests/testutils.c: Fix error reporting in test suites --- tests/testutils.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On 10/13/2010 08:45 AM, Eric Blake wrote:
On 10/13/2010 05:11 AM, Daniel P. Berrange wrote:
Before running each test case clear the thread local error indicator. After running each test case, dispatch any error that was reported
* tests/testutils.c: Fix error reporting in test suites --- tests/testutils.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
ACK.
Hmm, this adds a lot of noise to 'make check': TEST: qemuxml2argvtest ..libvir: QEMU error : unsupported configuration: the QEMU binary /usr/bin/kvm does not support kvm ......libvir: QEMU error : unsupported configuration: the QEMU binary /usr/bin/xenner does not support kvm ................................ 40 .....libvir: QEMU error : unsupported configuration: the QEMU binary /usr/bin/xenner does not support kvm ... TEST: nwfilterxml2xmltest libvir: Network Filtererror : internal error protocolid has illegal value 15 .libvir: Network Filtererror : internal error opcode has illegal value 65536 .libvir: Network Filtererror : internal error opcode has illegal value 65536 .libvir: Network Filtererror : internal error dscp has illegal value 64 ... It doesn't add any additional failures, but looks ugly. We should probably do something similar to 9e3525df8, by using virtTestLogContentAndReset() in appropriate places to silence tests where we expect an error to be logged, rather than leaking the errors out the testsuite. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On Wed, Oct 13, 2010 at 11:27:21AM -0600, Eric Blake wrote:
On 10/13/2010 08:45 AM, Eric Blake wrote:
On 10/13/2010 05:11 AM, Daniel P. Berrange wrote:
Before running each test case clear the thread local error indicator. After running each test case, dispatch any error that was reported
* tests/testutils.c: Fix error reporting in test suites --- tests/testutils.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
ACK.
Hmm, this adds a lot of noise to 'make check':
TEST: qemuxml2argvtest ..libvir: QEMU error : unsupported configuration: the QEMU binary /usr/bin/kvm does not support kvm ......libvir: QEMU error : unsupported configuration: the QEMU binary /usr/bin/xenner does not support kvm ................................ 40 .....libvir: QEMU error : unsupported configuration: the QEMU binary /usr/bin/xenner does not support kvm
... TEST: nwfilterxml2xmltest libvir: Network Filtererror : internal error protocolid has illegal value 15 .libvir: Network Filtererror : internal error opcode has illegal value 65536 .libvir: Network Filtererror : internal error opcode has illegal value 65536 .libvir: Network Filtererror : internal error dscp has illegal value 64 ...
It doesn't add any additional failures, but looks ugly. We should probably do something similar to 9e3525df8, by using virtTestLogContentAndReset() in appropriate places to silence tests where we expect an error to be logged, rather than leaking the errors out the testsuite.
Hmm, I puzzelled why I didn't notice this :-( I'll investigate, and if there's no easy option, I'll disable this again. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
participants (2)
-
Daniel P. Berrange
-
Eric Blake