From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60790) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtzrG-0002t2-MO for qemu-devel@nongnu.org; Mon, 09 Jun 2014 09:43:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WtzrA-0002y6-HE for qemu-devel@nongnu.org; Mon, 09 Jun 2014 09:43:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31644) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtzrA-0002x2-7l for qemu-devel@nongnu.org; Mon, 09 Jun 2014 09:43:24 -0400 From: Stefan Hajnoczi Date: Mon, 9 Jun 2014 15:43:05 +0200 Message-Id: <1402321386-17773-5-git-send-email-stefanha@redhat.com> In-Reply-To: <1402321386-17773-1-git-send-email-stefanha@redhat.com> References: <1402321386-17773-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 4/5] tests: e1000: test additional device IDs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , "Gabriel L. Somlo" , Gabriel Somlo , Stefan Hajnoczi From: "Gabriel L. Somlo" Update e1000-test.c to check all currently supported devices. Suggested-by: Andreas F=C3=A4rber Signed-off-by: Gabriel Somlo Reviewed-by: Michael S. Tsirkin Reviewed-by: Peter Crosthwaite Reviewed-by: Stefan Hajnoczi Signed-off-by: Stefan Hajnoczi --- 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" =20 /* Tests only initialization so far. TODO: Replace with functional tests= */ -static void nop(void) +static void test_device(gconstpointer data) { + const char *model =3D data; + QTestState *s; + char *args; + + args =3D g_strdup_printf("-device %s", model); + s =3D qtest_start(args); + + if (s) { + qtest_quit(s); + } + g_free(args); } =20 +static const char *models[] =3D { + "e1000", + "e1000-82540em", + "e1000-82544gc", + "e1000-82545em", + "e1000-82573l", +}; + int main(int argc, char **argv) { - int ret; + int i; =20 g_test_init(&argc, &argv, NULL); - qtest_add_func("/e1000/nop", nop); =20 - qtest_start("-device e1000"); - ret =3D g_test_run(); + for (i =3D 0; i < ARRAY_SIZE(models); i++) { + char *path; =20 - qtest_end(); + path =3D g_strdup_printf("/%s/e1000/%s", qtest_get_arch(), model= s[i]); + g_test_add_data_func(path, models[i], test_device); + } =20 - return ret; + return g_test_run(); } --=20 1.9.3