Message ID | 1401593596-8953-3-git-send-email-somlo@cmu.edu |
---|---|
State | New |
Headers | show |
On Sun, Jun 1, 2014 at 1:33 PM, Gabriel L. Somlo <gsomlo@gmail.com> wrote: > Update e1000-test.c to check all currently supported devices. > > Suggested-by: Andreas Färber <afaerber@suse.de> > Signed-off-by: Gabriel Somlo <somlo@cmu.edu> > Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> > --- > tests/e1000-test.c | 34 +++++++++++++++++++++++++++------- > 1 file changed, 27 insertions(+), 7 deletions(-) > > diff --git a/tests/e1000-test.c b/tests/e1000-test.c > index a8ba2fc..53c41f8 100644 > --- a/tests/e1000-test.c > +++ b/tests/e1000-test.c > @@ -13,21 +13,41 @@ > #include "qemu/osdep.h" > > /* Tests only initialization so far. TODO: Replace with functional tests */ > -static void nop(void) > +static void test_device(gconstpointer data) > { > + const char *model = data; > + QTestState *s; > + char *args; > + > + args = g_strdup_printf("-device %s", model); > + s = qtest_start(args); > + > + if (s) { > + qtest_quit(s); > + } > + g_free(args); > } > > +static const char *models[] = { > + "e1000", > + "e1000-82540em", > + "e1000-82544gc", > + "e1000-82545em", > + "e1000-82573l", > +}; > + > int main(int argc, char **argv) > { > - int ret; > + int i; > > g_test_init(&argc, &argv, NULL); > - qtest_add_func("/e1000/nop", nop); > > - qtest_start("-device e1000"); > - ret = g_test_run(); > + for (i = 0; i < ARRAY_SIZE(models); i++) { > + char *path; > > - qtest_end(); > + path = g_strdup_printf("/%s/e1000/%s", qtest_get_arch(), models[i]); > + g_test_add_data_func(path, models[i], test_device); > + } > > - return ret; > + return g_test_run(); > } > -- > 1.9.3 > >
On Sat, May 31, 2014 at 11:33:15PM -0400, Gabriel L. Somlo wrote: > Update e1000-test.c to check all currently supported devices. > > Suggested-by: Andreas Färber <afaerber@suse.de> > Signed-off-by: Gabriel Somlo <somlo@cmu.edu> > Reviewed-by: Michael S. Tsirkin <mst@redhat.com> > --- > tests/e1000-test.c | 34 +++++++++++++++++++++++++++------- > 1 file changed, 27 insertions(+), 7 deletions(-) Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
diff --git a/tests/e1000-test.c b/tests/e1000-test.c index a8ba2fc..53c41f8 100644 --- a/tests/e1000-test.c +++ b/tests/e1000-test.c @@ -13,21 +13,41 @@ #include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ -static void nop(void) +static void test_device(gconstpointer data) { + const char *model = data; + QTestState *s; + char *args; + + args = g_strdup_printf("-device %s", model); + s = qtest_start(args); + + if (s) { + qtest_quit(s); + } + g_free(args); } +static const char *models[] = { + "e1000", + "e1000-82540em", + "e1000-82544gc", + "e1000-82545em", + "e1000-82573l", +}; + int main(int argc, char **argv) { - int ret; + int i; g_test_init(&argc, &argv, NULL); - qtest_add_func("/e1000/nop", nop); - qtest_start("-device e1000"); - ret = g_test_run(); + for (i = 0; i < ARRAY_SIZE(models); i++) { + char *path; - qtest_end(); + path = g_strdup_printf("/%s/e1000/%s", qtest_get_arch(), models[i]); + g_test_add_data_func(path, models[i], test_device); + } - return ret; + return g_test_run(); }