qemu/tests/virtio-9p-test.c
<<
>>
Prefs
   1/*
   2 * QTest testcase for VirtIO 9P
   3 *
   4 * Copyright (c) 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 <glib.h>
  12#include "libqtest.h"
  13#include "qemu-common.h"
  14
  15/* Tests only initialization so far. TODO: Replace with functional tests */
  16static void pci_nop(void)
  17{
  18}
  19
  20static char test_share[] = "/tmp/qtest.XXXXXX";
  21
  22int main(int argc, char **argv)
  23{
  24    char *args;
  25    int ret;
  26
  27    g_test_init(&argc, &argv, NULL);
  28    qtest_add_func("/virtio/9p/pci/nop", pci_nop);
  29
  30    g_assert(mkdtemp(test_share));
  31
  32    args = g_strdup_printf("-fsdev local,id=fsdev0,security_model=none,path=%s "
  33                           "-device virtio-9p-pci,fsdev=fsdev0,mount_tag=qtest",
  34                           test_share);
  35    qtest_start(args);
  36    g_free(args);
  37
  38    ret = g_test_run();
  39
  40    qtest_end();
  41    rmdir(test_share);
  42
  43    return ret;
  44}
  45