qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 4/5] usb-hcd-ehci-test: change ehci qtest more e


From: Andreas Färber
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
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

Am 17.06.2014 10:04, schrieb address@hidden:
> From: Gonglei <address@hidden>
> 
> 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 <address@hidden>
> ---
>  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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]