1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 07:59:00 +00:00

tests: allow setting extra capabilities on top of versioned caps

In the QEMU tests a test can either use an explicitly listed set of
capabilities, or can request those matching a particular QEMU
version. Sometimes it is desirable to be able to list extra caps
on top of those implied by a particular version.

This is useful, for example, when QEMU won't report certain features
unless it was run on particular hardware or kernels, and those were
not used when a caps snapshot was imported to the libvirt source tree.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2021-12-09 09:57:05 -05:00
parent 1826716c1f
commit a4efca7695

View File

@ -772,11 +772,6 @@ testQemuInfoInitArgs(struct testQemuInfo *info)
bool stripmachinealiases = false;
virQEMUCaps *cachedcaps = NULL;
if (info->args.fakeCapsUsed) {
fprintf(stderr, "ARG_QEMU_CAPS can not be combined with ARG_CAPS_ARCH or ARG_CAPS_VER\n");
return -1;
}
info->arch = virArchFromString(info->args.capsarch);
if (STREQ(info->args.capsver, "latest")) {
@ -805,6 +800,16 @@ testQemuInfoInitArgs(struct testQemuInfo *info)
if (!(info->qemuCaps = virQEMUCapsNewCopy(cachedcaps)))
return -1;
if (info->args.fakeCapsUsed) {
size_t i;
for (i = 0; i < QEMU_CAPS_LAST; i++) {
if (virQEMUCapsGet(info->args.fakeCaps, i)) {
virQEMUCapsSet(info->qemuCaps, i);
}
}
}
if (stripmachinealiases)
virQEMUCapsStripMachineAliases(info->qemuCaps);