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