From: "Andreas Färber" <afaerber@suse.de>
To: arei.gonglei@huawei.com, qemu-devel@nongnu.org
Cc: luonengjun@huawei.com, akong@redhat.com,
weidong.huang@huawei.com, kraxel@redhat.com, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/5] tests: add OHCI qtest
Date: Thu, 19 Jun 2014 14:34:38 +0200 [thread overview]
Message-ID: <53A2D8DE.1080400@suse.de> (raw)
In-Reply-To: <1402992243-10224-2-git-send-email-arei.gonglei@huawei.com>
Am 17.06.2014 10:03, schrieb arei.gonglei@huawei.com:
> From: Gonglei <arei.gonglei@huawei.com>
>
> add ohci controller hotplug/unplug qtest
>
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
> MAINTAINERS | 2 +-
> tests/Makefile | 3 +++
> tests/usb-hcd-ohci-test.c | 41 +++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 45 insertions(+), 1 deletion(-)
> create mode 100644 tests/usb-hcd-ohci-test.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 51a6f51..2c81323 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -608,7 +608,7 @@ USB
> M: Gerd Hoffmann <kraxel@redhat.com>
> S: Maintained
> F: hw/usb/*
> -F: tests/usb-hcd-ehci-test.c
> +F: tests/usb-hcd*
usb-*-test.c?
>
> VFIO
> M: Alex Williamson <alex.williamson@redhat.com>
> diff --git a/tests/Makefile b/tests/Makefile
> index 361bb7b..b1fbfb6 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -151,6 +151,8 @@ check-qtest-i386-y += tests/i82801b11-test$(EXESUF)
> gcov-files-i386-y += hw/pci-bridge/i82801b11.c
> check-qtest-i386-y += tests/ioh3420-test$(EXESUF)
> gcov-files-i386-y += hw/pci-bridge/ioh3420.c
> +check-qtest-i386-y += tests/usb-hcd-ohci-test$(EXESUF)
> +gcov-files-i386-y += hw/usb/hcd-ohci.c
> check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF)
> gcov-files-i386-y += hw/usb/hcd-ehci.c
> gcov-files-i386-y += hw/usb/hcd-uhci.c
> @@ -321,6 +323,7 @@ tests/ac97-test$(EXESUF): tests/ac97-test.o
> tests/es1370-test$(EXESUF): tests/es1370-test.o
> tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o
> tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
> +tests/usb-hcd-ohci-test$(EXESUF): tests/usb-hcd-ohci-test.o
> tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-pc-obj-y)
> tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
> tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o libqemuutil.a libqemustub.a
> diff --git a/tests/usb-hcd-ohci-test.c b/tests/usb-hcd-ohci-test.c
> new file mode 100644
> index 0000000..bb54346
> --- /dev/null
> +++ b/tests/usb-hcd-ohci-test.c
> @@ -0,0 +1,41 @@
> +/*
> + * QTest testcase for USB OHCI controller
> + *
> + * Copyright (c) 2014 HUAWEI TECHNOLOGIES CO.,LTD.
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#include <glib.h>
> +#include <string.h>
> +#include "libqtest.h"
> +#include "qemu/osdep.h"
> +
> +
> +static void test_ohci_hotplug(void)
> +{
> + qtest_start("");
> +
> + /* hotplug an ohci controller */
> + qmp_exec_hmp_cmd("", "device_add pci-ohci,id=ohci");
> +
> + /* hot unplug an ohci controller */
> + qmp_exec_hmp_cmd("", "device_del ohci");
Please use QMP for device_add/del, it's safer with regards to response
parsing.
> +
> + qtest_end();
> +}
> +
> +
> +int main(int argc, char **argv)
> +{
> + int ret;
> +
> + g_test_init(&argc, &argv, NULL);
> +
> + qtest_add_func("/ohci/pci/ohci-hotplug", test_ohci_hotplug);
Might it make sense to also include a traditional "cold-plug" test? It
could be reused for ppc64 (sPAPR), where the q35 companion-controller
snippet probably doesn't apply.
> +
> + ret = g_test_run();
> +
> + return ret;
> +}
Regards,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2014-06-19 12:34 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-17 8:03 [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases arei.gonglei
2014-06-17 8:03 ` [Qemu-devel] [PATCH 1/5] tests: add OHCI qtest arei.gonglei
2014-06-19 12:34 ` Andreas Färber [this message]
2014-06-19 12:48 ` Gonglei (Arei)
2014-06-17 8:04 ` [Qemu-devel] [PATCH 2/5] tests: add UHCI qtest arei.gonglei
2014-06-19 12:40 ` Andreas Färber
2014-06-19 12:59 ` Gonglei (Arei)
2014-06-17 8:04 ` [Qemu-devel] [PATCH 3/5] tests: add xHCI qtest arei.gonglei
2014-06-19 12:37 ` Andreas Färber
2014-06-19 12:57 ` Gonglei (Arei)
2014-06-17 8:04 ` [Qemu-devel] [PATCH 4/5] usb-hcd-ehci-test: change ehci qtest more expansively arei.gonglei
2014-06-19 12:55 ` Andreas Färber
2014-06-17 8:04 ` [Qemu-devel] [PATCH 5/5] usb-hcd-ehci-test: add ehci hotplug/unplug qtest arei.gonglei
2014-06-19 10:05 ` [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases Gerd Hoffmann
2014-06-19 12:18 ` Gonglei (Arei)
2014-06-19 12:24 ` Andreas Färber
2014-06-19 12:47 ` Gerd Hoffmann
2014-06-19 13:07 ` Andreas Färber
2014-06-19 13:19 ` Gonglei (Arei)
2014-06-19 13:33 ` Andreas Färber
2014-06-19 13:46 ` Gerd Hoffmann
2014-06-20 1:51 ` Gonglei (Arei)
2014-06-20 1:48 ` Gonglei (Arei)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53A2D8DE.1080400@suse.de \
--to=afaerber@suse.de \
--cc=akong@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=kraxel@redhat.com \
--cc=luonengjun@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=weidong.huang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).