qemumonitorjsontest: Test qemuMonitorJSONGetSpiceMigrationStatus

This commit is contained in:
Michal Privoznik 2013-10-02 16:52:36 +02:00
parent e0decbf05a
commit 3491d7b539

View File

@ -1511,6 +1511,45 @@ cleanup:
return ret;
}
static int
testQemuMonitorJSONqemuMonitorJSONGetSpiceMigrationStatus(const void *data)
{
virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
int ret = -1;
bool spiceMigrated;
if (!test)
return -1;
if (qemuMonitorTestAddItem(test, "query-spice",
"{"
" \"return\": {"
" \"migrated\": true,"
" \"enabled\": false,"
" \"mouse-mode\": \"client\""
" },"
" \"id\": \"libvirt-14\""
"}") < 0)
goto cleanup;
if (qemuMonitorJSONGetSpiceMigrationStatus(qemuMonitorTestGetMonitor(test),
&spiceMigrated) < 0)
goto cleanup;
if (!spiceMigrated) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"Invalid spice migration status: %d, expecting 1",
spiceMigrated);
goto cleanup;
}
ret = 0;
cleanup:
qemuMonitorTestFree(test);
return ret;
}
static int
mymain(void)
{
@ -1565,6 +1604,7 @@ mymain(void)
DO_TEST(qemuMonitorJSONGetBlockStatsInfo);
DO_TEST(qemuMonitorJSONGetMigrationCacheSize);
DO_TEST(qemuMonitorJSONGetMigrationStatus);
DO_TEST(qemuMonitorJSONGetSpiceMigrationStatus);
virObjectUnref(xmlopt);