mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
qemumonitorjsontest: Simplify returns
Time to remove the cleanup labels rendered useless in the previous patch. There are still plenty of other tests that could be further simplified, but I've already spent enough time in this file for now. Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
4b658bfe4b
commit
1ddc7e0363
@ -152,7 +152,6 @@ testQemuMonitorJSONGetStatus(const void *opaque)
|
|||||||
{
|
{
|
||||||
const testGenericData *data = opaque;
|
const testGenericData *data = opaque;
|
||||||
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
||||||
int ret = -1;
|
|
||||||
bool running = false;
|
bool running = false;
|
||||||
virDomainPausedReason reason = 0;
|
virDomainPausedReason reason = 0;
|
||||||
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
||||||
@ -168,7 +167,7 @@ testQemuMonitorJSONGetStatus(const void *opaque)
|
|||||||
" \"running\": true "
|
" \"running\": true "
|
||||||
" } "
|
" } "
|
||||||
"}") < 0)
|
"}") < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
if (qemuMonitorTestAddItem(test, "query-status",
|
if (qemuMonitorTestAddItem(test, "query-status",
|
||||||
"{ "
|
"{ "
|
||||||
" \"return\": { "
|
" \"return\": { "
|
||||||
@ -176,7 +175,7 @@ testQemuMonitorJSONGetStatus(const void *opaque)
|
|||||||
" \"running\": false "
|
" \"running\": false "
|
||||||
" } "
|
" } "
|
||||||
"}") < 0)
|
"}") < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
if (qemuMonitorTestAddItem(test, "query-status",
|
if (qemuMonitorTestAddItem(test, "query-status",
|
||||||
"{ "
|
"{ "
|
||||||
" \"return\": { "
|
" \"return\": { "
|
||||||
@ -185,60 +184,57 @@ testQemuMonitorJSONGetStatus(const void *opaque)
|
|||||||
" \"running\": false "
|
" \"running\": false "
|
||||||
" } "
|
" } "
|
||||||
"}") < 0)
|
"}") < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (qemuMonitorGetStatus(qemuMonitorTestGetMonitor(test),
|
if (qemuMonitorGetStatus(qemuMonitorTestGetMonitor(test),
|
||||||
&running, &reason) < 0)
|
&running, &reason) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (!running) {
|
if (!running) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
"Running was not true");
|
"Running was not true");
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reason != VIR_DOMAIN_PAUSED_UNKNOWN) {
|
if (reason != VIR_DOMAIN_PAUSED_UNKNOWN) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"Reason was unexpectedly set to %d", reason);
|
"Reason was unexpectedly set to %d", reason);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemuMonitorGetStatus(qemuMonitorTestGetMonitor(test),
|
if (qemuMonitorGetStatus(qemuMonitorTestGetMonitor(test),
|
||||||
&running, &reason) < 0)
|
&running, &reason) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (running) {
|
if (running) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
"Running was not false");
|
"Running was not false");
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reason != VIR_DOMAIN_PAUSED_UNKNOWN) {
|
if (reason != VIR_DOMAIN_PAUSED_UNKNOWN) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"Reason was unexpectedly set to %d", reason);
|
"Reason was unexpectedly set to %d", reason);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemuMonitorGetStatus(qemuMonitorTestGetMonitor(test),
|
if (qemuMonitorGetStatus(qemuMonitorTestGetMonitor(test),
|
||||||
&running, &reason) < 0)
|
&running, &reason) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (running) {
|
if (running) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
"Running was not false");
|
"Running was not false");
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reason != VIR_DOMAIN_PAUSED_MIGRATION) {
|
if (reason != VIR_DOMAIN_PAUSED_MIGRATION) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"Reason was unexpectedly set to %d", reason);
|
"Reason was unexpectedly set to %d", reason);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -951,23 +947,19 @@ testQemuMonitorJSONDetachChardev(const void *opaque)
|
|||||||
{
|
{
|
||||||
const testGenericData *data = opaque;
|
const testGenericData *data = opaque;
|
||||||
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
||||||
int ret = -1;
|
|
||||||
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
||||||
|
|
||||||
if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
|
if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
|
||||||
return ret;
|
return -1;
|
||||||
|
|
||||||
if (qemuMonitorTestAddItem(test, "chardev-remove", "{\"return\": {}}") < 0)
|
if (qemuMonitorTestAddItem(test, "chardev-remove", "{\"return\": {}}") < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (qemuMonitorDetachCharDev(qemuMonitorTestGetMonitor(test),
|
if (qemuMonitorDetachCharDev(qemuMonitorTestGetMonitor(test),
|
||||||
"dummy_chrID") < 0)
|
"dummy_chrID") < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1062,7 +1054,6 @@ testQemuMonitorJSONGetObjectProperty(const void *opaque)
|
|||||||
{
|
{
|
||||||
const testGenericData *data = opaque;
|
const testGenericData *data = opaque;
|
||||||
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
||||||
int ret = -1;
|
|
||||||
qemuMonitorJSONObjectProperty prop;
|
qemuMonitorJSONObjectProperty prop;
|
||||||
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
||||||
|
|
||||||
@ -1071,7 +1062,7 @@ testQemuMonitorJSONGetObjectProperty(const void *opaque)
|
|||||||
|
|
||||||
if (qemuMonitorTestAddItem(test, "qom-get",
|
if (qemuMonitorTestAddItem(test, "qom-get",
|
||||||
"{ \"return\": true }") < 0)
|
"{ \"return\": true }") < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
/* Present with path and property */
|
/* Present with path and property */
|
||||||
memset(&prop, 0, sizeof(qemuMonitorJSONObjectProperty));
|
memset(&prop, 0, sizeof(qemuMonitorJSONObjectProperty));
|
||||||
@ -1080,17 +1071,15 @@ testQemuMonitorJSONGetObjectProperty(const void *opaque)
|
|||||||
"/machine/i440fx",
|
"/machine/i440fx",
|
||||||
"realized",
|
"realized",
|
||||||
&prop) < 0)
|
&prop) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (!prop.val.b) {
|
if (!prop.val.b) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
"expected true, but false returned");
|
"expected true, but false returned");
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1105,7 +1094,6 @@ testQemuMonitorJSONSetObjectProperty(const void *opaque)
|
|||||||
{
|
{
|
||||||
const testGenericData *data = opaque;
|
const testGenericData *data = opaque;
|
||||||
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
||||||
int ret = -1;
|
|
||||||
qemuMonitorJSONObjectProperty prop;
|
qemuMonitorJSONObjectProperty prop;
|
||||||
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
||||||
|
|
||||||
@ -1114,10 +1102,10 @@ testQemuMonitorJSONSetObjectProperty(const void *opaque)
|
|||||||
|
|
||||||
if (qemuMonitorTestAddItem(test, "qom-set",
|
if (qemuMonitorTestAddItem(test, "qom-set",
|
||||||
"{ \"return\": {} }") < 0)
|
"{ \"return\": {} }") < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
if (qemuMonitorTestAddItem(test, "qom-get",
|
if (qemuMonitorTestAddItem(test, "qom-get",
|
||||||
"{ \"return\": true }") < 0)
|
"{ \"return\": true }") < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
/* Let's attempt the setting */
|
/* Let's attempt the setting */
|
||||||
memset(&prop, 0, sizeof(qemuMonitorJSONObjectProperty));
|
memset(&prop, 0, sizeof(qemuMonitorJSONObjectProperty));
|
||||||
@ -1127,7 +1115,7 @@ testQemuMonitorJSONSetObjectProperty(const void *opaque)
|
|||||||
"/machine/i440fx",
|
"/machine/i440fx",
|
||||||
"realized",
|
"realized",
|
||||||
&prop) < 0)
|
&prop) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
/* To make sure it worked, fetch the property - if this succeeds then
|
/* To make sure it worked, fetch the property - if this succeeds then
|
||||||
* we didn't hose things
|
* we didn't hose things
|
||||||
@ -1138,17 +1126,15 @@ testQemuMonitorJSONSetObjectProperty(const void *opaque)
|
|||||||
"/machine/i440fx",
|
"/machine/i440fx",
|
||||||
"realized",
|
"realized",
|
||||||
&prop) < 0)
|
&prop) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (!prop.val.b) {
|
if (!prop.val.b) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
"expected true, but false returned");
|
"expected true, but false returned");
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1217,7 +1203,6 @@ testQemuMonitorJSONCPU(const void *opaque)
|
|||||||
{
|
{
|
||||||
const testGenericData *data = opaque;
|
const testGenericData *data = opaque;
|
||||||
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
||||||
int ret = -1;
|
|
||||||
bool running = false;
|
bool running = false;
|
||||||
virDomainPausedReason reason = 0;
|
virDomainPausedReason reason = 0;
|
||||||
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
||||||
@ -1237,38 +1222,35 @@ testQemuMonitorJSONCPU(const void *opaque)
|
|||||||
" \"status\": \"running\","
|
" \"status\": \"running\","
|
||||||
" \"singlestep\": false,"
|
" \"singlestep\": false,"
|
||||||
" \"running\": true}}") < 0)
|
" \"running\": true}}") < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (qemuMonitorJSONStopCPUs(qemuMonitorTestGetMonitor(test)) < 0)
|
if (qemuMonitorJSONStopCPUs(qemuMonitorTestGetMonitor(test)) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (qemuMonitorGetStatus(qemuMonitorTestGetMonitor(test),
|
if (qemuMonitorGetStatus(qemuMonitorTestGetMonitor(test),
|
||||||
&running, &reason) < 0)
|
&running, &reason) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (running) {
|
if (running) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
"Running was not false");
|
"Running was not false");
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemuMonitorJSONStartCPUs(qemuMonitorTestGetMonitor(test)) < 0)
|
if (qemuMonitorJSONStartCPUs(qemuMonitorTestGetMonitor(test)) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (qemuMonitorGetStatus(qemuMonitorTestGetMonitor(test),
|
if (qemuMonitorGetStatus(qemuMonitorTestGetMonitor(test),
|
||||||
&running, &reason) < 0)
|
&running, &reason) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (!running) {
|
if (!running) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
"Running was not true");
|
"Running was not true");
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1412,7 +1394,6 @@ testQemuMonitorJSONqemuMonitorJSONQueryCPUs(const void *opaque)
|
|||||||
{
|
{
|
||||||
const testGenericData *data = opaque;
|
const testGenericData *data = opaque;
|
||||||
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
||||||
int ret = -1;
|
|
||||||
struct qemuMonitorQueryCpusEntry expect_slow[] = {
|
struct qemuMonitorQueryCpusEntry expect_slow[] = {
|
||||||
{0, 17622, (char *) "/machine/unattached/device[0]", true},
|
{0, 17622, (char *) "/machine/unattached/device[0]", true},
|
||||||
{1, 17624, (char *) "/machine/unattached/device[1]", true},
|
{1, 17624, (char *) "/machine/unattached/device[1]", true},
|
||||||
@ -1465,7 +1446,7 @@ testQemuMonitorJSONqemuMonitorJSONQueryCPUs(const void *opaque)
|
|||||||
" ],"
|
" ],"
|
||||||
" \"id\": \"libvirt-7\""
|
" \"id\": \"libvirt-7\""
|
||||||
"}") < 0)
|
"}") < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (qemuMonitorTestAddItem(test, "query-cpus-fast",
|
if (qemuMonitorTestAddItem(test, "query-cpus-fast",
|
||||||
"{"
|
"{"
|
||||||
@ -1483,22 +1464,19 @@ testQemuMonitorJSONqemuMonitorJSONQueryCPUs(const void *opaque)
|
|||||||
" ],"
|
" ],"
|
||||||
" \"id\": \"libvirt-8\""
|
" \"id\": \"libvirt-8\""
|
||||||
"}") < 0)
|
"}") < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
/* query-cpus */
|
/* query-cpus */
|
||||||
if (testQEMUMonitorJSONqemuMonitorJSONQueryCPUsHelper(test, expect_slow,
|
if (testQEMUMonitorJSONqemuMonitorJSONQueryCPUsHelper(test, expect_slow,
|
||||||
false, 4))
|
false, 4))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
/* query-cpus-fast */
|
/* query-cpus-fast */
|
||||||
if (testQEMUMonitorJSONqemuMonitorJSONQueryCPUsHelper(test, expect_fast,
|
if (testQEMUMonitorJSONqemuMonitorJSONQueryCPUsHelper(test, expect_fast,
|
||||||
true, 2))
|
true, 2))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1506,7 +1484,6 @@ testQemuMonitorJSONqemuMonitorJSONGetBalloonInfo(const void *opaque)
|
|||||||
{
|
{
|
||||||
const testGenericData *data = opaque;
|
const testGenericData *data = opaque;
|
||||||
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
||||||
int ret = -1;
|
|
||||||
unsigned long long currmem;
|
unsigned long long currmem;
|
||||||
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
||||||
|
|
||||||
@ -1520,21 +1497,18 @@ testQemuMonitorJSONqemuMonitorJSONGetBalloonInfo(const void *opaque)
|
|||||||
" },"
|
" },"
|
||||||
" \"id\": \"libvirt-9\""
|
" \"id\": \"libvirt-9\""
|
||||||
"}") < 0)
|
"}") < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (qemuMonitorJSONGetBalloonInfo(qemuMonitorTestGetMonitor(test), &currmem) < 0)
|
if (qemuMonitorJSONGetBalloonInfo(qemuMonitorTestGetMonitor(test), &currmem) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (currmem != (18446744073709551615ULL/1024)) {
|
if (currmem != (18446744073709551615ULL/1024)) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"Unexpected currmem value: %llu", currmem);
|
"Unexpected currmem value: %llu", currmem);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1542,7 +1516,6 @@ testQemuMonitorJSONqemuMonitorJSONGetVirtType(const void *opaque)
|
|||||||
{
|
{
|
||||||
const testGenericData *data = opaque;
|
const testGenericData *data = opaque;
|
||||||
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
||||||
int ret = -1;
|
|
||||||
virDomainVirtType virtType;
|
virDomainVirtType virtType;
|
||||||
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
||||||
|
|
||||||
@ -1565,28 +1538,27 @@ testQemuMonitorJSONqemuMonitorJSONGetVirtType(const void *opaque)
|
|||||||
" },"
|
" },"
|
||||||
" \"id\": \"libvirt-7\""
|
" \"id\": \"libvirt-7\""
|
||||||
"}") < 0)
|
"}") < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (qemuMonitorJSONGetVirtType(qemuMonitorTestGetMonitor(test), &virtType) < 0)
|
if (qemuMonitorJSONGetVirtType(qemuMonitorTestGetMonitor(test), &virtType) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (virtType != VIR_DOMAIN_VIRT_KVM) {
|
if (virtType != VIR_DOMAIN_VIRT_KVM) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"Unexpected virt type: %d, expecting %d", virtType, VIR_DOMAIN_VIRT_KVM);
|
"Unexpected virt type: %d, expecting %d", virtType, VIR_DOMAIN_VIRT_KVM);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemuMonitorJSONGetVirtType(qemuMonitorTestGetMonitor(test), &virtType) < 0)
|
if (qemuMonitorJSONGetVirtType(qemuMonitorTestGetMonitor(test), &virtType) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (virtType != VIR_DOMAIN_VIRT_QEMU) {
|
if (virtType != VIR_DOMAIN_VIRT_QEMU) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"Unexpected virt type: %d, expecting %d", virtType, VIR_DOMAIN_VIRT_QEMU);
|
"Unexpected virt type: %d, expecting %d", virtType, VIR_DOMAIN_VIRT_QEMU);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1860,7 +1832,6 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCacheSize(const void *opaque)
|
|||||||
{
|
{
|
||||||
const testGenericData *data = opaque;
|
const testGenericData *data = opaque;
|
||||||
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
||||||
int ret = -1;
|
|
||||||
unsigned long long cacheSize;
|
unsigned long long cacheSize;
|
||||||
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
||||||
|
|
||||||
@ -1872,23 +1843,20 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCacheSize(const void *opaque)
|
|||||||
" \"return\": 67108864,"
|
" \"return\": 67108864,"
|
||||||
" \"id\": \"libvirt-12\""
|
" \"id\": \"libvirt-12\""
|
||||||
"}") < 0)
|
"}") < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (qemuMonitorJSONGetMigrationCacheSize(qemuMonitorTestGetMonitor(test),
|
if (qemuMonitorJSONGetMigrationCacheSize(qemuMonitorTestGetMonitor(test),
|
||||||
&cacheSize) < 0)
|
&cacheSize) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (cacheSize != 67108864) {
|
if (cacheSize != 67108864) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"Invalid cacheSize: %llu, expected 67108864",
|
"Invalid cacheSize: %llu, expected 67108864",
|
||||||
cacheSize);
|
cacheSize);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -2264,7 +2232,6 @@ testQemuMonitorJSONqemuMonitorJSONSendKey(const void *opaque)
|
|||||||
{
|
{
|
||||||
const testGenericData *data = opaque;
|
const testGenericData *data = opaque;
|
||||||
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
||||||
int ret = -1;
|
|
||||||
unsigned int keycodes[] = {43, 26, 46, 32};
|
unsigned int keycodes[] = {43, 26, 46, 32};
|
||||||
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
||||||
|
|
||||||
@ -2273,15 +2240,13 @@ testQemuMonitorJSONqemuMonitorJSONSendKey(const void *opaque)
|
|||||||
|
|
||||||
if (qemuMonitorTestAddItem(test, "send-key",
|
if (qemuMonitorTestAddItem(test, "send-key",
|
||||||
"{\"return\": {}, \"id\": \"libvirt-16\"}") < 0)
|
"{\"return\": {}, \"id\": \"libvirt-16\"}") < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (qemuMonitorJSONSendKey(qemuMonitorTestGetMonitor(test),
|
if (qemuMonitorJSONSendKey(qemuMonitorTestGetMonitor(test),
|
||||||
0, keycodes, ARRAY_CARDINALITY(keycodes)) < 0)
|
0, keycodes, ARRAY_CARDINALITY(keycodes)) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -2289,7 +2254,6 @@ testQemuMonitorJSONqemuMonitorJSONSendKeyHoldtime(const void *opaque)
|
|||||||
{
|
{
|
||||||
const testGenericData *data = opaque;
|
const testGenericData *data = opaque;
|
||||||
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
||||||
int ret = -1;
|
|
||||||
unsigned int keycodes[] = {43, 26, 46, 32};
|
unsigned int keycodes[] = {43, 26, 46, 32};
|
||||||
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
||||||
|
|
||||||
@ -2304,16 +2268,14 @@ testQemuMonitorJSONqemuMonitorJSONSendKeyHoldtime(const void *opaque)
|
|||||||
"{\"type\":\"number\",\"data\":46},"
|
"{\"type\":\"number\",\"data\":46},"
|
||||||
"{\"type\":\"number\",\"data\":32}]",
|
"{\"type\":\"number\",\"data\":32}]",
|
||||||
NULL, NULL) < 0)
|
NULL, NULL) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (qemuMonitorJSONSendKey(qemuMonitorTestGetMonitor(test),
|
if (qemuMonitorJSONSendKey(qemuMonitorTestGetMonitor(test),
|
||||||
31337, keycodes,
|
31337, keycodes,
|
||||||
ARRAY_CARDINALITY(keycodes)) < 0)
|
ARRAY_CARDINALITY(keycodes)) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -2321,7 +2283,6 @@ testQemuMonitorJSONqemuMonitorSupportsActiveCommit(const void *opaque)
|
|||||||
{
|
{
|
||||||
const testGenericData *data = opaque;
|
const testGenericData *data = opaque;
|
||||||
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
||||||
int ret = -1;
|
|
||||||
const char *error1 =
|
const char *error1 =
|
||||||
"{"
|
"{"
|
||||||
" \"error\": {"
|
" \"error\": {"
|
||||||
@ -2344,22 +2305,20 @@ testQemuMonitorJSONqemuMonitorSupportsActiveCommit(const void *opaque)
|
|||||||
if (qemuMonitorTestAddItemParams(test, "block-commit", error1,
|
if (qemuMonitorTestAddItemParams(test, "block-commit", error1,
|
||||||
"device", "\"bogus\"",
|
"device", "\"bogus\"",
|
||||||
NULL, NULL) < 0)
|
NULL, NULL) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (!qemuMonitorSupportsActiveCommit(qemuMonitorTestGetMonitor(test)))
|
if (!qemuMonitorSupportsActiveCommit(qemuMonitorTestGetMonitor(test)))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (qemuMonitorTestAddItemParams(test, "block-commit", error2,
|
if (qemuMonitorTestAddItemParams(test, "block-commit", error2,
|
||||||
"device", "\"bogus\"",
|
"device", "\"bogus\"",
|
||||||
NULL, NULL) < 0)
|
NULL, NULL) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (qemuMonitorSupportsActiveCommit(qemuMonitorTestGetMonitor(test)))
|
if (qemuMonitorSupportsActiveCommit(qemuMonitorTestGetMonitor(test)))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -2367,7 +2326,6 @@ testQemuMonitorJSONqemuMonitorJSONGetDumpGuestMemoryCapability(const void *opaqu
|
|||||||
{
|
{
|
||||||
const testGenericData *data = opaque;
|
const testGenericData *data = opaque;
|
||||||
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
||||||
int ret = -1;
|
|
||||||
int cap;
|
int cap;
|
||||||
const char *reply =
|
const char *reply =
|
||||||
"{"
|
"{"
|
||||||
@ -2388,7 +2346,7 @@ testQemuMonitorJSONqemuMonitorJSONGetDumpGuestMemoryCapability(const void *opaqu
|
|||||||
|
|
||||||
if (qemuMonitorTestAddItem(test, "query-dump-guest-memory-capability",
|
if (qemuMonitorTestAddItem(test, "query-dump-guest-memory-capability",
|
||||||
reply) < 0)
|
reply) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
cap = qemuMonitorJSONGetDumpGuestMemoryCapability(
|
cap = qemuMonitorJSONGetDumpGuestMemoryCapability(
|
||||||
qemuMonitorTestGetMonitor(test), "elf");
|
qemuMonitorTestGetMonitor(test), "elf");
|
||||||
@ -2397,12 +2355,10 @@ testQemuMonitorJSONqemuMonitorJSONGetDumpGuestMemoryCapability(const void *opaqu
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"Unexpected capability: %d, expecting 1",
|
"Unexpected capability: %d, expecting 1",
|
||||||
cap);
|
cap);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct testCPUData {
|
struct testCPUData {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user