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 4/5] usb-hcd-ehci-test: change ehci qtest more expansively
Date: Thu, 19 Jun 2014 14:55:02 +0200 [thread overview]
Message-ID: <53A2DDA6.7090800@suse.de> (raw)
In-Reply-To: <1402992243-10224-5-git-send-email-arei.gonglei@huawei.com>
Am 17.06.2014 10:04, schrieb arei.gonglei@huawei.com:
> From: Gonglei <arei.gonglei@huawei.com>
>
> For simply add a new subtest in usb-hcd-ehci-test.c,
> remove qtest_start and qtest_end to an absolute method
> from main function.
>
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
> tests/usb-hcd-ehci-test.c | 38 +++++++++++++++++++++++++-------------
> 1 file changed, 25 insertions(+), 13 deletions(-)
>
> diff --git a/tests/usb-hcd-ehci-test.c b/tests/usb-hcd-ehci-test.c
> index bcdf62f..e1427f5 100644
> --- a/tests/usb-hcd-ehci-test.c
> +++ b/tests/usb-hcd-ehci-test.c
> @@ -154,32 +154,44 @@ static void pci_ehci_port_2(void)
> }
> }
>
> +static void pci_qtest_start(void)
> +{
> + qtest_start("-machine q35 -device ich9-usb-ehci1,bus=pcie.0,addr=1d.7,"
> + "multifunction=on,id=ich9-ehci-1 "
> + "-device ich9-usb-uhci1,bus=pcie.0,addr=1d.0,"
> + "multifunction=on,masterbus=ich9-ehci-1.0,firstport=0 "
> + "-device ich9-usb-uhci2,bus=pcie.0,addr=1d.1,"
> + "multifunction=on,masterbus=ich9-ehci-1.0,firstport=2 "
> + "-device ich9-usb-uhci3,bus=pcie.0,addr=1d.2,"
> + "multifunction=on,masterbus=ich9-ehci-1.0,firstport=4 "
> + "-drive if=none,id=usbcdrom,media=cdrom "
> + "-device usb-tablet,bus=ich9-ehci-1.0,port=1,usb_version=1 "
> + "-device usb-storage,bus=ich9-ehci-1.0,port=2,drive=usbcdrom ");
> +
> +}
> +
> +static void pci_qtest_stop(void)
> +{
> + qtest_end();
> +}
> +
> int main(int argc, char **argv)
> {
> int ret;
>
> g_test_init(&argc, &argv, NULL);
> +
> + /* NB: pci_qtest_start() must match with pci_qtest_stop() */
> + qtest_add_func("/ehci/pci/qtest_start", pci_qtest_start);
> qtest_add_func("/ehci/pci/init", pci_init);
> qtest_add_func("/ehci/pci/uhci-port-1", pci_uhci_port_1);
> qtest_add_func("/ehci/pci/ehci-port-1", pci_ehci_port_1);
> qtest_add_func("/ehci/pci/ehci-config", pci_ehci_config);
> qtest_add_func("/ehci/pci/uhci-port-2", pci_uhci_port_2);
> qtest_add_func("/ehci/pci/ehci-port-2", pci_ehci_port_2);
> + qtest_add_func("/ehci/pci/qtest_stop", pci_qtest_stop);
This is wrong, see
https://developer.gnome.org/glib/stable/glib-Testing.html#g-test-run
Look for g_test_add() and similar functions that allow to specify proper
setup and teardown functions with ordering guarantees.
Do note that when using g_test_* functions directly, the QEMU
architecture needs to be prepended to the path manually.
Regards,
Andreas
>
> - qtest_start("-machine q35 -device ich9-usb-ehci1,bus=pcie.0,addr=1d.7,"
> - "multifunction=on,id=ich9-ehci-1 "
> - "-device ich9-usb-uhci1,bus=pcie.0,addr=1d.0,"
> - "multifunction=on,masterbus=ich9-ehci-1.0,firstport=0 "
> - "-device ich9-usb-uhci2,bus=pcie.0,addr=1d.1,"
> - "multifunction=on,masterbus=ich9-ehci-1.0,firstport=2 "
> - "-device ich9-usb-uhci3,bus=pcie.0,addr=1d.2,"
> - "multifunction=on,masterbus=ich9-ehci-1.0,firstport=4 "
> - "-drive if=none,id=usbcdrom,media=cdrom "
> - "-device usb-tablet,bus=ich9-ehci-1.0,port=1,usb_version=1 "
> - "-device usb-storage,bus=ich9-ehci-1.0,port=2,drive=usbcdrom ");
> ret = g_test_run();
>
> - qtest_end();
> -
> return ret;
> }
>
--
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:55 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
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 [this message]
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=53A2DDA6.7090800@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.