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

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


Without this fix, the test suite doesn't print error messages when a libvirt
function fails.

Signed-off-by: Cole Robinson <crobinso at 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




More information about the libvir-list mailing list