tests: minor cleanups in usb-hcd-uhci-test
PATCH 1/1 tests: minor cleanups in usb-hcd-uhci-test
Two minor cleanups:
- exit gracefully in case on unsupported target,
- put machine command line in a constant to avoid
to duplicate it.
--- tests/usb-hcd-uhci-test.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
tests/usb-hcd-uhci-test.c +9 -6
@@ -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);
Signature · 1 line
2.7.4
Quoted 6 lines · 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 <[email protected]>
I'm not sure if I should take this through my tree or not.
Quoted 38 lines
--- tests/usb-hcd-uhci-test.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)tests/usb-hcd-uhci-test.c +9
-6@@ -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);
Signature · 4 lines
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
Gerd Hoffmann
Reviewed-byQuoted 11 lines · David Gibson
Quoted 6 lines · 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 <[email protected]>Reviewed-by David Gibson <[email protected]>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.
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
Quoted 9 lines · Gerd Hoffmann
Quoted 8 lines · David Gibson
Quoted 6 lines · 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 <[email protected]>
Quoted 8 lines
Quoted 3 lines
Reviewed-by David Gibson <[email protected]>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 <[email protected]>
Ok, will do.
Quoted 7 lines
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
Signature · 4 lines
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