@@ -1790,6 +1790,21 @@ STEXI
show available trace events and their state
ETEXI
+ {
+ .name = "test-vmstates",
+ .args_type = "iterations:i?,period:i?",
+ .params = "total_iterations sleep_interval",
+ .help = "test the vmstates by dumping and loading form memory\n\t\t\t"
+ "iterations: (optional) number of times, the vmstates will be tested\n\t\t\t"
+ "period: (optional) sleep interval in milliseconds between each iteration",
+ .mhandler.cmd = hmp_test_vmstates,
+ },
+STEXI
+@item test-vmstates
+@findex test-vmstates
+dumps and reads the device state's data from the memory for testing purpose
+ETEXI
+
STEXI
@end table
ETEXI
@@ -1735,3 +1735,21 @@ void hmp_info_qdev_devices(Monitor *mon, const QDict *qdict)
qapi_free_strList(list);
}
+
+void hmp_test_vmstates(Monitor *mon, const QDict *qdict)
+{
+ int has_iterations = qdict_haskey(qdict, "iterations");
+ int64_t iterations = qdict_get_try_int(qdict, "iterations", 10);
+ int has_period = qdict_haskey(qdict, "period");
+ int64_t period = qdict_get_try_int(qdict, "period", 100);
+
+ Error *err = NULL;
+
+ qmp_test_vmstates(has_iterations, iterations, has_period, period,
+ true, false, NULL, &err);
+
+ if (err) {
+ monitor_printf(mon, "test-vmstates: %s\n", error_get_pretty(err));
+ error_free(err);
+ }
+}
@@ -95,6 +95,7 @@ void hmp_cpu_add(Monitor *mon, const QDict *qdict);
void hmp_object_add(Monitor *mon, const QDict *qdict);
void hmp_object_del(Monitor *mon, const QDict *qdict);
void hmp_info_memdev(Monitor *mon, const QDict *qdict);
+void hmp_test_vmstates(Monitor *mon, const QDict *qdict);
void object_add_completion(ReadLineState *rs, int nb_args, const char *str);
void object_del_completion(ReadLineState *rs, int nb_args, const char *str);
void device_add_completion(ReadLineState *rs, int nb_args, const char *str);
I have added the hmp interface for vmstate testing. Currently, the patch does not support the qdev list, since I could not figure out how to the pass the VMStatesQdevDevices struct which can be parsed and used. Signed-off-by: Sanidhya Kashyap <sanidhya.iiith@gmail.com> --- hmp-commands.hx | 15 +++++++++++++++ hmp.c | 18 ++++++++++++++++++ hmp.h | 1 + 3 files changed, 34 insertions(+)