blob: 0c5fcdcc4478f060664028eef5d74583b5f4973e [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
Andreas Färbera21baf72013-11-07 18:25:10 +010010#include "qemu/osdep.h"
Peter Maydell681c28a2016-02-08 18:08:51 +000011#include "libqtest.h"
Andreas Färbera21baf72013-11-07 18:25:10 +010012
13/* Tests only initialization so far. TODO: Replace with functional tests */
Gabriel L. Somlob1673832014-06-02 09:33:28 -040014static void test_device(gconstpointer data)
Andreas Färbera21baf72013-11-07 18:25:10 +010015{
Gabriel L. Somlob1673832014-06-02 09:33:28 -040016 const char *model = data;
17 QTestState *s;
18 char *args;
19
20 args = g_strdup_printf("-device %s", model);
21 s = qtest_start(args);
22
23 if (s) {
24 qtest_quit(s);
25 }
26 g_free(args);
Andreas Färbera21baf72013-11-07 18:25:10 +010027}
28
Gabriel L. Somlob1673832014-06-02 09:33:28 -040029static const char *models[] = {
30 "e1000",
31 "e1000-82540em",
32 "e1000-82544gc",
33 "e1000-82545em",
Gabriel L. Somlob1673832014-06-02 09:33:28 -040034};
35
Andreas Färbera21baf72013-11-07 18:25:10 +010036int main(int argc, char **argv)
37{
Gabriel L. Somlob1673832014-06-02 09:33:28 -040038 int i;
Andreas Färbera21baf72013-11-07 18:25:10 +010039
40 g_test_init(&argc, &argv, NULL);
Andreas Färbera21baf72013-11-07 18:25:10 +010041
Gabriel L. Somlob1673832014-06-02 09:33:28 -040042 for (i = 0; i < ARRAY_SIZE(models); i++) {
43 char *path;
Andreas Färbera21baf72013-11-07 18:25:10 +010044
Andreas Färber53f77e42015-03-25 18:40:15 +010045 path = g_strdup_printf("e1000/%s", models[i]);
46 qtest_add_data_func(path, models[i], test_device);
Marc-André Lureau8829e162017-02-05 21:02:40 +000047 g_free(path);
Gabriel L. Somlob1673832014-06-02 09:33:28 -040048 }
Andreas Färbera21baf72013-11-07 18:25:10 +010049
Gabriel L. Somlob1673832014-06-02 09:33:28 -040050 return g_test_run();
Andreas Färbera21baf72013-11-07 18:25:10 +010051}