tests/testutilsqemu: introduce QEMUBinList with all qemu binaries for tests

Let's group all the binaries that we use in our test suite to one array.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2016-12-20 10:10:05 +01:00
parent 1da4efbe8a
commit 3a2c08ad32
1 changed files with 42 additions and 14 deletions

View File

@ -94,6 +94,31 @@ static virCPUDef cpuPower8Data = {
.threads = 8, .threads = 8,
}; };
typedef enum {
TEST_UTILS_QEMU_BIN_I686_HVM,
TEST_UTILS_QEMU_BIN_I686_KVM,
TEST_UTILS_QEMU_BIN_X86_64_HVM,
TEST_UTILS_QEMU_BIN_X86_64_KVM,
TEST_UTILS_QEMU_BIN_AARCH64_HVM,
TEST_UTILS_QEMU_BIN_ARM_HVM,
TEST_UTILS_QEMU_BIN_PPC64_HVM,
TEST_UTILS_QEMU_BIN_PPC_HVM,
TEST_UTILS_QEMU_BIN_S390X_HVM
} QEMUBinType;
static const char *QEMUBinList[] = {
"/usr/bin/qemu",
"/usr/bin/qemu-kvm",
"/usr/bin/qemu-system-x86_64",
"/usr/bin/kvm",
"/usr/bin/qemu-system-aarch64",
"/usr/bin/qemu-system-arm",
"/usr/bin/qemu-system-ppc64",
"/usr/bin/qemu-system-ppc",
"/usr/bin/qemu-system-s390x"
};
static virCapsGuestMachinePtr *testQemuAllocMachines(int *nmachines) static virCapsGuestMachinePtr *testQemuAllocMachines(int *nmachines)
{ {
virCapsGuestMachinePtr *machines; virCapsGuestMachinePtr *machines;
@ -154,7 +179,7 @@ testQemuAddI686Guest(virCapsPtr caps)
if (!(guest = virCapabilitiesAddGuest(caps, if (!(guest = virCapabilitiesAddGuest(caps,
VIR_DOMAIN_OSTYPE_HVM, VIR_DOMAIN_OSTYPE_HVM,
VIR_ARCH_I686, VIR_ARCH_I686,
"/usr/bin/qemu", QEMUBinList[TEST_UTILS_QEMU_BIN_I686_HVM],
NULL, NULL,
nmachines, nmachines,
machines))) machines)))
@ -178,7 +203,7 @@ testQemuAddI686Guest(virCapsPtr caps)
if (!virCapabilitiesAddGuestDomain(guest, if (!virCapabilitiesAddGuestDomain(guest,
VIR_DOMAIN_VIRT_KVM, VIR_DOMAIN_VIRT_KVM,
"/usr/bin/qemu-kvm", QEMUBinList[TEST_UTILS_QEMU_BIN_I686_KVM],
NULL, NULL,
nmachines, nmachines,
machines)) machines))
@ -205,7 +230,7 @@ testQemuAddX86_64Guest(virCapsPtr caps)
if (!(guest = virCapabilitiesAddGuest(caps, if (!(guest = virCapabilitiesAddGuest(caps,
VIR_DOMAIN_OSTYPE_HVM, VIR_DOMAIN_OSTYPE_HVM,
VIR_ARCH_X86_64, VIR_ARCH_X86_64,
"/usr/bin/qemu-system-x86_64", QEMUBinList[TEST_UTILS_QEMU_BIN_X86_64_HVM],
NULL, NULL,
nmachines, nmachines,
machines))) machines)))
@ -229,7 +254,7 @@ testQemuAddX86_64Guest(virCapsPtr caps)
if (!virCapabilitiesAddGuestDomain(guest, if (!virCapabilitiesAddGuestDomain(guest,
VIR_DOMAIN_VIRT_KVM, VIR_DOMAIN_VIRT_KVM,
"/usr/bin/kvm", QEMUBinList[TEST_UTILS_QEMU_BIN_X86_64_KVM],
NULL, NULL,
nmachines, nmachines,
machines)) machines))
@ -239,7 +264,7 @@ testQemuAddX86_64Guest(virCapsPtr caps)
if (!virCapabilitiesAddGuestDomain(guest, if (!virCapabilitiesAddGuestDomain(guest,
VIR_DOMAIN_VIRT_KVM, VIR_DOMAIN_VIRT_KVM,
"/usr/bin/kvm", QEMUBinList[TEST_UTILS_QEMU_BIN_X86_64_KVM],
NULL, NULL,
0, 0,
NULL)) NULL))
@ -264,8 +289,8 @@ static int testQemuAddPPC64Guest(virCapsPtr caps)
goto error; goto error;
guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_PPC64, guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_PPC64,
"/usr/bin/qemu-system-ppc64", NULL, QEMUBinList[TEST_UTILS_QEMU_BIN_PPC64_HVM],
1, machines); NULL, 1, machines);
if (!guest) if (!guest)
goto error; goto error;
@ -291,8 +316,8 @@ static int testQemuAddPPC64LEGuest(virCapsPtr caps)
goto error; goto error;
guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_PPC64LE, guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_PPC64LE,
"/usr/bin/qemu-system-ppc64", NULL, QEMUBinList[TEST_UTILS_QEMU_BIN_PPC64_HVM],
1, machines); NULL, 1, machines);
if (!guest) if (!guest)
goto error; goto error;
@ -321,8 +346,8 @@ static int testQemuAddPPCGuest(virCapsPtr caps)
goto error; goto error;
guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_PPC, guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_PPC,
"/usr/bin/qemu-system-ppc", NULL, QEMUBinList[TEST_UTILS_QEMU_BIN_PPC_HVM],
1, machines); NULL, 1, machines);
if (!guest) if (!guest)
goto error; goto error;
@ -350,7 +375,8 @@ static int testQemuAddS390Guest(virCapsPtr caps)
goto error; goto error;
guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_S390X, guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_S390X,
"/usr/bin/qemu-system-s390x", NULL, QEMUBinList[TEST_UTILS_QEMU_BIN_S390X_HVM],
NULL,
ARRAY_CARDINALITY(s390_machines), ARRAY_CARDINALITY(s390_machines),
machines); machines);
if (!guest) if (!guest)
@ -380,7 +406,8 @@ static int testQemuAddArmGuest(virCapsPtr caps)
goto error; goto error;
guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_ARMV7L, guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_ARMV7L,
"/usr/bin/qemu-system-arm", NULL, QEMUBinList[TEST_UTILS_QEMU_BIN_ARM_HVM],
NULL,
ARRAY_CARDINALITY(machines), ARRAY_CARDINALITY(machines),
capsmachines); capsmachines);
if (!guest) if (!guest)
@ -408,7 +435,8 @@ static int testQemuAddAARCH64Guest(virCapsPtr caps)
goto error; goto error;
guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_AARCH64, guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_AARCH64,
"/usr/bin/qemu-system-aarch64", NULL, QEMUBinList[TEST_UTILS_QEMU_BIN_AARCH64_HVM],
NULL,
ARRAY_CARDINALITY(machines), ARRAY_CARDINALITY(machines),
capsmachines); capsmachines);
if (!guest) if (!guest)