mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-23 14:33:10 +00:00
qemumonitorjsontest: Test qemuMonitorJSONGetTargetArch
This commit is contained in:
parent
a328f222fc
commit
02d57c7226
@ -1660,6 +1660,43 @@ cleanup:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
testQemuMonitorJSONqemuMonitorJSONGetTargetArch(const void *data)
|
||||||
|
{
|
||||||
|
virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
|
||||||
|
qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
|
||||||
|
int ret = -1;
|
||||||
|
char *arch;
|
||||||
|
|
||||||
|
if (!test)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (qemuMonitorTestAddItem(test, "query-target",
|
||||||
|
"{"
|
||||||
|
" \"return\": {"
|
||||||
|
" \"arch\": \"x86_64\""
|
||||||
|
" },"
|
||||||
|
" \"id\": \"libvirt-21\""
|
||||||
|
"}") < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (!(arch = qemuMonitorJSONGetTargetArch(qemuMonitorTestGetMonitor(test))))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (STRNEQ(arch, "x86_64")) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
"Unexpected architecture %s, expecting x86_64",
|
||||||
|
arch);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
cleanup:
|
||||||
|
VIR_FREE(arch);
|
||||||
|
qemuMonitorTestFree(test);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mymain(void)
|
mymain(void)
|
||||||
{
|
{
|
||||||
@ -1717,6 +1754,7 @@ mymain(void)
|
|||||||
DO_TEST(qemuMonitorJSONGetSpiceMigrationStatus);
|
DO_TEST(qemuMonitorJSONGetSpiceMigrationStatus);
|
||||||
DO_TEST(qemuMonitorJSONGetPtyPaths);
|
DO_TEST(qemuMonitorJSONGetPtyPaths);
|
||||||
DO_TEST(qemuMonitorJSONSetBlockIoThrottle);
|
DO_TEST(qemuMonitorJSONSetBlockIoThrottle);
|
||||||
|
DO_TEST(qemuMonitorJSONGetTargetArch);
|
||||||
|
|
||||||
virObjectUnref(xmlopt);
|
virObjectUnref(xmlopt);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user