mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
tests: Use g_autoptr(qemuMonitorTest)
Instead of calling qemuMonitorTestFree() explicitly, we can use g_autoptr() and let it be called automagically. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
This commit is contained in:
parent
da71790bbd
commit
b118215703
@ -109,7 +109,7 @@ static int
|
|||||||
testQemuAgentFSFreeze(const void *data)
|
testQemuAgentFSFreeze(const void *data)
|
||||||
{
|
{
|
||||||
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
||||||
qemuMonitorTest *test = qemuMonitorTestNewAgent(xmlopt);
|
g_autoptr(qemuMonitorTest) test = qemuMonitorTestNewAgent(xmlopt);
|
||||||
const char *mountpoints[] = {"/fs1", "/fs2", "/fs3", "/fs4", "/fs5"};
|
const char *mountpoints[] = {"/fs1", "/fs2", "/fs3", "/fs4", "/fs5"};
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
@ -152,7 +152,6 @@ testQemuAgentFSFreeze(const void *data)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
qemuMonitorTestFree(test);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +160,7 @@ static int
|
|||||||
testQemuAgentFSThaw(const void *data)
|
testQemuAgentFSThaw(const void *data)
|
||||||
{
|
{
|
||||||
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
||||||
qemuMonitorTest *test = qemuMonitorTestNewAgent(xmlopt);
|
g_autoptr(qemuMonitorTest) test = qemuMonitorTestNewAgent(xmlopt);
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (!test)
|
if (!test)
|
||||||
@ -202,7 +201,6 @@ testQemuAgentFSThaw(const void *data)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
qemuMonitorTestFree(test);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +209,7 @@ static int
|
|||||||
testQemuAgentFSTrim(const void *data)
|
testQemuAgentFSTrim(const void *data)
|
||||||
{
|
{
|
||||||
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
||||||
qemuMonitorTest *test = qemuMonitorTestNewAgent(xmlopt);
|
g_autoptr(qemuMonitorTest) test = qemuMonitorTestNewAgent(xmlopt);
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (!test)
|
if (!test)
|
||||||
@ -232,7 +230,6 @@ testQemuAgentFSTrim(const void *data)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
qemuMonitorTestFree(test);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,7 +241,7 @@ testQemuAgentGetFSInfoCommon(virDomainXMLOption *xmlopt,
|
|||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
g_autofree char *domain_filename = NULL;
|
g_autofree char *domain_filename = NULL;
|
||||||
qemuMonitorTest *ret_test = NULL;
|
g_autoptr(qemuMonitorTest) ret_test = NULL;
|
||||||
g_autoptr(virDomainDef) ret_def = NULL;
|
g_autoptr(virDomainDef) ret_def = NULL;
|
||||||
|
|
||||||
if (!test || !def)
|
if (!test || !def)
|
||||||
@ -303,8 +300,6 @@ testQemuAgentGetFSInfoCommon(virDomainXMLOption *xmlopt,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (ret_test)
|
|
||||||
qemuMonitorTestFree(ret_test);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,7 +307,7 @@ static int
|
|||||||
testQemuAgentGetFSInfo(const void *data)
|
testQemuAgentGetFSInfo(const void *data)
|
||||||
{
|
{
|
||||||
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
||||||
qemuMonitorTest *test = NULL;
|
g_autoptr(qemuMonitorTest) test = NULL;
|
||||||
g_autoptr(virDomainDef) def = NULL;
|
g_autoptr(virDomainDef) def = NULL;
|
||||||
qemuAgentFSInfo **info = NULL;
|
qemuAgentFSInfo **info = NULL;
|
||||||
int ret = -1, ninfo = 0, i;
|
int ret = -1, ninfo = 0, i;
|
||||||
@ -405,7 +400,6 @@ testQemuAgentGetFSInfo(const void *data)
|
|||||||
for (i = 0; i < ninfo; i++)
|
for (i = 0; i < ninfo; i++)
|
||||||
qemuAgentFSInfoFree(info[i]);
|
qemuAgentFSInfoFree(info[i]);
|
||||||
VIR_FREE(info);
|
VIR_FREE(info);
|
||||||
qemuMonitorTestFree(test);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,7 +407,7 @@ static int
|
|||||||
testQemuAgentSuspend(const void *data)
|
testQemuAgentSuspend(const void *data)
|
||||||
{
|
{
|
||||||
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
||||||
qemuMonitorTest *test = qemuMonitorTestNewAgent(xmlopt);
|
g_autoptr(qemuMonitorTest) test = qemuMonitorTestNewAgent(xmlopt);
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -450,7 +444,6 @@ testQemuAgentSuspend(const void *data)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
qemuMonitorTestFree(test);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -511,7 +504,7 @@ static int
|
|||||||
testQemuAgentShutdown(const void *data)
|
testQemuAgentShutdown(const void *data)
|
||||||
{
|
{
|
||||||
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
||||||
qemuMonitorTest *test = qemuMonitorTestNewAgent(xmlopt);
|
g_autoptr(qemuMonitorTest) test = qemuMonitorTestNewAgent(xmlopt);
|
||||||
struct qemuAgentShutdownTestData priv;
|
struct qemuAgentShutdownTestData priv;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
@ -590,7 +583,6 @@ testQemuAgentShutdown(const void *data)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
qemuMonitorTestFree(test);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -631,7 +623,7 @@ static int
|
|||||||
testQemuAgentCPU(const void *data)
|
testQemuAgentCPU(const void *data)
|
||||||
{
|
{
|
||||||
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
||||||
qemuMonitorTest *test = qemuMonitorTestNewAgent(xmlopt);
|
g_autoptr(qemuMonitorTest) test = qemuMonitorTestNewAgent(xmlopt);
|
||||||
qemuAgentCPUInfo *cpuinfo = NULL;
|
qemuAgentCPUInfo *cpuinfo = NULL;
|
||||||
int nvcpus;
|
int nvcpus;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -703,7 +695,6 @@ testQemuAgentCPU(const void *data)
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(cpuinfo);
|
VIR_FREE(cpuinfo);
|
||||||
qemuMonitorTestFree(test);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -715,7 +706,7 @@ static int
|
|||||||
testQemuAgentArbitraryCommand(const void *data)
|
testQemuAgentArbitraryCommand(const void *data)
|
||||||
{
|
{
|
||||||
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
||||||
qemuMonitorTest *test = qemuMonitorTestNewAgent(xmlopt);
|
g_autoptr(qemuMonitorTest) test = qemuMonitorTestNewAgent(xmlopt);
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
g_autofree char *reply = NULL;
|
g_autofree char *reply = NULL;
|
||||||
|
|
||||||
@ -746,7 +737,6 @@ testQemuAgentArbitraryCommand(const void *data)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
qemuMonitorTestFree(test);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -764,7 +754,7 @@ static int
|
|||||||
testQemuAgentTimeout(const void *data)
|
testQemuAgentTimeout(const void *data)
|
||||||
{
|
{
|
||||||
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
||||||
qemuMonitorTest *test = qemuMonitorTestNewAgent(xmlopt);
|
g_autoptr(qemuMonitorTest) test = qemuMonitorTestNewAgent(xmlopt);
|
||||||
g_autofree char *reply = NULL;
|
g_autofree char *reply = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
@ -809,7 +799,6 @@ testQemuAgentTimeout(const void *data)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
qemuMonitorTestFree(test);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -890,7 +879,7 @@ static int
|
|||||||
testQemuAgentGetInterfaces(const void *data)
|
testQemuAgentGetInterfaces(const void *data)
|
||||||
{
|
{
|
||||||
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
||||||
qemuMonitorTest *test = qemuMonitorTestNewAgent(xmlopt);
|
g_autoptr(qemuMonitorTest) test = qemuMonitorTestNewAgent(xmlopt);
|
||||||
size_t i;
|
size_t i;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int ifaces_count = 0;
|
int ifaces_count = 0;
|
||||||
@ -991,7 +980,6 @@ testQemuAgentGetInterfaces(const void *data)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
qemuMonitorTestFree(test);
|
|
||||||
if (ifaces) {
|
if (ifaces) {
|
||||||
for (i = 0; i < ifaces_count; i++)
|
for (i = 0; i < ifaces_count; i++)
|
||||||
virDomainInterfaceFree(ifaces[i]);
|
virDomainInterfaceFree(ifaces[i]);
|
||||||
@ -1039,7 +1027,7 @@ static int
|
|||||||
testQemuAgentGetDisks(const void *data)
|
testQemuAgentGetDisks(const void *data)
|
||||||
{
|
{
|
||||||
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
||||||
qemuMonitorTest *test = qemuMonitorTestNewAgent(xmlopt);
|
g_autoptr(qemuMonitorTest) test = qemuMonitorTestNewAgent(xmlopt);
|
||||||
size_t i;
|
size_t i;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int disks_count = 0;
|
int disks_count = 0;
|
||||||
@ -1100,7 +1088,6 @@ testQemuAgentGetDisks(const void *data)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
qemuMonitorTestFree(test);
|
|
||||||
if (disks) {
|
if (disks) {
|
||||||
for (i = 0; i < disks_count; i++)
|
for (i = 0; i < disks_count; i++)
|
||||||
qemuAgentDiskInfoFree(disks[i]);
|
qemuAgentDiskInfoFree(disks[i]);
|
||||||
@ -1189,7 +1176,7 @@ static int
|
|||||||
testQemuAgentUsers(const void *data)
|
testQemuAgentUsers(const void *data)
|
||||||
{
|
{
|
||||||
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
||||||
qemuMonitorTest *test = qemuMonitorTestNewAgent(xmlopt);
|
g_autoptr(qemuMonitorTest) test = qemuMonitorTestNewAgent(xmlopt);
|
||||||
virTypedParameterPtr params = NULL;
|
virTypedParameterPtr params = NULL;
|
||||||
int nparams = 0;
|
int nparams = 0;
|
||||||
int maxparams = 0;
|
int maxparams = 0;
|
||||||
@ -1255,7 +1242,6 @@ testQemuAgentUsers(const void *data)
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virTypedParamsFree(params, nparams);
|
virTypedParamsFree(params, nparams);
|
||||||
qemuMonitorTestFree(test);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1289,7 +1275,7 @@ static int
|
|||||||
testQemuAgentOSInfo(const void *data)
|
testQemuAgentOSInfo(const void *data)
|
||||||
{
|
{
|
||||||
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
||||||
qemuMonitorTest *test = qemuMonitorTestNewAgent(xmlopt);
|
g_autoptr(qemuMonitorTest) test = qemuMonitorTestNewAgent(xmlopt);
|
||||||
virTypedParameterPtr params = NULL;
|
virTypedParameterPtr params = NULL;
|
||||||
int nparams = 0;
|
int nparams = 0;
|
||||||
int maxparams = 0;
|
int maxparams = 0;
|
||||||
@ -1375,7 +1361,6 @@ testQemuAgentOSInfo(const void *data)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
qemuMonitorTestFree(test);
|
|
||||||
virTypedParamsFree(params, nparams);
|
virTypedParamsFree(params, nparams);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1393,7 +1378,7 @@ static int
|
|||||||
testQemuAgentTimezone(const void *data)
|
testQemuAgentTimezone(const void *data)
|
||||||
{
|
{
|
||||||
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
||||||
qemuMonitorTest *test = qemuMonitorTestNewAgent(xmlopt);
|
g_autoptr(qemuMonitorTest) test = qemuMonitorTestNewAgent(xmlopt);
|
||||||
virTypedParameterPtr params = NULL;
|
virTypedParameterPtr params = NULL;
|
||||||
int nparams = 0;
|
int nparams = 0;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -1455,7 +1440,6 @@ testQemuAgentTimezone(const void *data)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
qemuMonitorTestFree(test);
|
|
||||||
virTypedParamsFree(params, nparams);
|
virTypedParamsFree(params, nparams);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ testQemuCaps(const void *opaque)
|
|||||||
testQemuData *data = (void *) opaque;
|
testQemuData *data = (void *) opaque;
|
||||||
g_autofree char *repliesFile = NULL;
|
g_autofree char *repliesFile = NULL;
|
||||||
g_autofree char *capsFile = NULL;
|
g_autofree char *capsFile = NULL;
|
||||||
qemuMonitorTest *mon = NULL;
|
g_autoptr(qemuMonitorTest) mon = NULL;
|
||||||
g_autoptr(virQEMUCaps) capsActual = NULL;
|
g_autoptr(virQEMUCaps) capsActual = NULL;
|
||||||
g_autofree char *binary = NULL;
|
g_autofree char *binary = NULL;
|
||||||
g_autofree char *actual = NULL;
|
g_autofree char *actual = NULL;
|
||||||
@ -132,7 +132,6 @@ testQemuCaps(const void *opaque)
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
qemuMonitorTestFree(mon);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ testQemuHotplug(const void *data)
|
|||||||
virDomainObj *vm = NULL;
|
virDomainObj *vm = NULL;
|
||||||
virDomainDeviceDef *dev = NULL;
|
virDomainDeviceDef *dev = NULL;
|
||||||
g_autoptr(virCaps) caps = NULL;
|
g_autoptr(virCaps) caps = NULL;
|
||||||
qemuMonitorTest *test_mon = NULL;
|
g_autoptr(qemuMonitorTest) test_mon = NULL;
|
||||||
qemuDomainObjPrivate *priv = NULL;
|
qemuDomainObjPrivate *priv = NULL;
|
||||||
|
|
||||||
domain_filename = g_strdup_printf("%s/qemuhotplugtestdomains/qemuhotplug-%s.xml",
|
domain_filename = g_strdup_printf("%s/qemuhotplugtestdomains/qemuhotplug-%s.xml",
|
||||||
@ -359,7 +359,6 @@ testQemuHotplug(const void *data)
|
|||||||
test->vm = NULL;
|
test->vm = NULL;
|
||||||
}
|
}
|
||||||
virDomainDeviceDefFree(dev);
|
virDomainDeviceDefFree(dev);
|
||||||
qemuMonitorTestFree(test_mon);
|
|
||||||
return ((ret < 0 && fail) || (!ret && !fail)) ? 0 : -1;
|
return ((ret < 0 && fail) || (!ret && !fail)) ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ qemuMigParamsTestXML(const void *opaque)
|
|||||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
g_autofree char *replyFile = NULL;
|
g_autofree char *replyFile = NULL;
|
||||||
g_autofree char *xmlFile = NULL;
|
g_autofree char *xmlFile = NULL;
|
||||||
qemuMonitorTest *mon = NULL;
|
g_autoptr(qemuMonitorTest) mon = NULL;
|
||||||
g_autoptr(virJSONValue) params = NULL;
|
g_autoptr(virJSONValue) params = NULL;
|
||||||
g_autoptr(qemuMigrationParams) migParams = NULL;
|
g_autoptr(qemuMigrationParams) migParams = NULL;
|
||||||
g_autofree char *actualXML = NULL;
|
g_autofree char *actualXML = NULL;
|
||||||
@ -128,7 +128,6 @@ qemuMigParamsTestXML(const void *opaque)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
qemuMonitorTestFree(mon);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +138,7 @@ qemuMigParamsTestJSON(const void *opaque)
|
|||||||
const qemuMigParamsData *data = opaque;
|
const qemuMigParamsData *data = opaque;
|
||||||
g_autofree char *replyFile = NULL;
|
g_autofree char *replyFile = NULL;
|
||||||
g_autofree char *jsonFile = NULL;
|
g_autofree char *jsonFile = NULL;
|
||||||
qemuMonitorTest *mon = NULL;
|
g_autoptr(qemuMonitorTest) mon = NULL;
|
||||||
g_autoptr(virJSONValue) paramsIn = NULL;
|
g_autoptr(virJSONValue) paramsIn = NULL;
|
||||||
g_autoptr(virJSONValue) paramsOut = NULL;
|
g_autoptr(virJSONValue) paramsOut = NULL;
|
||||||
g_autoptr(qemuMigrationParams) migParams = NULL;
|
g_autoptr(qemuMigrationParams) migParams = NULL;
|
||||||
@ -184,7 +183,6 @@ qemuMigParamsTestJSON(const void *opaque)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
qemuMonitorTestFree(mon);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -650,10 +650,14 @@ qemuMonitorJSONTestAttachOneChardev(virDomainXMLOption *xmlopt,
|
|||||||
|
|
||||||
{
|
{
|
||||||
struct qemuMonitorJSONTestAttachChardevData data = {0};
|
struct qemuMonitorJSONTestAttachChardevData data = {0};
|
||||||
|
g_autoptr(qemuMonitorTest) test = qemuMonitorTestNewSchema(xmlopt, schema);
|
||||||
g_autofree char *jsonreply = NULL;
|
g_autofree char *jsonreply = NULL;
|
||||||
g_autofree char *fulllabel = NULL;
|
g_autofree char *fulllabel = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
|
if (!test)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (!reply)
|
if (!reply)
|
||||||
reply = "";
|
reply = "";
|
||||||
|
|
||||||
@ -661,17 +665,16 @@ qemuMonitorJSONTestAttachOneChardev(virDomainXMLOption *xmlopt,
|
|||||||
|
|
||||||
fulllabel = g_strdup_printf("qemuMonitorJSONTestAttachChardev(%s)", label);
|
fulllabel = g_strdup_printf("qemuMonitorJSONTestAttachChardev(%s)", label);
|
||||||
|
|
||||||
|
qemuMonitorTestAllowUnusedCommands(test);
|
||||||
|
|
||||||
|
if (qemuMonitorTestAddItemExpect(test, "chardev-add",
|
||||||
|
expectargs, true, jsonreply) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
data.chr = chr;
|
data.chr = chr;
|
||||||
data.fail = fail;
|
data.fail = fail;
|
||||||
data.expectPty = expectPty;
|
data.expectPty = expectPty;
|
||||||
if (!(data.test = qemuMonitorTestNewSchema(xmlopt, schema)))
|
data.test = test;
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
qemuMonitorTestAllowUnusedCommands(data.test);
|
|
||||||
|
|
||||||
if (qemuMonitorTestAddItemExpect(data.test, "chardev-add",
|
|
||||||
expectargs, true, jsonreply) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (virTestRun(fulllabel, &testQemuMonitorJSONAttachChardev, &data) < 0)
|
if (virTestRun(fulllabel, &testQemuMonitorJSONAttachChardev, &data) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -679,7 +682,6 @@ qemuMonitorJSONTestAttachOneChardev(virDomainXMLOption *xmlopt,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
qemuMonitorTestFree(data.test);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2655,7 +2657,7 @@ static int
|
|||||||
testQueryJobs(const void *opaque)
|
testQueryJobs(const void *opaque)
|
||||||
{
|
{
|
||||||
const struct testQueryJobsData *data = opaque;
|
const struct testQueryJobsData *data = opaque;
|
||||||
qemuMonitorTest *test = qemuMonitorTestNewSimple(data->xmlopt);
|
g_autoptr(qemuMonitorTest) test = qemuMonitorTestNewSimple(data->xmlopt);
|
||||||
g_autofree char *filenameJSON = NULL;
|
g_autofree char *filenameJSON = NULL;
|
||||||
g_autofree char *fileJSON = NULL;
|
g_autofree char *fileJSON = NULL;
|
||||||
g_autofree char *filenameResult = NULL;
|
g_autofree char *filenameResult = NULL;
|
||||||
@ -2700,7 +2702,6 @@ testQueryJobs(const void *opaque)
|
|||||||
for (i = 0; i < njobs; i++)
|
for (i = 0; i < njobs; i++)
|
||||||
qemuMonitorJobInfoFree(jobs[i]);
|
qemuMonitorJobInfoFree(jobs[i]);
|
||||||
VIR_FREE(jobs);
|
VIR_FREE(jobs);
|
||||||
qemuMonitorTestFree(test);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -996,7 +996,7 @@ qemuMonitorCommonTestNew(virDomainXMLOption *xmlopt,
|
|||||||
virDomainObj *vm,
|
virDomainObj *vm,
|
||||||
virDomainChrSourceDef *src)
|
virDomainChrSourceDef *src)
|
||||||
{
|
{
|
||||||
qemuMonitorTest *test = NULL;
|
g_autoptr(qemuMonitorTest) test = NULL;
|
||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
char *tmpdir_template = NULL;
|
char *tmpdir_template = NULL;
|
||||||
|
|
||||||
@ -1044,12 +1044,11 @@ qemuMonitorCommonTestNew(virDomainXMLOption *xmlopt,
|
|||||||
if (virNetSocketListen(test->server, 1) < 0)
|
if (virNetSocketListen(test->server, 1) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
return test;
|
return g_steal_pointer(&test);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
VIR_FREE(path);
|
VIR_FREE(path);
|
||||||
VIR_FREE(tmpdir_template);
|
VIR_FREE(tmpdir_template);
|
||||||
qemuMonitorTestFree(test);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1116,7 +1115,7 @@ qemuMonitorTestNew(virDomainXMLOption *xmlopt,
|
|||||||
const char *greeting,
|
const char *greeting,
|
||||||
GHashTable *schema)
|
GHashTable *schema)
|
||||||
{
|
{
|
||||||
qemuMonitorTest *test = NULL;
|
g_autoptr(qemuMonitorTest) test = NULL;
|
||||||
virDomainChrSourceDef src;
|
virDomainChrSourceDef src;
|
||||||
|
|
||||||
memset(&src, 0, sizeof(src));
|
memset(&src, 0, sizeof(src));
|
||||||
@ -1150,11 +1149,10 @@ qemuMonitorTestNew(virDomainXMLOption *xmlopt,
|
|||||||
|
|
||||||
virDomainChrSourceDefClear(&src);
|
virDomainChrSourceDefClear(&src);
|
||||||
|
|
||||||
return test;
|
return g_steal_pointer(&test);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
virDomainChrSourceDefClear(&src);
|
virDomainChrSourceDefClear(&src);
|
||||||
qemuMonitorTestFree(test);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1177,7 +1175,7 @@ qemuMonitorTestNewFromFile(const char *fileName,
|
|||||||
virDomainXMLOption *xmlopt,
|
virDomainXMLOption *xmlopt,
|
||||||
bool simple)
|
bool simple)
|
||||||
{
|
{
|
||||||
qemuMonitorTest *test = NULL;
|
g_autoptr(qemuMonitorTest) test = NULL;
|
||||||
g_autofree char *json = NULL;
|
g_autofree char *json = NULL;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
char *singleReply;
|
char *singleReply;
|
||||||
@ -1226,10 +1224,9 @@ qemuMonitorTestNewFromFile(const char *fileName,
|
|||||||
if (test && qemuMonitorTestAddItem(test, NULL, singleReply) < 0)
|
if (test && qemuMonitorTestAddItem(test, NULL, singleReply) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
return test;
|
return g_steal_pointer(&test);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
qemuMonitorTestFree(test);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1311,7 +1308,7 @@ qemuMonitorTestNewFromFileFull(const char *fileName,
|
|||||||
virDomainObj *vm,
|
virDomainObj *vm,
|
||||||
GHashTable *qmpschema)
|
GHashTable *qmpschema)
|
||||||
{
|
{
|
||||||
qemuMonitorTest *ret = NULL;
|
g_autoptr(qemuMonitorTest) ret = NULL;
|
||||||
g_autofree char *jsonstr = NULL;
|
g_autofree char *jsonstr = NULL;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
size_t line = 0;
|
size_t line = 0;
|
||||||
@ -1377,10 +1374,9 @@ qemuMonitorTestNewFromFileFull(const char *fileName,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return g_steal_pointer(&ret);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
qemuMonitorTestFree(ret);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1388,7 +1384,7 @@ qemuMonitorTestNewFromFileFull(const char *fileName,
|
|||||||
qemuMonitorTest *
|
qemuMonitorTest *
|
||||||
qemuMonitorTestNewAgent(virDomainXMLOption *xmlopt)
|
qemuMonitorTestNewAgent(virDomainXMLOption *xmlopt)
|
||||||
{
|
{
|
||||||
qemuMonitorTest *test = NULL;
|
g_autoptr(qemuMonitorTest) test = NULL;
|
||||||
virDomainChrSourceDef src;
|
virDomainChrSourceDef src;
|
||||||
|
|
||||||
memset(&src, 0, sizeof(src));
|
memset(&src, 0, sizeof(src));
|
||||||
@ -1413,11 +1409,10 @@ qemuMonitorTestNewAgent(virDomainXMLOption *xmlopt)
|
|||||||
|
|
||||||
virDomainChrSourceDefClear(&src);
|
virDomainChrSourceDefClear(&src);
|
||||||
|
|
||||||
return test;
|
return g_steal_pointer(&test);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
virDomainChrSourceDefClear(&src);
|
virDomainChrSourceDefClear(&src);
|
||||||
qemuMonitorTestFree(test);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user