mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
tests: qemumonitor: Add testing for the 'transaction' command and generators
Validate all the commands against the schema. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
5cf0a3752f
commit
bacbd0f2ee
@ -3004,6 +3004,44 @@ testQueryJobs(const void *opaque)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
testQemuMonitorJSONTransaction(const void *opaque)
|
||||||
|
{
|
||||||
|
const testGenericData *data = opaque;
|
||||||
|
VIR_AUTOPTR(qemuMonitorTest) test = NULL;
|
||||||
|
VIR_AUTOPTR(virJSONValue) actions = NULL;
|
||||||
|
VIR_AUTOPTR(virJSONValue) mergebitmaps = NULL;
|
||||||
|
|
||||||
|
if (!(test = qemuMonitorTestNewSchema(data->xmlopt, data->schema)))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (!(actions = virJSONValueNewArray()) ||
|
||||||
|
!(mergebitmaps = virJSONValueNewArray()))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (virJSONValueArrayAppendString(mergebitmaps, "mergemap1") < 0 ||
|
||||||
|
virJSONValueArrayAppendString(mergebitmaps, "mergemap2") < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (qemuMonitorTransactionBitmapAdd(actions, "node1", "bitmap1", true, true) < 0 ||
|
||||||
|
qemuMonitorTransactionBitmapRemove(actions, "node2", "bitmap2") < 0 ||
|
||||||
|
qemuMonitorTransactionBitmapEnable(actions, "node3", "bitmap3") < 0 ||
|
||||||
|
qemuMonitorTransactionBitmapDisable(actions, "node4", "bitmap4") < 0 ||
|
||||||
|
qemuMonitorTransactionBitmapMerge(actions, "node5", "bitmap5", &mergebitmaps) < 0 ||
|
||||||
|
qemuMonitorTransactionSnapshotLegacy(actions, "dev6", "path", "qcow2", true) < 0 ||
|
||||||
|
qemuMonitorTransactionSnapshotBlockdev(actions, "node7", "overlay7") < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (qemuMonitorTestAddItem(test, "transaction", "{\"return\":{}}") < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (qemuMonitorJSONTransaction(qemuMonitorTestGetMonitor(test), &actions) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mymain(void)
|
mymain(void)
|
||||||
{
|
{
|
||||||
@ -3095,6 +3133,7 @@ mymain(void)
|
|||||||
DO_TEST(CPU);
|
DO_TEST(CPU);
|
||||||
DO_TEST(GetNonExistingCPUData);
|
DO_TEST(GetNonExistingCPUData);
|
||||||
DO_TEST(GetIOThreads);
|
DO_TEST(GetIOThreads);
|
||||||
|
DO_TEST(Transaction);
|
||||||
DO_TEST_SIMPLE("qmp_capabilities", qemuMonitorJSONSetCapabilities);
|
DO_TEST_SIMPLE("qmp_capabilities", qemuMonitorJSONSetCapabilities);
|
||||||
DO_TEST_SIMPLE("system_powerdown", qemuMonitorJSONSystemPowerdown);
|
DO_TEST_SIMPLE("system_powerdown", qemuMonitorJSONSystemPowerdown);
|
||||||
DO_TEST_SIMPLE("system_reset", qemuMonitorJSONSystemReset);
|
DO_TEST_SIMPLE("system_reset", qemuMonitorJSONSystemReset);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user