{
const testGenericData *data = opaque;
virDomainXMLOptionPtr xmlopt = data->xmlopt;
- int ret = -1;
bool running = false;
virDomainPausedReason reason = 0;
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
" \"running\": true "
" } "
"}") < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorTestAddItem(test, "query-status",
"{ "
" \"return\": { "
" \"running\": false "
" } "
"}") < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorTestAddItem(test, "query-status",
"{ "
" \"return\": { "
" \"running\": false "
" } "
"}") < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorGetStatus(qemuMonitorTestGetMonitor(test),
&running, &reason) < 0)
- goto cleanup;
+ return -1;
if (!running) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"Running was not true");
- goto cleanup;
+ return -1;
}
if (reason != VIR_DOMAIN_PAUSED_UNKNOWN) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"Reason was unexpectedly set to %d", reason);
- goto cleanup;
+ return -1;
}
if (qemuMonitorGetStatus(qemuMonitorTestGetMonitor(test),
&running, &reason) < 0)
- goto cleanup;
+ return -1;
if (running) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"Running was not false");
- goto cleanup;
+ return -1;
}
if (reason != VIR_DOMAIN_PAUSED_UNKNOWN) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"Reason was unexpectedly set to %d", reason);
- goto cleanup;
+ return -1;
}
if (qemuMonitorGetStatus(qemuMonitorTestGetMonitor(test),
&running, &reason) < 0)
- goto cleanup;
+ return -1;
if (running) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"Running was not false");
- goto cleanup;
+ return -1;
}
if (reason != VIR_DOMAIN_PAUSED_MIGRATION) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"Reason was unexpectedly set to %d", reason);
- goto cleanup;
+ return -1;
}
- ret = 0;
-
- cleanup:
- return ret;
+ return 0;
}
static int
{
const testGenericData *data = opaque;
virDomainXMLOptionPtr xmlopt = data->xmlopt;
- int ret = -1;
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
- return ret;
+ return -1;
if (qemuMonitorTestAddItem(test, "chardev-remove", "{\"return\": {}}") < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorDetachCharDev(qemuMonitorTestGetMonitor(test),
"dummy_chrID") < 0)
- goto cleanup;
-
- ret = 0;
+ return -1;
- cleanup:
- return ret;
+ return 0;
}
/*
{
const testGenericData *data = opaque;
virDomainXMLOptionPtr xmlopt = data->xmlopt;
- int ret = -1;
qemuMonitorJSONObjectProperty prop;
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
if (qemuMonitorTestAddItem(test, "qom-get",
"{ \"return\": true }") < 0)
- goto cleanup;
+ return -1;
/* Present with path and property */
memset(&prop, 0, sizeof(qemuMonitorJSONObjectProperty));
"/machine/i440fx",
"realized",
&prop) < 0)
- goto cleanup;
+ return -1;
if (!prop.val.b) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"expected true, but false returned");
- goto cleanup;
+ return -1;
}
- ret = 0;
- cleanup:
- return ret;
+ return 0;
}
{
const testGenericData *data = opaque;
virDomainXMLOptionPtr xmlopt = data->xmlopt;
- int ret = -1;
qemuMonitorJSONObjectProperty prop;
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
if (qemuMonitorTestAddItem(test, "qom-set",
"{ \"return\": {} }") < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorTestAddItem(test, "qom-get",
"{ \"return\": true }") < 0)
- goto cleanup;
+ return -1;
/* Let's attempt the setting */
memset(&prop, 0, sizeof(qemuMonitorJSONObjectProperty));
"/machine/i440fx",
"realized",
&prop) < 0)
- goto cleanup;
+ return -1;
/* To make sure it worked, fetch the property - if this succeeds then
* we didn't hose things
"/machine/i440fx",
"realized",
&prop) < 0)
- goto cleanup;
+ return -1;
if (!prop.val.b) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"expected true, but false returned");
- goto cleanup;
+ return -1;
}
- ret = 0;
- cleanup:
- return ret;
+ return 0;
}
{
const testGenericData *data = opaque;
virDomainXMLOptionPtr xmlopt = data->xmlopt;
- int ret = -1;
bool running = false;
virDomainPausedReason reason = 0;
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
" \"status\": \"running\","
" \"singlestep\": false,"
" \"running\": true}}") < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorJSONStopCPUs(qemuMonitorTestGetMonitor(test)) < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorGetStatus(qemuMonitorTestGetMonitor(test),
&running, &reason) < 0)
- goto cleanup;
+ return -1;
if (running) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"Running was not false");
- goto cleanup;
+ return -1;
}
if (qemuMonitorJSONStartCPUs(qemuMonitorTestGetMonitor(test)) < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorGetStatus(qemuMonitorTestGetMonitor(test),
&running, &reason) < 0)
- goto cleanup;
+ return -1;
if (!running) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"Running was not true");
- goto cleanup;
+ return -1;
}
- ret = 0;
-
- cleanup:
- return ret;
+ return 0;
}
static int
{
const testGenericData *data = opaque;
virDomainXMLOptionPtr xmlopt = data->xmlopt;
- int ret = -1;
struct qemuMonitorQueryCpusEntry expect_slow[] = {
{0, 17622, (char *) "/machine/unattached/device[0]", true},
{1, 17624, (char *) "/machine/unattached/device[1]", true},
" ],"
" \"id\": \"libvirt-7\""
"}") < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorTestAddItem(test, "query-cpus-fast",
"{"
" ],"
" \"id\": \"libvirt-8\""
"}") < 0)
- goto cleanup;
+ return -1;
/* query-cpus */
if (testQEMUMonitorJSONqemuMonitorJSONQueryCPUsHelper(test, expect_slow,
false, 4))
- goto cleanup;
+ return -1;
/* query-cpus-fast */
if (testQEMUMonitorJSONqemuMonitorJSONQueryCPUsHelper(test, expect_fast,
true, 2))
- goto cleanup;
-
- ret = 0;
+ return -1;
- cleanup:
- return ret;
+ return 0;
}
static int
{
const testGenericData *data = opaque;
virDomainXMLOptionPtr xmlopt = data->xmlopt;
- int ret = -1;
unsigned long long currmem;
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
" },"
" \"id\": \"libvirt-9\""
"}") < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorJSONGetBalloonInfo(qemuMonitorTestGetMonitor(test), &currmem) < 0)
- goto cleanup;
+ return -1;
if (currmem != (18446744073709551615ULL/1024)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"Unexpected currmem value: %llu", currmem);
- goto cleanup;
+ return -1;
}
- ret = 0;
-
- cleanup:
- return ret;
+ return 0;
}
static int
{
const testGenericData *data = opaque;
virDomainXMLOptionPtr xmlopt = data->xmlopt;
- int ret = -1;
virDomainVirtType virtType;
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
" },"
" \"id\": \"libvirt-7\""
"}") < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorJSONGetVirtType(qemuMonitorTestGetMonitor(test), &virtType) < 0)
- goto cleanup;
+ return -1;
if (virtType != VIR_DOMAIN_VIRT_KVM) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"Unexpected virt type: %d, expecting %d", virtType, VIR_DOMAIN_VIRT_KVM);
- goto cleanup;
+ return -1;
}
if (qemuMonitorJSONGetVirtType(qemuMonitorTestGetMonitor(test), &virtType) < 0)
- goto cleanup;
+ return -1;
if (virtType != VIR_DOMAIN_VIRT_QEMU) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"Unexpected virt type: %d, expecting %d", virtType, VIR_DOMAIN_VIRT_QEMU);
+ return -1;
}
- ret = 0;
- cleanup:
- return ret;
+ return 0;
}
{
const testGenericData *data = opaque;
virDomainXMLOptionPtr xmlopt = data->xmlopt;
- int ret = -1;
unsigned long long cacheSize;
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
" \"return\": 67108864,"
" \"id\": \"libvirt-12\""
"}") < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorJSONGetMigrationCacheSize(qemuMonitorTestGetMonitor(test),
&cacheSize) < 0)
- goto cleanup;
+ return -1;
if (cacheSize != 67108864) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"Invalid cacheSize: %llu, expected 67108864",
cacheSize);
- goto cleanup;
+ return -1;
}
- ret = 0;
-
- cleanup:
- return ret;
+ return 0;
}
static int
{
const testGenericData *data = opaque;
virDomainXMLOptionPtr xmlopt = data->xmlopt;
- int ret = -1;
unsigned int keycodes[] = {43, 26, 46, 32};
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
if (qemuMonitorTestAddItem(test, "send-key",
"{\"return\": {}, \"id\": \"libvirt-16\"}") < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorJSONSendKey(qemuMonitorTestGetMonitor(test),
0, keycodes, ARRAY_CARDINALITY(keycodes)) < 0)
- goto cleanup;
+ return -1;
- ret = 0;
- cleanup:
- return ret;
+ return 0;
}
static int
{
const testGenericData *data = opaque;
virDomainXMLOptionPtr xmlopt = data->xmlopt;
- int ret = -1;
unsigned int keycodes[] = {43, 26, 46, 32};
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
"{\"type\":\"number\",\"data\":46},"
"{\"type\":\"number\",\"data\":32}]",
NULL, NULL) < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorJSONSendKey(qemuMonitorTestGetMonitor(test),
31337, keycodes,
ARRAY_CARDINALITY(keycodes)) < 0)
- goto cleanup;
+ return -1;
- ret = 0;
- cleanup:
- return ret;
+ return 0;
}
static int
{
const testGenericData *data = opaque;
virDomainXMLOptionPtr xmlopt = data->xmlopt;
- int ret = -1;
const char *error1 =
"{"
" \"error\": {"
if (qemuMonitorTestAddItemParams(test, "block-commit", error1,
"device", "\"bogus\"",
NULL, NULL) < 0)
- goto cleanup;
+ return -1;
if (!qemuMonitorSupportsActiveCommit(qemuMonitorTestGetMonitor(test)))
- goto cleanup;
+ return -1;
if (qemuMonitorTestAddItemParams(test, "block-commit", error2,
"device", "\"bogus\"",
NULL, NULL) < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorSupportsActiveCommit(qemuMonitorTestGetMonitor(test)))
- goto cleanup;
+ return -1;
- ret = 0;
- cleanup:
- return ret;
+ return 0;
}
static int
{
const testGenericData *data = opaque;
virDomainXMLOptionPtr xmlopt = data->xmlopt;
- int ret = -1;
int cap;
const char *reply =
"{"
if (qemuMonitorTestAddItem(test, "query-dump-guest-memory-capability",
reply) < 0)
- goto cleanup;
+ return -1;
cap = qemuMonitorJSONGetDumpGuestMemoryCapability(
qemuMonitorTestGetMonitor(test), "elf");
virReportError(VIR_ERR_INTERNAL_ERROR,
"Unexpected capability: %d, expecting 1",
cap);
- goto cleanup;
+ return -1;
}
- ret = 0;
- cleanup:
- return ret;
+ return 0;
}
struct testCPUData {