diff mbox

[v2,26/30] tests: allows to run single test in usb-hcd-ehci-test

Message ID 20170221141451.28305-27-marcandre.lureau@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Marc-André Lureau Feb. 21, 2017, 2:14 p.m. UTC
pci_init() shouldn't be a test function, but instead called before any
test. This allows to run a single test with -p /x86_64/ehci/....

Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/usb-hcd-ehci-test.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Philippe Mathieu-Daudé Feb. 21, 2017, 4:45 p.m. UTC | #1
On 02/21/2017 11:14 AM, Marc-André Lureau wrote:
> pci_init() shouldn't be a test function, but instead called before any
> test. This allows to run a single test with -p /x86_64/ehci/....

good point.

>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  tests/usb-hcd-ehci-test.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/tests/usb-hcd-ehci-test.c b/tests/usb-hcd-ehci-test.c
> index 57af8a034e..fba84b4bee 100644
> --- a/tests/usb-hcd-ehci-test.c
> +++ b/tests/usb-hcd-ehci-test.c
> @@ -50,11 +50,8 @@ static void ehci_port_test(struct qhc *hc, int port, uint32_t expect)
>
>  /* tests */
>
> -static void pci_init(void)
> +static void test_init(void)
>  {
> -    if (pcibus) {
> -        return;
> -    }
>      pcibus = qpci_init_pc(NULL);
>      g_assert(pcibus != NULL);
>
> @@ -142,7 +139,7 @@ int main(int argc, char **argv)
>      int ret;
>
>      g_test_init(&argc, &argv, NULL);
> -    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);
> @@ -161,6 +158,8 @@ int main(int argc, char **argv)
>                  "-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 ");
> +
> +    test_init();
>      ret = g_test_run();
>
>      qtest_end();
>
Gerd Hoffmann Feb. 21, 2017, 11:01 p.m. UTC | #2
On Di, 2017-02-21 at 18:14 +0400, Marc-André Lureau wrote:
> pci_init() shouldn't be a test function, but instead called before any
> test. This allows to run a single test with -p /x86_64/ehci/....

Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>

/me assumes you'll go send a pull request for the whole series?
Or do you want me cherry-pick the usb patches into the usb queue?

cheers,
  Gerd
Marc-André Lureau Feb. 22, 2017, 8:36 a.m. UTC | #3
Hi

On Wed, Feb 22, 2017 at 3:05 AM Gerd Hoffmann <kraxel@redhat.com> wrote:

> On Di, 2017-02-21 at 18:14 +0400, Marc-André Lureau wrote:
> > pci_init() shouldn't be a test function, but instead called before any
> > test. This allows to run a single test with -p /x86_64/ehci/....
>
> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
>
> /me assumes you'll go send a pull request for the whole series?
> Or do you want me cherry-pick the usb patches into the usb queue?
>

Since the whole series is pending for reviews, feel free to pick the usb
patches, I'll rebase regularly.

thanks
diff mbox

Patch

diff --git a/tests/usb-hcd-ehci-test.c b/tests/usb-hcd-ehci-test.c
index 57af8a034e..fba84b4bee 100644
--- a/tests/usb-hcd-ehci-test.c
+++ b/tests/usb-hcd-ehci-test.c
@@ -50,11 +50,8 @@  static void ehci_port_test(struct qhc *hc, int port, uint32_t expect)
 
 /* tests */
 
-static void pci_init(void)
+static void test_init(void)
 {
-    if (pcibus) {
-        return;
-    }
     pcibus = qpci_init_pc(NULL);
     g_assert(pcibus != NULL);
 
@@ -142,7 +139,7 @@  int main(int argc, char **argv)
     int ret;
 
     g_test_init(&argc, &argv, NULL);
-    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);
@@ -161,6 +158,8 @@  int main(int argc, char **argv)
                 "-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 ");
+
+    test_init();
     ret = g_test_run();
 
     qtest_end();