From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAhcD-0000cG-FM for qemu-devel@nongnu.org; Fri, 25 Jul 2014 11:41:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XAhc2-0001Rp-O1 for qemu-devel@nongnu.org; Fri, 25 Jul 2014 11:41:01 -0400 Received: from mail-pa0-x22e.google.com ([2607:f8b0:400e:c03::22e]:45682) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAhc2-0001RS-DE for qemu-devel@nongnu.org; Fri, 25 Jul 2014 11:40:50 -0400 Received: by mail-pa0-f46.google.com with SMTP id lj1so6158975pab.5 for ; Fri, 25 Jul 2014 08:40:49 -0700 (PDT) From: Sanidhya Kashyap Date: Fri, 25 Jul 2014 21:09:30 +0530 Message-Id: <1406302776-2306-7-git-send-email-sanidhya.iiith@gmail.com> In-Reply-To: <1406302776-2306-1-git-send-email-sanidhya.iiith@gmail.com> References: <1406302776-2306-1-git-send-email-sanidhya.iiith@gmail.com> Subject: [Qemu-devel] [PATCH RFC v2 06/12] VMState test: hmp interface for vmstate testing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu list Cc: Sanidhya Kashyap , "Dr. David Alan Gilbert" , Juan Quintela 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 --- hmp-commands.hx | 15 +++++++++++++++ hmp.c | 18 ++++++++++++++++++ hmp.h | 1 + 3 files changed, 34 insertions(+) diff --git a/hmp-commands.hx b/hmp-commands.hx index 4603de5..6af72a6 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -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 diff --git a/hmp.c b/hmp.c index d1dd7d2..6c998d2 100644 --- a/hmp.c +++ b/hmp.c @@ -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); + } +} diff --git a/hmp.h b/hmp.h index d179454..41bc781 100644 --- a/hmp.h +++ b/hmp.h @@ -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); -- 1.9.3