[libvirt] [PATCH 02/10] Dump qemu driver capabilities if test debugging enabled

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

 



* src/testutils.[ch]: make testDebug externally available

* src/testutilsqemu.c: if VIR_TEST_DEBUG is set, dump the qemu
  driver capabilities to stderr
---
 tests/testutils.c     |    3 ++-
 tests/testutils.h     |    2 ++
 tests/testutilsqemu.c |   14 ++++++++++++++
 3 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/tests/testutils.c b/tests/testutils.c
index 5072fec..536441a 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -45,8 +45,9 @@
     ((((int) ((T)->tv_sec - (U)->tv_sec)) * 1000000.0 +	\
       ((int) ((T)->tv_usec - (U)->tv_usec))) / 1000.0)
 
+unsigned int testDebug = 0;
+
 static unsigned int testOOM = 0;
-static unsigned int testDebug = 0;
 static unsigned int testCounter = 0;
 
 double
diff --git a/tests/testutils.h b/tests/testutils.h
index 96b246f..f036e0f 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -43,4 +43,6 @@ int virtTestMain(int argc,
         return virtTestMain(argc,argv, func);   \
     }
 
+extern unsigned int testDebug;
+
 #endif /* __VIT_TEST_UTILS_H__ */
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 58707e1..d8854be 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -4,6 +4,8 @@
 #include <stdlib.h>
 
 #include "testutilsqemu.h"
+#include "testutils.h"
+#include "memory.h"
 
 virCapsPtr testQemuCapsInit(void) {
     struct utsname utsname;
@@ -84,6 +86,18 @@ virCapsPtr testQemuCapsInit(void) {
                                       NULL) == NULL)
         goto cleanup;
 
+    if (testDebug) {
+        char *caps_str;
+
+        caps_str = virCapabilitiesFormatXML(caps);
+        if (!caps_str)
+            goto cleanup;
+
+        fprintf(stderr, "QEMU driver capabilities:\n%s", caps_str);
+
+        VIR_FREE(caps_str);
+    }
+
     return caps;
 
 cleanup:
-- 
1.6.2.5

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