summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2010-11-23 11:01:03 -0500
committerCole Robinson <crobinso@redhat.com>2010-11-23 12:15:14 -0500
commitb2399b06c5268b18f9a85b23968ecbaec4800999 (patch)
tree7df8998a6084a84e475dadaa9d64faa4c908172c
parentlibvirtd: fix bug when shrinking number of clients (diff)
downloadlibvirt-b2399b06c5268b18f9a85b23968ecbaec4800999.tar.gz
libvirt-b2399b06c5268b18f9a85b23968ecbaec4800999.tar.bz2
libvirt-b2399b06c5268b18f9a85b23968ecbaec4800999.zip
tests: Fix dispatching internal error reports
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.
-rw-r--r--tests/testutils.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/testutils.c b/tests/testutils.c
index 96181b2db..17584acaa 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);
}