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 static const char mount_tag[] = "qtest"; 15 static char *test_share; 16 17 static void qvirtio_9p_start(void) 18 { 19 char *args; 20 21 test_share = g_strdup("/tmp/qtest.XXXXXX"); 22 g_assert_nonnull(mkdtemp(test_share)); 23 24 args = g_strdup_printf("-fsdev local,id=fsdev0,security_model=none,path=%s " 25 "-device virtio-9p-pci,fsdev=fsdev0,mount_tag=%s", 26 test_share, mount_tag); 27 28 qtest_start(args); 29 g_free(args); 30 } 31 32 static void qvirtio_9p_stop(void) 33 { 34 qtest_end(); 35 rmdir(test_share); 36 g_free(test_share); 37 } 38 39 static void pci_nop(void) 40 { 41 qvirtio_9p_start(); 42 qvirtio_9p_stop(); 43 } 44 45 int main(int argc, char **argv) 46 { 47 g_test_init(&argc, &argv, NULL); 48 qtest_add_func("/virtio/9p/pci/nop", pci_nop); 49 50 return g_test_run(); 51 } 52