From patchwork Fri Jul 25 15:39:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sanidhya Kashyap X-Patchwork-Id: 373737 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E7C601400E6 for ; Sat, 26 Jul 2014 01:44:10 +1000 (EST) Received: from localhost ([::1]:55487 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAhfF-0005Uc-1K for incoming@patchwork.ozlabs.org; Fri, 25 Jul 2014 11:44:09 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=H/Vuf0Acr9xMy+/LlJwcY9ConBYoeB5HC3i+YQq9Qxs=; b=AtVbMZ7TrKJCula41JR3kUxYr6BREbHYDe1wvk+Qcciiy6VaDVruuWOOMAwf7nx5B6 bvG2MeF22ba0amfXySycbtGJMrqcV0sR9P3hfikMNWU6fTu18FeJlDnVhXYG+cyT6TKy gyDApOnUfsiE89kJKQ55WZfV/bYxCQHN+TIe4auusNEbdfl0a8KPsHH3DH9vwjAx9HsL tWes5Jl0FndkFKhcId/jAN9J/mphxQtSYdzw0BR1a14zytDgTHaQ/8f/b2k+GED7S9S9 /V936sZdwSnGQjP5dEyyDnxGcc6yZMg0B/DLj3HCQXdW9TIZjzYE/fj5aiRrv4VOTmPh 4dUA== X-Received: by 10.66.230.163 with SMTP id sz3mr4709264pac.136.1406302849356; Fri, 25 Jul 2014 08:40:49 -0700 (PDT) Received: from localhost.localdomain ([106.219.148.212]) by mx.google.com with ESMTPSA id am3sm3693331pbd.18.2014.07.25.08.40.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Jul 2014 08:40:48 -0700 (PDT) From: Sanidhya Kashyap To: qemu list Date: Fri, 25 Jul 2014 21:09:30 +0530 Message-Id: <1406302776-2306-7-git-send-email-sanidhya.iiith@gmail.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1406302776-2306-1-git-send-email-sanidhya.iiith@gmail.com> References: <1406302776-2306-1-git-send-email-sanidhya.iiith@gmail.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::22e Cc: Sanidhya Kashyap , "Dr. David Alan Gilbert" , Juan Quintela Subject: [Qemu-devel] [PATCH RFC v2 06/12] VMState test: hmp interface for vmstate testing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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);