g_autofree char *fakerootdir = NULL;
g_autoptr(virQEMUDriverConfig) cfg = NULL;
g_autoptr(GHashTable) capslatest = NULL;
+ g_autoptr(GHashTable) capscache = virHashNew(virObjectFreeHashData);
g_autoptr(virConnect) conn = NULL;
capslatest = testQemuGetLatestCaps();
static struct testQemuInfo info = { \
.name = _name, \
}; \
- if (testQemuInfoSetArgs(&info, capslatest, \
+ if (testQemuInfoSetArgs(&info, capscache, capslatest, \
ARG_QEMU_CAPS, QEMU_CAPS_LAST, \
ARG_END) < 0 || \
qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) < 0) { \
g_autofree char *fakerootdir = NULL;
g_autoptr(GHashTable) capslatest = NULL;
g_autoptr(GHashTable) qapiSchemaCache = virHashNew((GDestroyNotify) virHashFree);
+ g_autoptr(GHashTable) capscache = virHashNew(virObjectFreeHashData);
fakerootdir = g_strdup(FAKEROOTDIRTEMPLATE);
.name = _name, \
}; \
info.qapiSchemaCache = qapiSchemaCache; \
- if (testQemuInfoSetArgs(&info, capslatest, \
+ if (testQemuInfoSetArgs(&info, capscache, capslatest, \
__VA_ARGS__, ARG_END) < 0) \
return EXIT_FAILURE; \
testInfoSetPaths(&info, _suffix); \
g_autofree char *fakerootdir = NULL;
g_autoptr(virQEMUDriverConfig) cfg = NULL;
g_autoptr(GHashTable) capslatest = NULL;
+ g_autoptr(GHashTable) capscache = virHashNew(virObjectFreeHashData);
g_autoptr(virConnect) conn = NULL;
capslatest = testQemuGetLatestCaps();
static struct testQemuInfo info = { \
.name = _name, \
}; \
- if (testQemuInfoSetArgs(&info, capslatest, \
+ if (testQemuInfoSetArgs(&info, capscache, capslatest, \
__VA_ARGS__, \
ARG_END) < 0 || \
qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) < 0) { \
int
testQemuInfoSetArgs(struct testQemuInfo *info,
+ GHashTable *capscache,
GHashTable *capslatest, ...)
{
va_list argptr;
if (!qemuCaps && capsarch && capsver) {
bool stripmachinealiases = false;
+ virQEMUCapsPtr cachedcaps = NULL;
info->arch = virArchFromString(capsarch);
TEST_QEMU_CAPS_PATH, capsver, capsarch);
}
- if (!(qemuCaps = qemuTestParseCapabilitiesArch(info->arch, capsfile)))
+ if (!g_hash_table_lookup_extended(capscache, capsfile, NULL, (void **) &cachedcaps)) {
+ if (!(qemuCaps = qemuTestParseCapabilitiesArch(info->arch, capsfile)))
+ goto cleanup;
+
+ if (stripmachinealiases)
+ virQEMUCapsStripMachineAliases(qemuCaps);
+
+ cachedcaps = qemuCaps;
+
+ g_hash_table_insert(capscache, g_strdup(capsfile), g_steal_pointer(&qemuCaps));
+ }
+
+ if (!(qemuCaps = virQEMUCapsNewCopy(cachedcaps)))
goto cleanup;
- if (stripmachinealiases)
- virQEMUCapsStripMachineAliases(qemuCaps);
info->flags |= FLAG_REAL_CAPS;
/* provide path to the replies file for schema testing */
void *opaque);
int testQemuInfoSetArgs(struct testQemuInfo *info,
+ GHashTable *capscache,
GHashTable *capslatest, ...);
void testQemuInfoClear(struct testQemuInfo *info);