tests: split out common qemu driver initialization

Two utility functions are introduced for proper initialization and
cleanup of the driver.

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Pavel Fedin
2015-09-22 13:56:59 +02:00
committed by Ján Tomko
parent 03cf57a37d
commit 5b7bf20877
9 changed files with 52 additions and 51 deletions
+5 -5
View File
@@ -908,8 +908,8 @@ testQemuAgentGetInterfaces(const void *data)
static int
mymain(void)
{
virQEMUDriver driver;
int ret = 0;
virDomainXMLOptionPtr xmlopt;
#if !WITH_YAJL
fputs("libvirt not compiled with yajl, skipping this test\n", stderr);
@@ -917,13 +917,13 @@ mymain(void)
#endif
if (virThreadInitialize() < 0 ||
!(xmlopt = virQEMUDriverCreateXMLConf(NULL)))
qemuTestDriverInit(&driver) < 0)
return EXIT_FAILURE;
virEventRegisterDefaultImpl();
#define DO_TEST(name) \
if (virtTestRun(# name, testQemuAgent ## name, xmlopt) < 0) \
#define DO_TEST(name) \
if (virtTestRun(# name, testQemuAgent ## name, driver.xmlopt) < 0) \
ret = -1
DO_TEST(FSFreeze);
@@ -938,7 +938,7 @@ mymain(void)
DO_TEST(Timeout); /* Timeout should always be called last */
virObjectUnref(xmlopt);
qemuTestDriverFree(&driver);
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}