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

Cole Robinson crobinso at redhat.com
Tue Nov 23 16:12:16 UTC 2010


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 at 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




More information about the libvir-list mailing list