mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
Fix test cases for virArch changes
This commit is contained in:
parent
473011334c
commit
392c192240
@ -274,9 +274,10 @@ cpuTestGuestData(const void *arg)
|
||||
cmpResult == VIR_CPU_COMPARE_INCOMPATIBLE)
|
||||
goto cleanup;
|
||||
|
||||
if (VIR_ALLOC(guest) < 0 || !(guest->arch = strdup(host->arch)))
|
||||
if (VIR_ALLOC(guest) < 0)
|
||||
goto cleanup;
|
||||
|
||||
guest->arch = host->arch;
|
||||
guest->type = VIR_CPU_TYPE_GUEST;
|
||||
guest->match = VIR_CPU_MATCH_EXACT;
|
||||
guest->fallback = cpu->fallback;
|
||||
|
@ -141,8 +141,8 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
||||
VIR_FREE(log);
|
||||
virResetLastError();
|
||||
|
||||
if (STREQLEN(vmdef->os.arch, "x86_64", 6) ||
|
||||
STREQLEN(vmdef->os.arch, "i686", 4)) {
|
||||
if (vmdef->os.arch == VIR_ARCH_X86_64 ||
|
||||
vmdef->os.arch == VIR_ARCH_I686) {
|
||||
qemuCapsSet(extraFlags, QEMU_CAPS_PCI_MULTIBUS);
|
||||
}
|
||||
|
||||
|
@ -99,8 +99,8 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
||||
VIR_FREE(log);
|
||||
virResetLastError();
|
||||
|
||||
if (STREQLEN(vmdef->os.arch, "x86_64", 6) ||
|
||||
STREQLEN(vmdef->os.arch, "i686", 4)) {
|
||||
if (vmdef->os.arch == VIR_ARCH_X86_64 ||
|
||||
vmdef->os.arch == VIR_ARCH_I686) {
|
||||
qemuCapsSet(extraFlags, QEMU_CAPS_PCI_MULTIBUS);
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
|
||||
static int testLXCDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
|
||||
const char *arch ATTRIBUTE_UNUSED)
|
||||
virArch arch ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC;
|
||||
}
|
||||
@ -19,13 +19,13 @@ virCapsPtr testLXCCapsInit(void) {
|
||||
virCapsPtr caps;
|
||||
virCapsGuestPtr guest;
|
||||
|
||||
if ((caps = virCapabilitiesNew("x86_64",
|
||||
if ((caps = virCapabilitiesNew(VIR_ARCH_X86_64,
|
||||
0, 0)) == NULL)
|
||||
return NULL;
|
||||
|
||||
caps->defaultConsoleTargetType = testLXCDefaultConsoleType;
|
||||
|
||||
if ((guest = virCapabilitiesAddGuest(caps, "exe", "i686", 32,
|
||||
if ((guest = virCapabilitiesAddGuest(caps, "exe", VIR_ARCH_I686,
|
||||
"/usr/libexec/libvirt_lxc", NULL,
|
||||
0, NULL)) == NULL)
|
||||
goto error;
|
||||
@ -34,7 +34,7 @@ virCapsPtr testLXCCapsInit(void) {
|
||||
goto error;
|
||||
|
||||
|
||||
if ((guest = virCapabilitiesAddGuest(caps, "exe", "x86_64", 64,
|
||||
if ((guest = virCapabilitiesAddGuest(caps, "exe", VIR_ARCH_X86_64,
|
||||
"/usr/libexec/libvirt_lxc", NULL,
|
||||
0, NULL)) == NULL)
|
||||
goto error;
|
||||
|
@ -56,9 +56,10 @@ static virCapsGuestMachinePtr *testQemuAllocNewerMachines(int *nmachines)
|
||||
}
|
||||
|
||||
static int testQemuDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
|
||||
const char *arch)
|
||||
virArch arch)
|
||||
{
|
||||
if (STRPREFIX(arch, "s390"))
|
||||
if (arch == VIR_ARCH_S390 ||
|
||||
arch == VIR_ARCH_S390X)
|
||||
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO;
|
||||
else
|
||||
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
|
||||
@ -74,7 +75,7 @@ static int testQemuAddPPC64Guest(virCapsPtr caps)
|
||||
if (!machines)
|
||||
goto error;
|
||||
|
||||
guest = virCapabilitiesAddGuest(caps, "hvm", "ppc64", 64,
|
||||
guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_PPC64,
|
||||
"/usr/bin/qemu-system-ppc64", NULL,
|
||||
1, machines);
|
||||
if (!guest)
|
||||
@ -102,7 +103,7 @@ static int testQemuAddS390Guest(virCapsPtr caps)
|
||||
if (!machines)
|
||||
goto error;
|
||||
|
||||
guest = virCapabilitiesAddGuest(caps, "hvm", "s390x", 64,
|
||||
guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_S390X,
|
||||
"/usr/bin/qemu-system-s390x", NULL,
|
||||
ARRAY_CARDINALITY(s390_machines),
|
||||
machines);
|
||||
@ -146,7 +147,7 @@ virCapsPtr testQemuCapsInit(void) {
|
||||
VIR_CPU_TYPE_HOST, /* type */
|
||||
0, /* mode */
|
||||
0, /* match */
|
||||
(char *) "x86_64", /* arch */
|
||||
VIR_ARCH_X86_64, /* arch */
|
||||
(char *) "core2duo", /* model */
|
||||
NULL, /* vendor_id */
|
||||
0, /* fallback */
|
||||
@ -175,7 +176,7 @@ virCapsPtr testQemuCapsInit(void) {
|
||||
|
||||
qemuDomainSetNamespaceHooks(caps);
|
||||
|
||||
if ((guest = virCapabilitiesAddGuest(caps, "hvm", "i686", 32,
|
||||
if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_I686,
|
||||
"/usr/bin/qemu", NULL,
|
||||
nmachines, machines)) == NULL ||
|
||||
!virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0))
|
||||
@ -193,7 +194,7 @@ virCapsPtr testQemuCapsInit(void) {
|
||||
if ((machines = testQemuAllocNewerMachines(&nmachines)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
if ((guest = virCapabilitiesAddGuest(caps, "hvm", "x86_64", 64,
|
||||
if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_X86_64,
|
||||
"/usr/bin/qemu-system-x86_64", NULL,
|
||||
nmachines, machines)) == NULL ||
|
||||
!virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0))
|
||||
@ -224,7 +225,7 @@ virCapsPtr testQemuCapsInit(void) {
|
||||
if ((machines = virCapabilitiesAllocMachines(xen_machines, nmachines)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
if ((guest = virCapabilitiesAddGuest(caps, "xen", "x86_64", 64,
|
||||
if ((guest = virCapabilitiesAddGuest(caps, "xen", VIR_ARCH_X86_64,
|
||||
"/usr/bin/xenner", NULL,
|
||||
nmachines, machines)) == NULL)
|
||||
goto cleanup;
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "domain_conf.h"
|
||||
|
||||
static int testXenDefaultConsoleType(const char *ostype,
|
||||
const char *arch ATTRIBUTE_UNUSED)
|
||||
virArch arch ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (STREQ(ostype, "hvm"))
|
||||
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
|
||||
@ -29,7 +29,7 @@ virCapsPtr testXenCapsInit(void) {
|
||||
};
|
||||
|
||||
uname(&utsname);
|
||||
if ((caps = virCapabilitiesNew(utsname.machine,
|
||||
if ((caps = virCapabilitiesNew(VIR_ARCH_I686,
|
||||
0, 0)) == NULL)
|
||||
return NULL;
|
||||
|
||||
@ -39,7 +39,7 @@ virCapsPtr testXenCapsInit(void) {
|
||||
if ((machines = virCapabilitiesAllocMachines(x86_machines, nmachines)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
if ((guest = virCapabilitiesAddGuest(caps, "hvm", "i686", 32,
|
||||
if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_I686,
|
||||
"/usr/lib/xen/bin/qemu-dm", NULL,
|
||||
nmachines, machines)) == NULL)
|
||||
goto cleanup;
|
||||
@ -57,7 +57,7 @@ virCapsPtr testXenCapsInit(void) {
|
||||
if ((machines = virCapabilitiesAllocMachines(xen_machines, nmachines)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
if ((guest = virCapabilitiesAddGuest(caps, "xen", "i686", 32,
|
||||
if ((guest = virCapabilitiesAddGuest(caps, "xen", VIR_ARCH_I686,
|
||||
"/usr/lib/xen/bin/qemu-dm", NULL,
|
||||
nmachines, machines)) == NULL)
|
||||
goto cleanup;
|
||||
|
@ -15,7 +15,7 @@ static virCapsPtr caps;
|
||||
static virVMXContext ctx;
|
||||
|
||||
static int testDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
|
||||
const char *arch ATTRIBUTE_UNUSED)
|
||||
virArch arch ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
|
||||
}
|
||||
@ -25,7 +25,7 @@ testCapsInit(void)
|
||||
{
|
||||
virCapsGuestPtr guest = NULL;
|
||||
|
||||
caps = virCapabilitiesNew("i686", 1, 1);
|
||||
caps = virCapabilitiesNew(VIR_ARCH_I686, 1, 1);
|
||||
|
||||
if (caps == NULL) {
|
||||
return;
|
||||
@ -40,7 +40,9 @@ testCapsInit(void)
|
||||
|
||||
/* i686 guest */
|
||||
guest =
|
||||
virCapabilitiesAddGuest(caps, "hvm", "i686", 32, NULL, NULL, 0, NULL);
|
||||
virCapabilitiesAddGuest(caps, "hvm",
|
||||
VIR_ARCH_I686,
|
||||
NULL, NULL, 0, NULL);
|
||||
|
||||
if (guest == NULL) {
|
||||
goto failure;
|
||||
@ -53,7 +55,9 @@ testCapsInit(void)
|
||||
|
||||
/* x86_64 guest */
|
||||
guest =
|
||||
virCapabilitiesAddGuest(caps, "hvm", "x86_64", 64, NULL, NULL, 0, NULL);
|
||||
virCapabilitiesAddGuest(caps, "hvm",
|
||||
VIR_ARCH_X86_64,
|
||||
NULL, NULL, 0, NULL);
|
||||
|
||||
if (guest == NULL) {
|
||||
goto failure;
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "virfile.h"
|
||||
|
||||
static int
|
||||
testCompareFiles(const char *hostmachine, const char *xml_rel,
|
||||
testCompareFiles(virArch hostmachine, const char *xml_rel,
|
||||
const char *cpuinfo_rel, const char *capabilities_rel)
|
||||
{
|
||||
char *expectxml = NULL;
|
||||
@ -67,31 +67,31 @@ testCompareFiles(const char *hostmachine, const char *xml_rel,
|
||||
}
|
||||
|
||||
static int testXeni686(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("i686",
|
||||
"xencapsdata/xen-i686.xml",
|
||||
"xencapsdata/xen-i686.cpuinfo",
|
||||
"xencapsdata/xen-i686.caps");
|
||||
return testCompareFiles(VIR_ARCH_I686,
|
||||
"xencapsdata/xen-i686.xml",
|
||||
"xencapsdata/xen-i686.cpuinfo",
|
||||
"xencapsdata/xen-i686.caps");
|
||||
}
|
||||
|
||||
static int testXeni686PAE(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("i686",
|
||||
"xencapsdata/xen-i686-pae.xml",
|
||||
"xencapsdata/xen-i686-pae.cpuinfo",
|
||||
"xencapsdata/xen-i686-pae.caps");
|
||||
return testCompareFiles(VIR_ARCH_I686,
|
||||
"xencapsdata/xen-i686-pae.xml",
|
||||
"xencapsdata/xen-i686-pae.cpuinfo",
|
||||
"xencapsdata/xen-i686-pae.caps");
|
||||
}
|
||||
|
||||
static int testXeni686PAEHVM(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("i686",
|
||||
"xencapsdata/xen-i686-pae-hvm.xml",
|
||||
"xencapsdata/xen-i686-pae-hvm.cpuinfo",
|
||||
"xencapsdata/xen-i686-pae-hvm.caps");
|
||||
return testCompareFiles(VIR_ARCH_I686,
|
||||
"xencapsdata/xen-i686-pae-hvm.xml",
|
||||
"xencapsdata/xen-i686-pae-hvm.cpuinfo",
|
||||
"xencapsdata/xen-i686-pae-hvm.caps");
|
||||
}
|
||||
|
||||
/* No PAE + HVM is non-sensical - all VMX capable
|
||||
CPUs have PAE */
|
||||
/*
|
||||
static int testXeni686HVM(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("i686",
|
||||
return testCompareFiles(VIR_ARCH_I686,
|
||||
"xencapsdata/xen-i686-hvm.xml",
|
||||
"xencapsdata/xen-i686.cpuinfo",
|
||||
"xencapsdata/xen-i686-hvm.caps");
|
||||
@ -99,49 +99,49 @@ static int testXeni686HVM(const void *data ATTRIBUTE_UNUSED) {
|
||||
*/
|
||||
|
||||
static int testXenx86_64(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("x86_64",
|
||||
"xencapsdata/xen-x86_64.xml",
|
||||
"xencapsdata/xen-x86_64.cpuinfo",
|
||||
"xencapsdata/xen-x86_64.caps");
|
||||
return testCompareFiles(VIR_ARCH_X86_64,
|
||||
"xencapsdata/xen-x86_64.xml",
|
||||
"xencapsdata/xen-x86_64.cpuinfo",
|
||||
"xencapsdata/xen-x86_64.caps");
|
||||
}
|
||||
static int testXenx86_64HVM(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("x86_64",
|
||||
"xencapsdata/xen-x86_64-hvm.xml",
|
||||
"xencapsdata/xen-x86_64-hvm.cpuinfo",
|
||||
"xencapsdata/xen-x86_64-hvm.caps");
|
||||
return testCompareFiles(VIR_ARCH_X86_64,
|
||||
"xencapsdata/xen-x86_64-hvm.xml",
|
||||
"xencapsdata/xen-x86_64-hvm.cpuinfo",
|
||||
"xencapsdata/xen-x86_64-hvm.caps");
|
||||
}
|
||||
|
||||
static int testXenia64(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("ia64",
|
||||
"xencapsdata/xen-ia64.xml",
|
||||
"xencapsdata/xen-ia64.cpuinfo",
|
||||
"xencapsdata/xen-ia64.caps");
|
||||
return testCompareFiles(VIR_ARCH_ITANIUM,
|
||||
"xencapsdata/xen-ia64.xml",
|
||||
"xencapsdata/xen-ia64.cpuinfo",
|
||||
"xencapsdata/xen-ia64.caps");
|
||||
}
|
||||
static int testXenia64BE(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("ia64",
|
||||
"xencapsdata/xen-ia64-be.xml",
|
||||
"xencapsdata/xen-ia64-be.cpuinfo",
|
||||
"xencapsdata/xen-ia64-be.caps");
|
||||
return testCompareFiles(VIR_ARCH_ITANIUM,
|
||||
"xencapsdata/xen-ia64-be.xml",
|
||||
"xencapsdata/xen-ia64-be.cpuinfo",
|
||||
"xencapsdata/xen-ia64-be.caps");
|
||||
}
|
||||
|
||||
static int testXenia64HVM(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("ia64",
|
||||
"xencapsdata/xen-ia64-hvm.xml",
|
||||
"xencapsdata/xen-ia64-hvm.cpuinfo",
|
||||
"xencapsdata/xen-ia64-hvm.caps");
|
||||
return testCompareFiles(VIR_ARCH_ITANIUM,
|
||||
"xencapsdata/xen-ia64-hvm.xml",
|
||||
"xencapsdata/xen-ia64-hvm.cpuinfo",
|
||||
"xencapsdata/xen-ia64-hvm.caps");
|
||||
}
|
||||
static int testXenia64BEHVM(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("ia64",
|
||||
"xencapsdata/xen-ia64-be-hvm.xml",
|
||||
"xencapsdata/xen-ia64-be-hvm.cpuinfo",
|
||||
"xencapsdata/xen-ia64-be-hvm.caps");
|
||||
return testCompareFiles(VIR_ARCH_ITANIUM,
|
||||
"xencapsdata/xen-ia64-be-hvm.xml",
|
||||
"xencapsdata/xen-ia64-be-hvm.cpuinfo",
|
||||
"xencapsdata/xen-ia64-be-hvm.caps");
|
||||
}
|
||||
|
||||
static int testXenppc64(const void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("ppc64",
|
||||
"xencapsdata/xen-ppc64.xml",
|
||||
"xencapsdata/xen-ppc64.cpuinfo",
|
||||
"xencapsdata/xen-ppc64.caps");
|
||||
return testCompareFiles(VIR_ARCH_PPC64,
|
||||
"xencapsdata/xen-ppc64.xml",
|
||||
"xencapsdata/xen-ppc64.cpuinfo",
|
||||
"xencapsdata/xen-ppc64.caps");
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ static virCapsPtr caps;
|
||||
static virVMXContext ctx;
|
||||
|
||||
static int testDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
|
||||
const char *arch ATTRIBUTE_UNUSED)
|
||||
virArch arch ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
|
||||
}
|
||||
@ -25,7 +25,7 @@ testCapsInit(void)
|
||||
{
|
||||
virCapsGuestPtr guest = NULL;
|
||||
|
||||
caps = virCapabilitiesNew("i686", 1, 1);
|
||||
caps = virCapabilitiesNew(VIR_ARCH_I686, 1, 1);
|
||||
|
||||
if (caps == NULL) {
|
||||
return;
|
||||
@ -40,7 +40,9 @@ testCapsInit(void)
|
||||
|
||||
/* i686 guest */
|
||||
guest =
|
||||
virCapabilitiesAddGuest(caps, "hvm", "i686", 32, NULL, NULL, 0, NULL);
|
||||
virCapabilitiesAddGuest(caps, "hvm",
|
||||
VIR_ARCH_I686,
|
||||
NULL, NULL, 0, NULL);
|
||||
|
||||
if (guest == NULL) {
|
||||
goto failure;
|
||||
@ -53,7 +55,9 @@ testCapsInit(void)
|
||||
|
||||
/* x86_64 guest */
|
||||
guest =
|
||||
virCapabilitiesAddGuest(caps, "hvm", "x86_64", 64, NULL, NULL, 0, NULL);
|
||||
virCapabilitiesAddGuest(caps, "hvm",
|
||||
VIR_ARCH_X86_64,
|
||||
NULL, NULL, 0, NULL);
|
||||
|
||||
if (guest == NULL) {
|
||||
goto failure;
|
||||
|
Loading…
x
Reference in New Issue
Block a user