qemu/tests/e1000-test.c
<<
>>
Prefs
   1/*
   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 "qemu/osdep.h"
  11#include "libqtest.h"
  12
  13/* Tests only initialization so far. TODO: Replace with functional tests */
  14static void test_device(gconstpointer data)
  15{
  16    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);
  27}
  28
  29static const char *models[] = {
  30    "e1000",
  31    "e1000-82540em",
  32    "e1000-82544gc",
  33    "e1000-82545em",
  34};
  35
  36int main(int argc, char **argv)
  37{
  38    int i;
  39
  40    g_test_init(&argc, &argv, NULL);
  41
  42    for (i = 0; i < ARRAY_SIZE(models); i++) {
  43        char *path;
  44
  45        path = g_strdup_printf("e1000/%s", models[i]);
  46        qtest_add_data_func(path, models[i], test_device);
  47        g_free(path);
  48    }
  49
  50    return g_test_run();
  51}
  52