[PATCH v2] tests: Fix dispatching internal error reports

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]