]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: Fix dispatching internal error reports
authorCole Robinson <crobinso@redhat.com>
Tue, 23 Nov 2010 16:01:03 +0000 (11:01 -0500)
committerCole Robinson <crobinso@redhat.com>
Tue, 23 Nov 2010 17:15:14 +0000 (12:15 -0500)
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.

tests/testutils.c

index 96181b2db615dedf7dc926111f5781d294dc5470..17584acaac2d88a2845ba84aabb03e48aa17b631 100644 (file)
@@ -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);
         }