[PATCH] Improve error reporting in test suites

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

 



Before running each test case clear the thread local error
indicator. After running each test case, dispatch any error
that was reported

* tests/testutils.c: Fix error reporting in test suites
---
 tests/testutils.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tests/testutils.c b/tests/testutils.c
index 8171f10..70e7538 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -124,8 +124,12 @@ virtTestRun(const char *title, int nloops, int (*body)(const void *data), const
 
         if (ts)
             GETTIMEOFDAY(&before);
+        virResetLastError();
         if ((ret = body(data)) != 0)
             break;
+        virErrorPtr err = virGetLastError();
+        if (err)
+            virDispatchError(NULL);
         if (ts)	{
             GETTIMEOFDAY(&after);
             ts[i] = DIFF_MSEC(&after, &before);
-- 
1.7.2.3

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