From d7ed2c18e1c669eb96d33b58fcc45bdeb6be1573 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Thu, 10 Sep 2009 11:07:20 +0100 Subject: [PATCH] Dump qemu driver capabilities if test debugging enabled * 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 deletion(-) diff --git a/tests/testutils.c b/tests/testutils.c index 5072fecb6b..536441a358 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 96b246f2a2..f036e0f136 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 58707e1722..d8854be863 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -4,6 +4,8 @@ #include #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: -- GitLab