]> Git Repo - qemu.git/blame - tests/virtio-9p-test.c
tests: virtio-9p: introduce start/stop functions
[qemu.git] / tests / virtio-9p-test.c
CommitLineData
2d888c09
AF
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
fbc04127 10#include "qemu/osdep.h"
2d888c09
AF
11#include "libqtest.h"
12#include "qemu-common.h"
2d888c09 13
993f8054
GK
14static const char mount_tag[] = "qtest";
15static char *test_share;
2d888c09 16
993f8054 17static void qvirtio_9p_start(void)
2d888c09
AF
18{
19 char *args;
2d888c09 20
993f8054
GK
21 test_share = g_strdup("/tmp/qtest.XXXXXX");
22 g_assert_nonnull(mkdtemp(test_share));
2d888c09
AF
23
24 args = g_strdup_printf("-fsdev local,id=fsdev0,security_model=none,path=%s "
993f8054
GK
25 "-device virtio-9p-pci,fsdev=fsdev0,mount_tag=%s",
26 test_share, mount_tag);
27
2d888c09
AF
28 qtest_start(args);
29 g_free(args);
993f8054 30}
2d888c09 31
993f8054
GK
32static void qvirtio_9p_stop(void)
33{
2d888c09
AF
34 qtest_end();
35 rmdir(test_share);
993f8054
GK
36 g_free(test_share);
37}
38
39static void pci_nop(void)
40{
41 qvirtio_9p_start();
42 qvirtio_9p_stop();
43}
44
45int main(int argc, char **argv)
46{
47 g_test_init(&argc, &argv, NULL);
48 qtest_add_func("/virtio/9p/pci/nop", pci_nop);
2d888c09 49
993f8054 50 return g_test_run();
2d888c09 51}
This page took 0.149919 seconds and 4 git commands to generate.