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