blob: 81f164d9e926fb3b140bc9aee503dd60cc27e2d9 [file] [log] [blame]
Andreas Färbera21baf72013-11-07 18:25:10 +01001/*
2 * QTest testcase for e1000 NIC
3 *
4 * Copyright (c) 2013-2014 SUSE LINUX Products GmbH
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 */
9
10#include <glib.h>
11#include <string.h>
12#include "libqtest.h"
13#include "qemu/osdep.h"
14
15/* Tests only initialization so far. TODO: Replace with functional tests */
Gabriel L. Somlob1673832014-06-02 09:33:28 -040016static void test_device(gconstpointer data)
Andreas Färbera21baf72013-11-07 18:25:10 +010017{
Gabriel L. Somlob1673832014-06-02 09:33:28 -040018 const char *model = data;
19 QTestState *s;
20 char *args;
21
22 args = g_strdup_printf("-device %s", model);
23 s = qtest_start(args);
24
25 if (s) {
26 qtest_quit(s);
27 }
28 g_free(args);
Andreas Färbera21baf72013-11-07 18:25:10 +010029}
30
Gabriel L. Somlob1673832014-06-02 09:33:28 -040031static const char *models[] = {
32 "e1000",
33 "e1000-82540em",
34 "e1000-82544gc",
35 "e1000-82545em",
Gabriel L. Somlob1673832014-06-02 09:33:28 -040036};
37
Andreas Färbera21baf72013-11-07 18:25:10 +010038int main(int argc, char **argv)
39{
Gabriel L. Somlob1673832014-06-02 09:33:28 -040040 int i;
Andreas Färbera21baf72013-11-07 18:25:10 +010041
42 g_test_init(&argc, &argv, NULL);
Andreas Färbera21baf72013-11-07 18:25:10 +010043
Gabriel L. Somlob1673832014-06-02 09:33:28 -040044 for (i = 0; i < ARRAY_SIZE(models); i++) {
45 char *path;
Andreas Färbera21baf72013-11-07 18:25:10 +010046
Gabriel L. Somlob1673832014-06-02 09:33:28 -040047 path = g_strdup_printf("/%s/e1000/%s", qtest_get_arch(), models[i]);
48 g_test_add_data_func(path, models[i], test_device);
49 }
Andreas Färbera21baf72013-11-07 18:25:10 +010050
Gabriel L. Somlob1673832014-06-02 09:33:28 -040051 return g_test_run();
Andreas Färbera21baf72013-11-07 18:25:10 +010052}