#include "virjson.h"
#include "virbuffer.h"
#include "virxml.h"
+#include "virhash.h"
#include "testutils.h"
#include "testutilsqemu.h"
+#include "tests/testutilsqemuschema.h"
#include "qemumonitortestutils.h"
#include "qemu/qemu_migration_params.h"
#define LIBVIRT_QEMU_MIGRATION_PARAMSPRIV_H_ALLOW
struct _qemuMigParamsData {
virDomainXMLOptionPtr xmlopt;
const char *name;
+ virHashTablePtr qmpschema;
};
g_autoptr(virJSONValue) paramsOut = NULL;
g_autoptr(qemuMigrationParams) migParams = NULL;
g_autofree char *actualJSON = NULL;
+ g_auto(virBuffer) debug = VIR_BUFFER_INITIALIZER;
int ret = -1;
replyFile = g_strdup_printf("%s/qemumigparamsdata/%s.reply",
!(actualJSON = virJSONValueToString(paramsOut, true)))
goto cleanup;
+ if (testQEMUSchemaValidateCommand("migrate-set-parameters",
+ paramsOut,
+ data->qmpschema,
+ false,
+ false,
+ &debug) < 0) {
+ VIR_TEST_VERBOSE("failed to validate migration params '%s' against QMP schema: %s",
+ actualJSON, virBufferCurrentContent(&debug));
+ goto cleanup;
+ }
+
if (virTestCompareToFile(actualJSON, jsonFile) < 0)
goto cleanup;
static int
mymain(void)
{
+ g_autoptr(virHashTable) qmpschema = NULL;
virQEMUDriver driver;
int ret = 0;
virEventRegisterDefaultImpl();
+ if (!(qmpschema = testQEMUSchemaLoadLatest("x86_64"))) {
+ VIR_TEST_VERBOSE("failed to load QMP schema");
+ return EXIT_FAILURE;
+ }
+
#define DO_TEST(name) \
do { \
qemuMigParamsData data = { \
- driver.xmlopt, name \
+ driver.xmlopt, name, qmpschema \
}; \
if (virTestRun(name " (xml)", qemuMigParamsTestXML, &data) < 0) \
ret = -1; \