qemu/tests/eepro100-test.c
<<
>>
Prefs
   1/*
   2 * QTest testcase for eepro100 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 "qemu/osdep.h"
  11#include "libqtest.h"
  12
  13static void test_device(gconstpointer data)
  14{
  15    const char *model = data;
  16    QTestState *s;
  17    char *args;
  18
  19    args = g_strdup_printf("-device %s", model);
  20    s = qtest_start(args);
  21
  22    /* Tests only initialization so far. TODO: Implement functional tests */
  23
  24    if (s) {
  25        qtest_quit(s);
  26    }
  27    g_free(args);
  28}
  29
  30static const char *models[] = {
  31    "i82550",
  32    "i82551",
  33    "i82557a",
  34    "i82557b",
  35    "i82557c",
  36    "i82558a",
  37    "i82558b",
  38    "i82559a",
  39    "i82559b",
  40    "i82559c",
  41    "i82559er",
  42    "i82562",
  43    "i82801",
  44};
  45
  46int main(int argc, char **argv)
  47{
  48    int i;
  49
  50    g_test_init(&argc, &argv, NULL);
  51
  52    for (i = 0; i < ARRAY_SIZE(models); i++) {
  53        char *path;
  54
  55        path = g_strdup_printf("eepro100/%s", models[i]);
  56        qtest_add_data_func(path, models[i], test_device);
  57        g_free(path);
  58    }
  59
  60    return g_test_run();
  61}
  62