From 3491d7b5399691d21c573d8b0611c4820b10e6f2 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Wed, 2 Oct 2013 16:52:36 +0200 Subject: [PATCH] qemumonitorjsontest: Test qemuMonitorJSONGetSpiceMigrationStatus --- tests/qemumonitorjsontest.c | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 3267f5ed0e..d93cc5246b 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -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); -- GitLab