From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWlm9-0001mN-DT for qemu-devel@nongnu.org; Wed, 24 Sep 2014 08:34:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XWlm3-0001mD-97 for qemu-devel@nongnu.org; Wed, 24 Sep 2014 08:34:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40271) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWlm3-0001kA-1J for qemu-devel@nongnu.org; Wed, 24 Sep 2014 08:34:23 -0400 Message-ID: <5422BA03.9040200@redhat.com> Date: Wed, 24 Sep 2014 14:33:07 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1411559299-19042-1-git-send-email-imammedo@redhat.com> <1411559299-19042-3-git-send-email-imammedo@redhat.com> In-Reply-To: <1411559299-19042-3-git-send-email-imammedo@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 02/30] test: virtio-serial: check if hot-plug/unplug works List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov , qemu-devel@nongnu.org Cc: dmitry@daynix.com, borntraeger@de.ibm.com, mst@redhat.com, agraf@suse.de, cornelia.huck@de.ibm.com, kraxel@redhat.com, amit.shah@redhat.com, rth@twiddle.net Il 24/09/2014 13:47, Igor Mammedov ha scritto: > Signed-off-by: Igor Mammedov > --- > tests/virtio-serial-test.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/tests/virtio-serial-test.c b/tests/virtio-serial-test.c > index e743875..bf030a6 100644 > --- a/tests/virtio-serial-test.c > +++ b/tests/virtio-serial-test.c > @@ -17,12 +17,39 @@ static void pci_nop(void) > { > } > > +static void hotplug(void) > +{ > + QDict *response; > + > + response = qmp("{\"execute\": \"device_add\"," > + " \"arguments\": {" > + " \"driver\": \"virtserialport\"," > + " \"id\": \"hp-port\"" > + "}}"); > + > + g_assert(response); > + g_assert(!qdict_haskey(response, "error")); > + QDECREF(response); > + > + response = qmp("{\"execute\": \"device_del\"," > + " \"arguments\": {" > + " \"id\": \"hp-port\"" > + "}}"); > + > + g_assert(response); > + g_assert(!qdict_haskey(response, "error")); > + g_assert(qdict_haskey(response, "event")); > + g_assert(!strcmp(qdict_get_str(response, "event"), "DEVICE_DELETED")); > + QDECREF(response); > +} > + > int main(int argc, char **argv) > { > int ret; > > g_test_init(&argc, &argv, NULL); > qtest_add_func("/virtio/serial/pci/nop", pci_nop); > + qtest_add_func("/virtio/serial/pci/hotplug", hotplug); > > qtest_start("-device virtio-serial-pci"); > ret = g_test_run(); > Reviewed-by: Paolo Bonzini