Received: from eggs.gnu.org ([2001:4830:134:3::10]:36804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeExu-0005xk-QI for qemu-devel@nongnu.org; Tue, 14 Oct 2014 23:09:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XeExo-0004gD-Ia for qemu-devel@nongnu.org; Tue, 14 Oct 2014 23:09:30 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49299 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeExo-0004fH-Bn for qemu-devel@nongnu.org; Tue, 14 Oct 2014 23:09:24 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Wed, 15 Oct 2014 05:08:41 +0200 Message-Id: <1413342561-4754-8-git-send-email-afaerber@suse.de> In-Reply-To: <1413342561-4754-1-git-send-email-afaerber@suse.de> References: <1413342561-4754-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 07/47] tests: virtio-serial: Check if hot-plug/unplug works List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= From: Igor Mammedov Signed-off-by: Igor Mammedov Reviewed-by: Paolo Bonzini Reviewed-by: Michael S. Tsirkin Signed-off-by: Andreas F=C3=A4rber --- 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) { } =20 +static void hotplug(void) +{ + QDict *response; + + response =3D qmp("{\"execute\": \"device_add\"," + " \"arguments\": {" + " \"driver\": \"virtserialport\"," + " \"id\": \"hp-port\"" + "}}"); + + g_assert(response); + g_assert(!qdict_haskey(response, "error")); + QDECREF(response); + + response =3D 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; =20 g_test_init(&argc, &argv, NULL); qtest_add_func("/virtio/serial/pci/nop", pci_nop); + qtest_add_func("/virtio/serial/pci/hotplug", hotplug); =20 qtest_start("-device virtio-serial-pci"); ret =3D g_test_run(); --=20 1.8.4.5