testutilsqemu: Add support for specifying the variant for qemuxml2(argv|xml)test

Add the possibility to control the variant of the test data for real
caps testing in qemuxml2argvtest and qemuxml2xmltest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2023-03-08 17:23:05 +01:00
parent 12aedb4145
commit 87474f1d1f
2 changed files with 14 additions and 3 deletions

View File

@ -943,6 +943,10 @@ testQemuInfoSetArgs(struct testQemuInfo *info,
info->args.capsver = va_arg(argptr, char *);
break;
case ARG_CAPS_VARIANT:
info->args.capsvariant = va_arg(argptr, char *);
break;
case ARG_CAPS_HOST_CPU_MODEL:
info->args.capsHostCPUModel = va_arg(argptr, int);
break;
@ -1008,6 +1012,9 @@ testQemuInfoInitArgs(struct testQemuInfo *info)
info->args.newargs = false;
if (!info->args.capsvariant)
info->args.capsvariant = "";
if (info->args.invalidarg) {
fprintf(stderr, "Invalid argument encountered by 'testQemuInfoSetArgs'\n");
return -1;
@ -1025,7 +1032,8 @@ testQemuInfoInitArgs(struct testQemuInfo *info)
info->arch = virArchFromString(info->args.capsarch);
if (STREQ(info->args.capsver, "latest")) {
struct testQemuCapsFile *f = g_hash_table_lookup(info->conf->capslatest, info->args.capsarch);
g_autofree char *archvariant = g_strdup_printf("%s%s", info->args.capsarch, info->args.capsvariant);
struct testQemuCapsFile *f = g_hash_table_lookup(info->conf->capslatest, archvariant);
if (!f) {
fprintf(stderr, "'latest' caps for '%s' were not found\n", info->args.capsarch);
@ -1035,10 +1043,11 @@ testQemuInfoInitArgs(struct testQemuInfo *info)
capsfile = g_strdup(f->path);
stripmachinealiases = true;
} else {
capsfile = g_strdup_printf("%s/caps_%s_%s.xml",
capsfile = g_strdup_printf("%s/caps_%s_%s%s.xml",
TEST_QEMU_CAPS_PATH,
info->args.capsver,
info->args.capsarch);
info->args.capsarch,
info->args.capsvariant);
}
if (!g_hash_table_lookup_extended(info->conf->capscache, capsfile, NULL, (void **) &cachedcaps)) {

View File

@ -51,6 +51,7 @@ typedef enum {
ARG_PARSEFLAGS,
ARG_CAPS_ARCH,
ARG_CAPS_VER,
ARG_CAPS_VARIANT,
ARG_CAPS_HOST_CPU_MODEL,
ARG_HOST_OS,
ARG_FD_GROUP, /* name, nfds, fd[0], ... fd[n-1] */
@ -86,6 +87,7 @@ struct testQemuArgs {
virBitmap *fakeCapsDel;
char *capsver;
char *capsarch;
const char *capsvariant;
qemuTestCPUDef capsHostCPUModel;
int gic;
testQemuHostOS hostOS;