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