All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] tests: minor cleanups in usb-hcd-uhci-test
@ 2016-10-06 14:50 Laurent Vivier
  2016-10-06 23:49 ` David Gibson
  0 siblings, 1 reply; 4+ messages in thread
From: Laurent Vivier @ 2016-10-06 14:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, David Gibson, Thomas Huth, Laurent Vivier

Two minor cleanups:
- exit gracefully in case on unsupported target,
- put machine command line in a constant to avoid
  to duplicate it.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 tests/usb-hcd-uhci-test.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/tests/usb-hcd-uhci-test.c b/tests/usb-hcd-uhci-test.c
index 4b951ce..e956b9c 100644
--- a/tests/usb-hcd-uhci-test.c
+++ b/tests/usb-hcd-uhci-test.c
@@ -77,6 +77,9 @@ static void test_usb_storage_hotplug(void)
 int main(int argc, char **argv)
 {
     const char *arch = qtest_get_arch();
+    const char *cmd = "-device piix3-usb-uhci,id=uhci,addr=1d.0"
+                      " -drive id=drive0,if=none,file=/dev/null,format=raw"
+                      " -device usb-tablet,bus=uhci.0,port=1";
     int ret;
 
     g_test_init(&argc, &argv, NULL);
@@ -87,13 +90,13 @@ int main(int argc, char **argv)
     qtest_add_func("/uhci/pci/hotplug/usb-storage", test_usb_storage_hotplug);
 
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
-        qs = qtest_pc_boot("-device piix3-usb-uhci,id=uhci,addr=1d.0"
-                           " -drive id=drive0,if=none,file=/dev/null,format=raw"
-                           " -device usb-tablet,bus=uhci.0,port=1");
+        qs = qtest_pc_boot(cmd);
     } else if (strcmp(arch, "ppc64") == 0) {
-        qs = qtest_spapr_boot("-device piix3-usb-uhci,id=uhci,addr=1d.0"
-                           " -drive id=drive0,if=none,file=/dev/null,format=raw"
-                           " -device usb-tablet,bus=uhci.0,port=1");
+        qs = qtest_spapr_boot(cmd);
+    } else {
+        g_printerr("usb-hcd-uhci-test tests are only "
+                   "available on x86 or ppc64\n");
+        exit(EXIT_FAILURE);
     }
     ret = g_test_run();
     qtest_shutdown(qs);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] tests: minor cleanups in usb-hcd-uhci-test
  2016-10-06 14:50 [Qemu-devel] [PATCH] tests: minor cleanups in usb-hcd-uhci-test Laurent Vivier
@ 2016-10-06 23:49 ` David Gibson
  2016-10-07  8:40   ` Gerd Hoffmann
  0 siblings, 1 reply; 4+ messages in thread
From: David Gibson @ 2016-10-06 23:49 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: qemu-devel, Gerd Hoffmann, Thomas Huth

[-- Attachment #1: Type: text/plain, Size: 2346 bytes --]

On Thu, Oct 06, 2016 at 04:50:48PM +0200, Laurent Vivier wrote:
> Two minor cleanups:
> - exit gracefully in case on unsupported target,
> - put machine command line in a constant to avoid
>   to duplicate it.
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

I'm not sure if I should take this through my tree or not.

> ---
>  tests/usb-hcd-uhci-test.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/usb-hcd-uhci-test.c b/tests/usb-hcd-uhci-test.c
> index 4b951ce..e956b9c 100644
> --- a/tests/usb-hcd-uhci-test.c
> +++ b/tests/usb-hcd-uhci-test.c
> @@ -77,6 +77,9 @@ static void test_usb_storage_hotplug(void)
>  int main(int argc, char **argv)
>  {
>      const char *arch = qtest_get_arch();
> +    const char *cmd = "-device piix3-usb-uhci,id=uhci,addr=1d.0"
> +                      " -drive id=drive0,if=none,file=/dev/null,format=raw"
> +                      " -device usb-tablet,bus=uhci.0,port=1";
>      int ret;
>  
>      g_test_init(&argc, &argv, NULL);
> @@ -87,13 +90,13 @@ int main(int argc, char **argv)
>      qtest_add_func("/uhci/pci/hotplug/usb-storage", test_usb_storage_hotplug);
>  
>      if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
> -        qs = qtest_pc_boot("-device piix3-usb-uhci,id=uhci,addr=1d.0"
> -                           " -drive id=drive0,if=none,file=/dev/null,format=raw"
> -                           " -device usb-tablet,bus=uhci.0,port=1");
> +        qs = qtest_pc_boot(cmd);
>      } else if (strcmp(arch, "ppc64") == 0) {
> -        qs = qtest_spapr_boot("-device piix3-usb-uhci,id=uhci,addr=1d.0"
> -                           " -drive id=drive0,if=none,file=/dev/null,format=raw"
> -                           " -device usb-tablet,bus=uhci.0,port=1");
> +        qs = qtest_spapr_boot(cmd);
> +    } else {
> +        g_printerr("usb-hcd-uhci-test tests are only "
> +                   "available on x86 or ppc64\n");
> +        exit(EXIT_FAILURE);
>      }
>      ret = g_test_run();
>      qtest_shutdown(qs);

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] tests: minor cleanups in usb-hcd-uhci-test
  2016-10-06 23:49 ` David Gibson
@ 2016-10-07  8:40   ` Gerd Hoffmann
  2016-10-08  8:27     ` David Gibson
  0 siblings, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2016-10-07  8:40 UTC (permalink / raw)
  To: David Gibson; +Cc: Laurent Vivier, qemu-devel, Thomas Huth

On Fr, 2016-10-07 at 10:49 +1100, David Gibson wrote:
> On Thu, Oct 06, 2016 at 04:50:48PM +0200, Laurent Vivier wrote:
> > Two minor cleanups:
> > - exit gracefully in case on unsupported target,
> > - put machine command line in a constant to avoid
> >   to duplicate it.
> > 
> > Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> 
> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> 
> I'm not sure if I should take this through my tree or not.

Feel free to do so, makes sense to merge this together with the ppc usb
test patches.  Avoids conflicts.

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

But I can take it through the usb tree too, I have some pending stuff
and will probably prepare a pull request early next week.

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] tests: minor cleanups in usb-hcd-uhci-test
  2016-10-07  8:40   ` Gerd Hoffmann
@ 2016-10-08  8:27     ` David Gibson
  0 siblings, 0 replies; 4+ messages in thread
From: David Gibson @ 2016-10-08  8:27 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: Laurent Vivier, qemu-devel, Thomas Huth

[-- Attachment #1: Type: text/plain, Size: 1109 bytes --]

On Fri, Oct 07, 2016 at 10:40:45AM +0200, Gerd Hoffmann wrote:
> On Fr, 2016-10-07 at 10:49 +1100, David Gibson wrote:
> > On Thu, Oct 06, 2016 at 04:50:48PM +0200, Laurent Vivier wrote:
> > > Two minor cleanups:
> > > - exit gracefully in case on unsupported target,
> > > - put machine command line in a constant to avoid
> > >   to duplicate it.
> > > 
> > > Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> > 
> > Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> > 
> > I'm not sure if I should take this through my tree or not.
> 
> Feel free to do so, makes sense to merge this together with the ppc usb
> test patches.  Avoids conflicts.
> 
> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>

Ok, will do.

> 
> But I can take it through the usb tree too, I have some pending stuff
> and will probably prepare a pull request early next week.
> 
> cheers,
>   Gerd
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-08  9:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-06 14:50 [Qemu-devel] [PATCH] tests: minor cleanups in usb-hcd-uhci-test Laurent Vivier
2016-10-06 23:49 ` David Gibson
2016-10-07  8:40   ` Gerd Hoffmann
2016-10-08  8:27     ` David Gibson

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.