From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnBFB-0001lZ-QO for qemu-devel@nongnu.org; Wed, 21 May 2014 14:28:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WnBF2-0002FB-S8 for qemu-devel@nongnu.org; Wed, 21 May 2014 14:28:01 -0400 Received: from mail-qg0-x232.google.com ([2607:f8b0:400d:c04::232]:46425) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnBF2-0002F6-NR for qemu-devel@nongnu.org; Wed, 21 May 2014 14:27:52 -0400 Received: by mail-qg0-f50.google.com with SMTP id z60so3899745qgd.9 for ; Wed, 21 May 2014 11:27:52 -0700 (PDT) From: "Gabriel L. Somlo" Date: Wed, 21 May 2014 14:27:44 -0400 Message-Id: <1400696864-22473-4-git-send-email-somlo@cmu.edu> In-Reply-To: <1400696864-22473-1-git-send-email-somlo@cmu.edu> References: <1400696864-22473-1-git-send-email-somlo@cmu.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v2 3/3] tests: e1000: test additional device IDs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: romain@dolbeau.org, mst@redhat.com, agraf@suse.de, stefanha@redhat.com, pbonzini@redhat.com, afaerber@suse.de Update e1000-test.c to check all currently supported devices. Suggested-by: Andreas Färber Signed-off-by: Gabriel Somlo --- tests/e1000-test.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/tests/e1000-test.c b/tests/e1000-test.c index a8ba2fc..81f164d 100644 --- a/tests/e1000-test.c +++ b/tests/e1000-test.c @@ -13,21 +13,40 @@ #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", +}; + 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.0