[libvirt] [PATCH] tests: Fix dispatching internal error reports

Without this fix, the test suite doesn't print error messages when a libvirt function fails. Signed-off-by: Cole Robinson <crobinso@redhat.com> --- tests/testutils.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/testutils.c b/tests/testutils.c index 96181b2..8a3439d 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -126,12 +126,18 @@ virtTestRun(const char *title, int nloops, int (*body)(const void *data), const if (ts) GETTIMEOFDAY(&before); + virResetLastError(); - if ((ret = body(data)) != 0) - break; + ret = body(data); virErrorPtr err = virGetLastError(); - if (err) + if (err) { virDispatchError(NULL); + } + + if (ret != 0) { + break; + } + if (ts) { GETTIMEOFDAY(&after); ts[i] = DIFF_MSEC(&after, &before); -- 1.7.3.2

Without this fix, the test suite doesn't print error messages when a libvirt function fails. Additionally, only print error reports if DEBUG or VERBOSE requested. Signed-off-by: Cole Robinson <crobinso@redhat.com> --- tests/testutils.c | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/testutils.c b/tests/testutils.c index 96181b2..17584ac 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -126,13 +126,20 @@ virtTestRun(const char *title, int nloops, int (*body)(const void *data), const if (ts) GETTIMEOFDAY(&before); + virResetLastError(); - if ((ret = body(data)) != 0) - break; + ret = body(data); virErrorPtr err = virGetLastError(); - if (err) - virDispatchError(NULL); - if (ts) { + if (err) { + if (virTestGetVerbose() || virTestGetDebug()) + virDispatchError(NULL); + } + + if (ret != 0) { + break; + } + + if (ts) { GETTIMEOFDAY(&after); ts[i] = DIFF_MSEC(&after, &before); } -- 1.7.3.2

On 11/23/2010 09:12 AM, Cole Robinson wrote:
Without this fix, the test suite doesn't print error messages when a libvirt function fails. Additionally, only print error reports if DEBUG or VERBOSE requested.
Signed-off-by: Cole Robinson <crobinso@redhat.com> --- tests/testutils.c | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-)
ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On 11/23/2010 11:31 AM, Eric Blake wrote:
On 11/23/2010 09:12 AM, Cole Robinson wrote:
Without this fix, the test suite doesn't print error messages when a libvirt function fails. Additionally, only print error reports if DEBUG or VERBOSE requested.
Signed-off-by: Cole Robinson <crobinso@redhat.com> --- tests/testutils.c | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-)
ACK.
Thanks, pushed now. - Cole
participants (2)
-
Cole Robinson
-
Eric Blake