提交 0636c4a8 编写于 作者: P Pavel Fedin 提交者: Ján Tomko

tests: use mockup cache

Use the new API in order to correctly add capability sets to the cache
before parsing XML files
Signed-off-by: NPavel Fedin <p.fedin@samsung.com>
Signed-off-by: NJán Tomko <jtomko@redhat.com>
上级 f7dd3357
......@@ -57,7 +57,7 @@ static int
qemuHotplugCreateObjects(virDomainXMLOptionPtr xmlopt,
virDomainObjPtr *vm,
const char *domxml,
bool event)
bool event, const char *testname)
{
int ret = -1;
qemuDomainObjPrivatePtr priv = NULL;
......@@ -65,12 +65,6 @@ qemuHotplugCreateObjects(virDomainXMLOptionPtr xmlopt,
if (!(*vm = virDomainObjNew(xmlopt)))
goto cleanup;
if (!((*vm)->def = virDomainDefParseString(domxml,
driver.caps,
driver.xmlopt,
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
goto cleanup;
priv = (*vm)->privateData;
if (!(priv->qemuCaps = virQEMUCapsNew()))
......@@ -85,6 +79,17 @@ qemuHotplugCreateObjects(virDomainXMLOptionPtr xmlopt,
if (event)
virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_DEL_EVENT);
ret = qemuTestCapsCacheInsert(driver.qemuCapsCache, testname,
priv->qemuCaps);
if (ret < 0)
goto cleanup;
if (!((*vm)->def = virDomainDefParseString(domxml,
driver.caps,
driver.xmlopt,
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
goto cleanup;
if (qemuDomainAssignAddresses((*vm)->def, priv->qemuCaps, *vm) < 0)
goto cleanup;
......@@ -243,7 +248,8 @@ testQemuHotplug(const void *data)
vm = test->vm;
} else {
if (qemuHotplugCreateObjects(driver.xmlopt, &vm, domain_xml,
test->deviceDeletedEvent) < 0)
test->deviceDeletedEvent,
test->domain_filename) < 0)
goto cleanup;
}
......
......@@ -423,6 +423,11 @@ testCompareXMLToArgvHelper(const void *data)
if (virQEMUCapsGet(info->extraFlags, QEMU_CAPS_ENABLE_FIPS))
flags |= FLAG_FIPS;
result = qemuTestCapsCacheInsert(driver.qemuCapsCache, info->name,
info->extraFlags);
if (result < 0)
goto cleanup;
result = testCompareXMLToArgvFiles(xml, args, info->extraFlags,
info->migrateFrom, info->migrateFd,
flags);
......
......@@ -179,6 +179,12 @@ testCompareXMLToArgvHelper(const void *data)
abs_srcdir, info->name) < 0)
goto cleanup;
qemuTestCapsName = info->name;
result = qemuTestCapsCacheInsert(driver.qemuCapsCache, info->name,
info->extraFlags);
if (result < 0)
goto cleanup;
result = testCompareXMLToArgvFiles(xml, args, info->extraFlags,
info->migrateFrom, info->migrateFd,
info->json, info->expectError);
......
......@@ -559,6 +559,8 @@ int qemuTestCapsCacheInsert(virQEMUCapsCachePtr cache, const char *binary,
ret = virHashAddEntry(cache->binaries, binary, caps);
if (ret < 0)
virObjectUnref(caps);
else
qemuTestCapsName = binary;
return ret;
}
......@@ -573,10 +575,19 @@ int qemuTestDriverInit(virQEMUDriver *driver)
if (!driver->caps)
goto error;
/* Using /dev/null for libDir and cacheDir automatically produces errors
* upon attempt to use any of them */
driver->qemuCapsCache = virQEMUCapsCacheNew("/dev/null", "/dev/null", 0, 0);
if (!driver->qemuCapsCache)
goto error;
driver->xmlopt = virQEMUDriverCreateXMLConf(driver);
if (!driver->xmlopt)
goto error;
if (qemuTestCapsCacheInsert(driver->qemuCapsCache, "empty", NULL) < 0)
goto error;
return 0;
error:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册