mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Make QEMU test suite independant of host OS capabilities
This commit is contained in:
@@ -100,12 +100,12 @@ xmconfigtest_SOURCES = \
|
||||
xmconfigtest_LDADD = $(LDADDS)
|
||||
|
||||
qemuxml2argvtest_SOURCES = \
|
||||
qemuxml2argvtest.c \
|
||||
qemuxml2argvtest.c testutilsqemu.c testutilsqemu.h \
|
||||
testutils.c testutils.h
|
||||
qemuxml2argvtest_LDADD = $(LDADDS)
|
||||
|
||||
qemuxml2xmltest_SOURCES = \
|
||||
qemuxml2xmltest.c \
|
||||
qemuxml2xmltest.c testutilsqemu.c testutilsqemu.h \
|
||||
testutils.c testutils.h
|
||||
qemuxml2xmltest_LDADD = $(LDADDS)
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "testutils.h"
|
||||
#include "qemu_conf.h"
|
||||
|
||||
#include "testutilsqemu.h"
|
||||
|
||||
static char *progname;
|
||||
static char *abs_srcdir;
|
||||
static struct qemud_driver driver;
|
||||
@@ -130,7 +132,7 @@ main(int argc, char **argv)
|
||||
if (!abs_srcdir)
|
||||
abs_srcdir = getcwd(cwd, sizeof(cwd));
|
||||
|
||||
driver.caps = qemudCapsInit();
|
||||
driver.caps = testQemuCapsInit();
|
||||
|
||||
#define DO_TEST(name, extraFlags) \
|
||||
do { \
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "internal.h"
|
||||
#include "testutils.h"
|
||||
#include "qemu_conf.h"
|
||||
#include "testutilsqemu.h"
|
||||
|
||||
static char *progname;
|
||||
static char *abs_srcdir;
|
||||
@@ -86,7 +87,7 @@ main(int argc, char **argv)
|
||||
if (!abs_srcdir)
|
||||
abs_srcdir = getcwd(cwd, sizeof(cwd));
|
||||
|
||||
driver.caps = qemudCapsInit();
|
||||
driver.caps = testQemuCapsInit();
|
||||
|
||||
#define DO_TEST(name) \
|
||||
if (virtTestRun("QEMU XML-2-XML " name, \
|
||||
|
||||
71
tests/testutilsqemu.c
Normal file
71
tests/testutilsqemu.c
Normal file
@@ -0,0 +1,71 @@
|
||||
|
||||
#include <sys/utsname.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "testutilsqemu.h"
|
||||
|
||||
virCapsPtr testQemuCapsInit(void) {
|
||||
struct utsname utsname;
|
||||
virCapsPtr caps;
|
||||
virCapsGuestPtr guest;
|
||||
static const char *const x86_machines[] = {
|
||||
"pc", "isapc"
|
||||
};
|
||||
static const char *const xen_machines[] = {
|
||||
"xenner"
|
||||
};
|
||||
|
||||
uname (&utsname);
|
||||
if ((caps = virCapabilitiesNew(utsname.machine,
|
||||
0, 0)) == NULL)
|
||||
return NULL;
|
||||
|
||||
if ((guest = virCapabilitiesAddGuest(caps, "hvm", "i686", 32,
|
||||
"/usr/bin/qemu", NULL,
|
||||
2, x86_machines)) == NULL)
|
||||
goto cleanup;
|
||||
if (virCapabilitiesAddGuestDomain(guest,
|
||||
"qemu",
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
NULL) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
if ((guest = virCapabilitiesAddGuest(caps, "hvm", "x86_64", 64,
|
||||
"/usr/bin/qemu-system-x86_64", NULL,
|
||||
2, x86_machines)) == NULL)
|
||||
goto cleanup;
|
||||
if (virCapabilitiesAddGuestDomain(guest,
|
||||
"qemu",
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
NULL) == NULL)
|
||||
goto cleanup;
|
||||
if (virCapabilitiesAddGuestDomain(guest,
|
||||
"kvm",
|
||||
"/usr/bin/kvm",
|
||||
NULL,
|
||||
0,
|
||||
NULL) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
if ((guest = virCapabilitiesAddGuest(caps, "xen", "x86_64", 64,
|
||||
"/usr/bin/xenner", NULL,
|
||||
1, xen_machines)) == NULL)
|
||||
goto cleanup;
|
||||
if (virCapabilitiesAddGuestDomain(guest,
|
||||
"kvm",
|
||||
"/usr/bin/kvm",
|
||||
NULL,
|
||||
0,
|
||||
NULL) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
return caps;
|
||||
|
||||
cleanup:
|
||||
virCapabilitiesFree(caps);
|
||||
return NULL;
|
||||
}
|
||||
5
tests/testutilsqemu.h
Normal file
5
tests/testutilsqemu.h
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
#include "capabilities.h"
|
||||
|
||||
virCapsPtr testQemuCapsInit(void);
|
||||
|
||||
Reference in New Issue
Block a user